@stacksjs/types 0.58.48 → 0.58.49

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 (60) hide show
  1. package/package.json +3 -2
  2. package/src/ai.ts +25 -0
  3. package/src/analytics.ts +21 -0
  4. package/src/api.ts +63 -0
  5. package/src/app.ts +172 -0
  6. package/src/auto-imports.ts +1 -0
  7. package/src/binary.ts +12 -0
  8. package/src/build.ts +2 -0
  9. package/src/cache.ts +98 -0
  10. package/src/cdn.ts +17 -0
  11. package/src/chat.ts +5 -0
  12. package/src/cli.ts +305 -0
  13. package/src/cloud.ts +85 -0
  14. package/src/components.ts +64 -0
  15. package/src/configure.ts +6 -0
  16. package/src/cron-jobs.ts +44 -0
  17. package/src/database.ts +45 -0
  18. package/src/dependencies.ts +69 -0
  19. package/src/deploy.ts +13 -0
  20. package/src/dns.ts +186 -0
  21. package/src/docs.ts +22 -0
  22. package/src/email.ts +16 -0
  23. package/src/env.ts +1 -0
  24. package/src/errors.ts +11 -0
  25. package/src/events.ts +30 -0
  26. package/src/exit-code.ts +10 -0
  27. package/src/file-systems.ts +70 -0
  28. package/src/git.ts +133 -0
  29. package/src/hashing.ts +131 -0
  30. package/src/helpers.ts +11 -0
  31. package/src/i18n.ts +19 -0
  32. package/src/index.ts +58 -0
  33. package/src/inspect.ts +10 -0
  34. package/src/layout.ts +8 -0
  35. package/src/library.ts +156 -0
  36. package/src/manifest.ts +9 -0
  37. package/src/model.ts +72 -0
  38. package/src/money.ts +3 -0
  39. package/src/native.ts +0 -0
  40. package/src/notifications.ts +147 -0
  41. package/src/pages.ts +10 -0
  42. package/src/payments.ts +65 -0
  43. package/src/promise.ts +1 -0
  44. package/src/push.ts +36 -0
  45. package/src/pwa.ts +8 -0
  46. package/src/queue.ts +36 -0
  47. package/src/reactivity.ts +1 -0
  48. package/src/router.ts +70 -0
  49. package/src/scheduler.ts +1 -0
  50. package/src/search-engine.ts +136 -0
  51. package/src/security.ts +23 -0
  52. package/src/services.ts +44 -0
  53. package/src/sms.ts +5 -0
  54. package/src/ssg.ts +3 -0
  55. package/src/stacks.ts +226 -0
  56. package/src/storage.ts +13 -0
  57. package/src/tables.ts +57 -0
  58. package/src/team.ts +8 -0
  59. package/src/ui.ts +197 -0
  60. package/src/utils.ts +47 -0
package/src/dns.ts ADDED
@@ -0,0 +1,186 @@
1
+ export interface ARecord {
2
+ name: string | '@' | '*'
3
+ address: string // IPv4
4
+ ttl?: number | 'auto'
5
+ }
6
+
7
+ export interface CNameRecord {
8
+ name: string
9
+ target: string
10
+ ttl: number | 'auto'
11
+ }
12
+
13
+ export interface MXRecord {
14
+ name: string | '@'
15
+ mailServer: string
16
+ ttl: number | 'auto'
17
+ priority: number // 0-65535
18
+ }
19
+
20
+ export interface TxtRecord {
21
+ name: string | '@'
22
+ ttl: number | 'auto'
23
+ content: string
24
+ }
25
+
26
+ export interface AAAARecord {
27
+ name: string | '@' | '*'
28
+ address: string // IPv6
29
+ ttl: number | 'auto'
30
+ }
31
+
32
+ export type DnsRecord = ARecord | CNameRecord | MXRecord | TxtRecord | AAAARecord
33
+
34
+ type CountryCode = 'AC' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AQ' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TP' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW' | string
35
+
36
+ export interface ExtraParam {
37
+ /**
38
+ * The name of an additional parameter that is required by a top-level domain.
39
+ * Here are the top-level domains that require additional parameters and the names of the parameters that they require:
40
+ * .com.au and .net.au AU_ID_NUMBER AU_ID_TYPE
41
+ * Valid values include the following: ABN (Australian business number) ACN (Australian company number) TM (Trademark number) .ca BRAND_NUMBER CA_BUSINESS_ENTITY_TYPE
42
+ * Valid values include the following: BANK (Bank) COMMERCIAL_COMPANY (Commercial company) COMPANY (Company) COOPERATION (Cooperation) COOPERATIVE (Cooperative) COOPRIX (Cooprix) CORP (Corporation) CREDIT_UNION (Credit union) FOMIA (Federation of mutual insurance associations) INC (Incorporated) LTD (Limited) LTEE (Limitée) LLC (Limited liability corporation) LLP (Limited liability partnership) LTE (Lte.) MBA (Mutual benefit association) MIC (Mutual insurance company) NFP (Not-for-profit corporation) SA (S.A.) SAVINGS_COMPANY (Savings company) SAVINGS_UNION (Savings union) SARL (Société à responsabilité limitée) TRUST (Trust) ULC (Unlimited liability corporation) CA_LEGAL_TYPE
43
+ * When ContactType is PERSON, valid values include the following: ABO (Aboriginal Peoples indigenous to Canada) CCT (Canadian citizen) LGR (Legal Representative of a Canadian Citizen or Permanent Resident) RES (Permanent resident of Canada)
44
+ * When ContactType is a value other than PERSON, valid values include the following: ASS (Canadian unincorporated association) CCO (Canadian corporation) EDU (Canadian educational institution) GOV (Government or government entity in Canada) HOP (Canadian Hospital) INB (Indian Band recognized by the Indian Act of Canada) LAM (Canadian Library, Archive, or Museum) MAJ (Her/His Majesty the Queen/King) OMK (Official mark registered in Canada) PLT (Canadian Political Party) PRT (Partnership Registered in Canada) TDM (Trademark registered in Canada) TRD (Canadian Trade Union) TRS (Trust established in Canada) .es ES_IDENTIFICATION
45
+ * The value of ES_IDENTIFICATION depends on the following values: The value of ES_LEGAL_FORM The value of ES_IDENTIFICATION_TYPE
46
+ * If ES_LEGAL_FORM is any value other than INDIVIDUAL: Specify 1 letter + 8 numbers (CIF [Certificado de Identificación Fiscal]) Example: B12345678
47
+ * If ES_LEGAL_FORM is INDIVIDUAL, the value that you specify for ES_IDENTIFICATION depends on the value of ES_IDENTIFICATION_TYPE:
48
+ * If ES_IDENTIFICATION_TYPE is DNI_AND_NIF (for Spanish contacts): Specify 8 numbers + 1 letter (DNI [Documento Nacional de Identidad], NIF [Número de Identificación Fiscal]) Example: 12345678M
49
+ * If ES_IDENTIFICATION_TYPE is NIE (for foreigners with legal residence): Specify 1 letter + 7 numbers + 1 letter ( NIE [Número de Identidad de Extranjero]) Example: Y1234567X
50
+ * If ES_IDENTIFICATION_TYPE is OTHER (for contacts outside of Spain): Specify a passport number, drivers license number, or national identity card number ES_IDENTIFICATION_TYPE
51
+ * Valid values include the following: DNI_AND_NIF (For Spanish contacts) NIE (For foreigners with legal residence) OTHER (For contacts outside of Spain) ES_LEGAL_FORM
52
+ * Valid values include the following: ASSOCIATION CENTRAL_GOVERNMENT_BODY CIVIL_SOCIETY COMMUNITY_OF_OWNERS COMMUNITY_PROPERTY CONSULATE COOPERATIVE DESIGNATION_OF_ORIGIN_SUPERVISORY_COUNCIL ECONOMIC_INTEREST_GROUP EMBASSY ENTITY_MANAGING_NATURAL_AREAS FARM_PARTNERSHIP FOUNDATION GENERAL_AND_LIMITED_PARTNERSHIP GENERAL_PARTNERSHIP INDIVIDUAL LIMITED_COMPANY LOCAL_AUTHORITY LOCAL_PUBLIC_ENTITY MUTUAL_INSURANCE_COMPANY NATIONAL_PUBLIC_ENTITY ORDER_OR_RELIGIOUS_INSTITUTION
53
+ * OTHERS (Only for contacts outside of Spain) POLITICAL_PARTY PROFESSIONAL_ASSOCIATION PUBLIC_LAW_ASSOCIATION PUBLIC_LIMITED_COMPANY REGIONAL_GOVERNMENT_BODY REGIONAL_PUBLIC_ENTITY SAVINGS_BANK SPANISH_OFFICE SPORTS_ASSOCIATION SPORTS_FEDERATION SPORTS_LIMITED_COMPANY TEMPORARY_ALLIANCE_OF_ENTERPRISES TRADE_UNION WORKER_OWNED_COMPANY WORKER_OWNED_LIMITED_COMPANY .eu EU_COUNTRY_OF_CITIZENSHIP .fi BIRTH_DATE_IN_YYYY_MM_DD FI_BUSINESS_NUMBER FI_ID_NUMBER FI_NATIONALITY
54
+ * Valid values include the following: FINNISH NOT_FINNISH FI_ORGANIZATION_TYPE Valid values include the following: COMPANY CORPORATION GOVERNMENT INSTITUTION POLITICAL_PARTY PUBLIC_COMMUNITY TOWNSHIP .it IT_NATIONALITY IT_PIN IT_REGISTRANT_ENTITY_TYPE
55
+ * Valid values include the following: FOREIGNERS FREELANCE_WORKERS (Freelance workers and professionals) ITALIAN_COMPANIES (Italian companies and one-person companies) NON_PROFIT_ORGANIZATIONS OTHER_SUBJECTS PUBLIC_ORGANIZATIONS .ru BIRTH_DATE_IN_YYYY_MM_DD RU_PASSPORT_DATA .se BIRTH_COUNTRY SE_ID_NUMBER .sg SG_ID_NUMBER .uk, .co.uk, .me.uk, and .org.uk UK_CONTACT_TYPE
56
+ * Valid values include the following: CRC (UK Corporation by Royal Charter) FCORP (Non-UK Corporation) FIND (Non-UK Individual, representing self) FOTHER (Non-UK Entity that does not fit into any other category) GOV (UK Government Body) IND (UK Individual (representing self)) IP (UK Industrial/Provident Registered Company) LLP (UK Limited Liability Partnership) LTD (UK Limited Company) OTHER (UK Entity that does not fit into any other category) PLC (UK Public Limited Company) PTNR (UK Partnership) RCHAR (UK Registered Charity) SCH (UK School) STAT (UK Statutory Body) STRA (UK Sole Trader) UK_COMPANY_NUMBER
57
+ * In addition, many TLDs require a VAT_NUMBER.
58
+ */
59
+ Name: ExtraParamName
60
+ /**
61
+ * The value that corresponds with the name of an extra parameter.
62
+ */
63
+ Value: ExtraParamValue
64
+ }
65
+ export type ExtraParamList = ExtraParam[]
66
+ export type ExtraParamName = 'DUNS_NUMBER' | 'BRAND_NUMBER' | 'BIRTH_DEPARTMENT' | 'BIRTH_DATE_IN_YYYY_MM_DD' | 'BIRTH_COUNTRY' | 'BIRTH_CITY' | 'DOCUMENT_NUMBER' | 'AU_ID_NUMBER' | 'AU_ID_TYPE' | 'CA_LEGAL_TYPE' | 'CA_BUSINESS_ENTITY_TYPE' | 'CA_LEGAL_REPRESENTATIVE' | 'CA_LEGAL_REPRESENTATIVE_CAPACITY' | 'ES_IDENTIFICATION' | 'ES_IDENTIFICATION_TYPE' | 'ES_LEGAL_FORM' | 'FI_BUSINESS_NUMBER' | 'FI_ID_NUMBER' | 'FI_NATIONALITY' | 'FI_ORGANIZATION_TYPE' | 'IT_NATIONALITY' | 'IT_PIN' | 'IT_REGISTRANT_ENTITY_TYPE' | 'RU_PASSPORT_DATA' | 'SE_ID_NUMBER' | 'SG_ID_NUMBER' | 'VAT_NUMBER' | 'UK_CONTACT_TYPE' | 'UK_COMPANY_NUMBER' | 'EU_COUNTRY_OF_CITIZENSHIP' | 'AU_PRIORITY_TOKEN' | string
67
+ export type ExtraParamValue = string
68
+
69
+ export interface ContactInfo extends ContactDetail {
70
+ admin?: ContactDetail // defaults to registrant
71
+ tech?: ContactDetail // defaults to registrant
72
+ }
73
+
74
+ /**
75
+ * **DNS Options**
76
+ *
77
+ * This configuration defines all of your DNS options. Because Stacks is fully-typed,
78
+ * you may hover any of the options below and the definitions will be provided. In case
79
+ * you have any questions, feel free to reach out via Discord or GitHub Discussions.
80
+ *
81
+ * @see https://stacksjs.org/docs/dns
82
+ */
83
+ export interface DnsOptions {
84
+ driver: 'aws'
85
+ a: ARecord[]
86
+ aaaa: AAAARecord[]
87
+ cname: CNameRecord[]
88
+ mx: MXRecord[]
89
+ txt: TxtRecord[]
90
+ nameservers: string[]
91
+ contactInfo: Partial<ContactInfo>
92
+ redirects: string[]
93
+ }
94
+
95
+ export type DnsConfig = Partial<DnsOptions>
96
+
97
+ export interface ContactDetail {
98
+ /**
99
+ * First name of contact.
100
+ */
101
+ firstName: string
102
+ /**
103
+ * Last name of contact.
104
+ */
105
+ lastName: string
106
+ /**
107
+ * Indicates whether the contact is a person, company, association, or public organization.
108
+ *
109
+ * Note the following:
110
+ * If you specify a value other than PERSON, you must also specify a value for OrganizationName.
111
+ * For some TLDs, the privacy protection available depends on the value that you specify for Contact Type.
112
+ * For the privacy protection settings for your TLD, see Domains that You Can Register with Amazon Route 53 in the Amazon Route 53 Developer Guide
113
+ * For .es domains, the value of ContactType must be PERSON for all three contacts.
114
+ *
115
+ * @default PERSON
116
+ */
117
+ contactType: 'PERSON' | 'COMPANY' | 'ASSOCIATION' | 'PUBLIC_BODY' | 'RESELLER' | string
118
+ /**
119
+ * Name of the organization for contact types other than PERSON.
120
+ */
121
+ organizationName: string
122
+ /**
123
+ * First line of the contact's address.
124
+ */
125
+ addressLine1: string
126
+ /**
127
+ * Second line of contact's address, if any.
128
+ */
129
+ addressLine2: string
130
+ /**
131
+ * The city of the contact's address.
132
+ */
133
+ city: string
134
+ /**
135
+ * The state or province of the contact's city.
136
+ */
137
+ state: string
138
+ /**
139
+ * Code for the country of the contact's address.
140
+ */
141
+ countryCode: CountryCode
142
+ /**
143
+ * The zip or postal code of the contact's address.
144
+ */
145
+ zip: string
146
+ /**
147
+ * The phone number of the contact.
148
+ * Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code&gt;]".
149
+ * For example, a US phone number might appear as "+1.1234567890".
150
+ * @example +1.1234567890
151
+ */
152
+ phoneNumber: string
153
+ /**
154
+ * Email address of the contact.
155
+ */
156
+ email: string
157
+ /**
158
+ * Fax number of the contact. Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890".
159
+ */
160
+ fax: string
161
+ /**
162
+ * A list of name-value pairs for parameters required by certain top-level domains.
163
+ */
164
+ extraParams: string
165
+
166
+ /**
167
+ * Enable privacy protection for this domain.
168
+ * @default true
169
+ */
170
+ privacy: boolean
171
+ /**
172
+ * Enable privacy protection for the admin contact.
173
+ * @default true
174
+ */
175
+ privacyAdmin: boolean
176
+ /**
177
+ * Enable privacy protection for the tech contact.
178
+ * @default true
179
+ */
180
+ privacyTech: boolean
181
+ /**
182
+ * Enable privacy protection for the registrant contact.
183
+ * @default true
184
+ */
185
+ privacyRegistrant: boolean
186
+ }
package/src/docs.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { UserConfig } from 'vitepress'
2
+
3
+ export type DocsConfig = UserConfig
4
+ export type DocsOptions = DocsConfig
5
+
6
+ export interface SocialLink {
7
+ icon: SocialLinkIcon
8
+ link: string
9
+ ariaLabel?: string
10
+ }
11
+
12
+ export enum SocialLinkIcon {
13
+ Discord = 'discord',
14
+ Facebook = 'facebook',
15
+ GitHub = 'github',
16
+ Instagram = 'instagram',
17
+ LinkedIn = 'linkedin',
18
+ Mastodon = 'mastodon',
19
+ Slack = 'slack',
20
+ Twitter = 'twitter',
21
+ YouTube = 'youtube',
22
+ }
package/src/email.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { IEmailOptions } from '@novu/stateless'
2
+
3
+ export type EmailOptions = Omit<IEmailOptions, 'from'> & {
4
+ from: {
5
+ name?: string
6
+ address?: string
7
+ }
8
+
9
+ mailboxes: string[]
10
+
11
+ server: {
12
+ scan?: boolean
13
+ }
14
+ }
15
+
16
+ export type EmailConfig = Partial<EmailOptions>
package/src/env.ts ADDED
@@ -0,0 +1 @@
1
+ // @stacksjs/env/src/types
package/src/errors.ts ADDED
@@ -0,0 +1,11 @@
1
+ // export declare class ValidationError extends Error {
2
+ // messages: any
3
+ // status: number
4
+ // code: string
5
+ // constructor(messages: any, options?: ErrorOptions)
6
+ // get [Symbol.toStringTag](): string
7
+ // toString(): string
8
+ // }
9
+
10
+ export type StacksError = Error
11
+ export type CommandError = Error
package/src/events.ts ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * **Events**
3
+ *
4
+ * This configuration defines all of your events. Because Stacks is fully-typed, you may
5
+ * hover any of the options below and the definitions will be provided. In case you
6
+ * have any questions, feel free to reach out via Discord or GitHub Discussions.
7
+ *
8
+ * @example To fire an event, you may use any of the following approaches:
9
+ * ```ts
10
+ * dispatch('user:registered', { name: 'Chris', email: 'chris@stacksjs.org' })
11
+ *
12
+ * // alternatively, you may use the following:
13
+ * useEvent('user:registered', { name: 'Chris', email: 'chris@stacksjs.org' })
14
+ * events.emit('user:registered', { name: 'Chris', email: 'chris@stacksjs.org' })
15
+ * useEvents.emit('user:registered', { name: 'Chris', email: 'chris@stacksjs.org' })
16
+ * ```
17
+ *
18
+ * @example To capture an event, you may use any of the following approaches:
19
+ * ```ts
20
+ * listen('user:registered', (user) => sendWelcomeEmail(user))
21
+ *
22
+ * // alternatively, you may use the following:
23
+ * useListen('user:registered', (user) => sendWelcomeEmail(user))
24
+ * events.on('user:registered', (user) => sendWelcomeEmail(user))
25
+ * useEvents.on('user:registered', (user) => sendWelcomeEmail(user))
26
+ * ```
27
+ */
28
+ export interface Events {
29
+ [key: string]: string[]
30
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI exit codes.
3
+ *
4
+ * @see https://nodejs.org/api/process.html#process_exit_codes
5
+ */
6
+ export enum ExitCode {
7
+ Success = 0,
8
+ FatalError = 1,
9
+ InvalidArgument = 9,
10
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Describes a plain-text file.
3
+ */
4
+ export interface TextFile {
5
+ path: string
6
+ data: string
7
+ }
8
+
9
+ /**
10
+ * Describes a JSON file.
11
+ */
12
+ export interface JsonFile {
13
+ path: string
14
+ data: unknown
15
+ indent: string
16
+ newline: string | undefined
17
+ }
18
+
19
+ /**
20
+ * Describes a package.json file.
21
+ */
22
+ export interface PackageJson {
23
+ engines: {
24
+ node: string
25
+ pnpm: string
26
+ }
27
+ version: string
28
+ packageManager: string
29
+ // wip
30
+ }
31
+
32
+ export interface FileSystemOptions {
33
+ default: string
34
+ disks: {
35
+ local: {
36
+ driver: 'local'
37
+ root: string
38
+ }
39
+
40
+ public: {
41
+ driver: 'public'
42
+ root: string
43
+ visibility?: 'public'
44
+ }
45
+
46
+ private: {
47
+ driver: 'private'
48
+ root: string
49
+ visibility?: 'private'
50
+ }
51
+
52
+ efs: {
53
+ driver: 'local'
54
+ root: string
55
+ }
56
+
57
+ s3: {
58
+ driver: 's3'
59
+ root: string
60
+ }
61
+
62
+ [key: string]: {
63
+ driver: string
64
+ root: string
65
+ visibility?: 'public' | 'private'
66
+ }
67
+ }
68
+ }
69
+
70
+ export type FileSystemConfig = Partial<FileSystemOptions>
package/src/git.ts ADDED
@@ -0,0 +1,133 @@
1
+ /**
2
+ * **Git Options**
3
+ *
4
+ * This configuration defines all of your git options. Because Stacks is fully-typed, you may
5
+ * hover any of the options below and the definitions will be provided. In case you
6
+ * have any questions, feel free to reach out via Discord or GitHub Discussions.
7
+ */
8
+ export interface GitOptions {
9
+ /**
10
+ * **Git Hooks**
11
+ *
12
+ * The git hooks to use.
13
+ *
14
+ * @see https://git-scm.com/docs/githooks
15
+ * @example
16
+ * ```ts
17
+ * git: {
18
+ * hooks: {
19
+ * 'pre-commit': 'lint-staged',
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ hooks: GitHooks
25
+
26
+ /**
27
+ * **Git Commit Scopes**
28
+ *
29
+ * The git commit scopes to use.
30
+ *
31
+ * @see https://stacksjs.org/docs/git/scopes
32
+ * @example
33
+ * git: [
34
+ * scopes: [
35
+ * '', 'ci', 'deps', 'dx', 'release', 'readme', 'test', 'actions', 'build', 'cli',
36
+ * 'config', 'examples', 'functions', 'modules', 'views', 'router', 'scripts',
37
+ * 'ui', 'utils', 'arrays', 'collections', 'fs', 'objects', 'strings',
38
+ * ]
39
+ * ]
40
+ */
41
+ scopes: string[]
42
+
43
+ /**
44
+ * **Git Commit Types**
45
+ *
46
+ * The git commit types to use.
47
+ *
48
+ * @default array
49
+ * @see https://stacksjs.org/docs/git/types
50
+ * @see https://www.conventionalcommits.org/en/v1.0.0/
51
+ * @example
52
+ * ```ts
53
+ * git: [
54
+ * types: [
55
+ * 'build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test',
56
+ * ]
57
+ * ]
58
+ * ```
59
+ */
60
+ types: {
61
+ value: string
62
+ name: string
63
+ emoji: string
64
+ }[]
65
+
66
+ /**
67
+ * **Messages—Options**
68
+ *
69
+ * The git messages/prompts to use.
70
+ *
71
+ * @default object
72
+ * @example
73
+ * ```ts
74
+ * messages: {
75
+ * type: 'Select the type of change that you’re committing:',
76
+ * scope: 'Denote the SCOPE of this change:',
77
+ * subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
78
+ * body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
79
+ * breaking: 'List any BREAKING CHANGES (optional):\n',
80
+ * footer: 'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n',
81
+ * confirmCommit: 'Are you sure you want to proceed with the commit above?',
82
+ * }
83
+ * ```
84
+ * @see https://stacksjs.org/docs/git/messages
85
+ */
86
+ messages: {
87
+ type: string
88
+ scope: string
89
+ customScope: string
90
+ subject: string
91
+ body: string
92
+ breaking: string
93
+ footerPrefixesSelect: string
94
+ customFooterPrefixes: string
95
+ footer: string
96
+ confirmCommit: string
97
+ }
98
+ }
99
+
100
+ interface Hooks {
101
+ 'applypatch-msg'?: string
102
+ 'pre-applypatch'?: string
103
+ 'post-applypatch'?: string
104
+ 'pre-commit'?: string
105
+ 'pre-merge-commit'?: string
106
+ 'prepare-commit-msg'?: string
107
+ 'commit-msg'?: string
108
+ 'post-commit'?: string
109
+ 'pre-rebase'?: string
110
+ 'post-checkout'?: string
111
+ 'post-merge'?: string
112
+ 'pre-push'?: string
113
+ 'pre-receive'?: string
114
+ 'update'?: string
115
+ 'proc-receive'?: string
116
+ 'post-receive'?: string
117
+ 'post-update'?: string
118
+ 'reference-transaction'?: string
119
+ 'push-to-checkout'?: string
120
+ 'pre-auto-gc'?: string
121
+ 'post-rewrite'?: string
122
+ 'sendemail-validate'?: string
123
+ 'fsmonitor-watchman'?: string
124
+ 'p4-changelist'?: string
125
+ 'p4-prepare-changelist'?: string
126
+ 'p4-post-changelist'?: string
127
+ 'p4-pre-submit'?: string
128
+ 'post-index-change'?: string
129
+ }
130
+
131
+ export type GitConfig = Partial<GitOptions>
132
+
133
+ export interface GitHooks extends Hooks {}
package/src/hashing.ts ADDED
@@ -0,0 +1,131 @@
1
+ /**
2
+ * The Stacks runtime provides secure Bcrypt & Argon2 hashing for storing user passwords.
3
+ * If you are using one of the Laravel application starter kits, Bcrypt will be used for
4
+ * registration and authentication by default.
5
+ *
6
+ * Bcrypt is a great choice for hashing passwords because its "work factor" is adjustable, which
7
+ * means that the time it takes to generate a hash can be increased as hardware power increases.
8
+ * When hashing passwords, slow is good. The longer an algorithm takes to hash a password, the
9
+ * longer it takes malicious users to generate "rainbow tables" of all possible string hash
10
+ * values that may be used in brute force attacks against applications.
11
+ *
12
+ * @see https://stacksjs.org/docs/hashing
13
+ */
14
+ export interface HashingOptions {
15
+ /**
16
+ * **Hashing Driver**
17
+ *
18
+ * This option controls the default hash driver that will be used to hash
19
+ * passwords for your application. By default, the bcrypt algorithm is
20
+ * used; however, you remain free to modify this option if you wish.
21
+ *
22
+ * @see https://stacksjs.org/docs/hashing
23
+ */
24
+ driver: 'argon2' | 'argon2id' | 'argon2i' | 'argon2d' | 'bcrypt'
25
+
26
+ /**
27
+ * **Bcrypt Option**
28
+ *
29
+ * Here you may specify the configuration options that should be used when
30
+ * passwords are hashed using the Bcrypt algorithm. This will allow you
31
+ * to control the amount of time it takes to hash the given password.
32
+ *
33
+ * @see https://stacksjs.org/docs/hashing
34
+ */
35
+ bcrypt?: BcryptOptions
36
+
37
+ /**
38
+ * **Argon Options**
39
+ *
40
+ * Here you may specify the configuration options that should be used when
41
+ * passwords are hashed using the Argon algorithm. These will allow you
42
+ * to control the amount of time it takes to hash the given password.
43
+ *
44
+ * @see https://stacksjs.org/docs/hashing
45
+ */
46
+ argon2?: ArgonOptions
47
+ }
48
+
49
+ export type HashingConfig = Partial<HashingOptions>
50
+
51
+ /**
52
+ * **Bcrypt Options**
53
+ *
54
+ * Here you may specify the configuration options that should be used when
55
+ * passwords are hashed using the Bcrypt algorithm. This will allow you
56
+ * to control the amount of time it takes to hash the given password.
57
+ *
58
+ * @see https://stacksjs.org/docs/hashing
59
+ */
60
+ export interface BcryptOptions {
61
+ /**
62
+ * Bcrypt salt rounds.
63
+ *
64
+ * @default number 10
65
+ * @see https://stacksjs.org/docs/hashing
66
+ */
67
+ rounds: number
68
+
69
+ /**
70
+ * Bcrypt cost. This is a number between 4-31.
71
+ * @default number 4
72
+ * @see https://stacksjs.org/docs/hashing
73
+ */
74
+ cost: number
75
+ }
76
+
77
+ /**
78
+ * **Argon Options**
79
+ *
80
+ * Here you may specify the configuration options that should be used when
81
+ * passwords are hashed using the Argon algorithm. These will allow you
82
+ * to control the amount of time it takes to hash the given password.
83
+ *
84
+ * @see https://stacksjs.org/docs/hashing
85
+ */
86
+ export interface ArgonOptions {
87
+ /**
88
+ * **Argon Memory**
89
+ *
90
+ * Amount of memory (in kibibytes) to use.
91
+ *
92
+ * @default number 65536
93
+ * @see https://stacksjs.org/docs/hashing
94
+ */
95
+ memory?: number
96
+
97
+ /**
98
+ * **Argon Parallelism**
99
+ *
100
+ * Degree of parallelism (i.e. number of threads).
101
+ *
102
+ * @default number 1
103
+ * @see https://stacksjs.org/docs/hashing
104
+ */
105
+ threads?: number
106
+
107
+ /**
108
+ * **Argon time**
109
+ *
110
+ * Execution time.
111
+ *
112
+ * @default number 1
113
+ * @see https://stacksjs.org/docs/hashing
114
+ */
115
+ time?: number
116
+ }
117
+
118
+ export type HashAlgorithm =
119
+ | 'md4'
120
+ | 'md5'
121
+ | 'sha1'
122
+ | 'sha256'
123
+ | 'sha384'
124
+ | 'sha512'
125
+ | 'ripemd128'
126
+ | 'ripemd160'
127
+ | 'tiger128'
128
+ | 'tiger160'
129
+ | 'tiger192'
130
+ | 'crc32'
131
+ | 'crc32b'
package/src/helpers.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { toString } from '@stacksjs/strings'
2
+
3
+ export function getTypeName(v: any) {
4
+ if (v === null)
5
+ return 'null'
6
+ const type = toString(v).slice(8, -1).toLowerCase()
7
+
8
+ return (typeof v === 'object' || typeof v === 'function')
9
+ ? type
10
+ : typeof v
11
+ }
package/src/i18n.ts ADDED
@@ -0,0 +1,19 @@
1
+ interface VitePluginVueI18nOptions {
2
+ forceStringify?: boolean
3
+ runtimeOnly?: boolean
4
+ compositionOnly?: boolean
5
+ fullInstall?: boolean
6
+ include?: string | string[]
7
+ defaultSFCLang?: 'json' | 'json5' | 'yml' | 'yaml'
8
+ globalSFCScope?: boolean
9
+ useVueI18nImportName?: boolean
10
+ }
11
+
12
+ /**
13
+ * **Internationalization Options**
14
+ *
15
+ * The i18n option.
16
+ *
17
+ * @see https://github.com/intlify/bundle-tools/blob/main/packages/vite-plugin-vue-i18n/src/options.ts
18
+ */
19
+ export type i18nOptions = VitePluginVueI18nOptions