@stacksjs/types 0.72.98 → 0.72.99

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/events.d.ts CHANGED
@@ -1,10 +1,14 @@
1
- export type * from '../../../types/events';
2
1
  /**
3
2
  * **Events**
4
3
  *
5
- * This configuration defines all of your events. Because Stacks is fully-typed, you may
6
- * hover any of the options below and the definitions will be provided. In case you
7
- * have any questions, feel free to reach out via Discord or GitHub Discussions.
4
+ * The `app/Events.ts` map, re-exported from `@stacksjs/events` so that the
5
+ * event bus stays the single place an event name is defined. It used to be
6
+ * declared here as `interface Events { [key: string]: string[] }`, which is an
7
+ * index signature over two things that are not open sets: an event name comes
8
+ * from `AppEvents`/`AuthEvents`, and a listener name is a file on disk. Both
9
+ * halves being `string` meant a typo in either one type-checked and then did
10
+ * nothing at runtime, which is the failure mode an event map is least able to
11
+ * report.
8
12
  *
9
13
  * @example To fire an event, you may use any of the following approaches:
10
14
  * ```ts
@@ -26,6 +30,4 @@ export type * from '../../../types/events';
26
30
  * useEvents.on('user:registered', (user) => sendWelcomeEmail(user))
27
31
  * ```
28
32
  */
29
- export declare interface Events {
30
- [key: string]: string[]
31
- }
33
+ export type { EventListeners, EventName, Events, ListenerName, StacksEvents } from '@stacksjs/events';
package/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@ export * from './ai';
2
2
  export * from './analytics';
3
3
  export * from './api';
4
4
  export * from './app';
5
- export * from './attributes';
6
5
  export * from './auction';
7
6
  export * from './auth';
8
7
  export * from './oauth';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- function a(e){return typeof e==="object"&&e!==null&&"id"in e&&"userId"in e&&"clientId"in e&&"scopes"in e}function c(e){return a(e)&&"abilities"in e}function d(e){return typeof e==="object"&&e!==null&&"id"in e&&"name"in e&&"secret"in e&&"redirect"in e}var i;((t)=>{t.Second="* * * * * *";t.FiveSeconds="*/5 * * * * *";t.TenSeconds="*/10 * * * * *";t.ThirtySeconds="*/30 * * * * *";t.Minute="* * * * *";t.TwoMinutes="*/2 * * * *";t.FiveMinutes="*/5 * * * *";t.TenMinutes="*/10 * * * *";t.FifteenMinutes="*/15 * * * *";t.ThirtyMinutes="*/30 * * * *";t.Hour="0 * * * *";t.HalfHour="0,30 * * * *";t.Day="0 0 * * *";t.Week="0 0 * * 0";t.Weekday="0 0 * * 1-5";t.Weekend="0 0 * * 0,6";t.Month="0 0 1 * *";t.Year="0 0 1 1 *"})(i||={});var s;((r)=>{r.Bluesky="bluesky";r.Discord="discord";r.Facebook="facebook";r.GitHub="github";r.Instagram="instagram";r.LinkedIn="linkedin";r.Mastodon="mastodon";r.Slack="slack";r.Twitter="twitter";r.YouTube="youtube"})(s||={});var l;((n)=>{n[n.Success=0]="Success";n[n.FatalError=1]="FatalError";n[n.InvalidArgument=9]="InvalidArgument"})(l||={});import{toString as p}from"@stacksjs/strings";function x(e){if(e===null)return"null";let o=p(e).slice(8,-1).toLowerCase();return typeof e==="object"||typeof e==="function"?o:typeof e}function h(e){return e}function T(e){return e}var C={development:{default:"sync",connections:{sync:{driver:"sync"}},failed:{driver:"database",table:"failed_jobs"}},production:{default:"redis",connections:{redis:{driver:"redis",prefix:"stacks:queue",concurrency:5,distributedLock:!0,metrics:{enabled:!0},defaultDeadLetterOptions:{enabled:!0,maxRetries:3}}},failed:{driver:"redis",prefix:"stacks:failed"},worker:{concurrency:5,shutdownTimeout:30000}},highPerformance:{default:"redis",connections:{redis:{driver:"redis",prefix:"stacks:queue",concurrency:20,distributedLock:!0,metrics:{enabled:!0,collectInterval:5000},horizontalScaling:{enabled:!0,maxWorkersPerInstance:20,jobsPerWorker:50},defaultDeadLetterOptions:{enabled:!0,maxRetries:5}}},failed:{driver:"redis",prefix:"stacks:failed"},worker:{concurrency:20,shutdownTimeout:60000}},database:{default:"database",connections:{database:{driver:"database",table:"jobs",queue:"default",retryAfter:90}},failed:{driver:"database",table:"failed_jobs"}}};var M={server:{development:{enabled:!0,mode:"server",debug:!0,server:{host:"localhost",port:6001,scheme:"ws",driver:"bun",rateLimit:{enabled:!1},healthCheck:{enabled:!0,path:"/health"}},channels:{public:!0,private:!0,presence:!0}},production:{enabled:!0,mode:"server",debug:!1,server:{host:"0.0.0.0",port:6001,scheme:"wss",driver:"bun",redis:{enabled:!0,prefix:"stacks:realtime:"},rateLimit:{enabled:!0,maxConnectionsPerIp:100,maxMessagesPerSecond:50,maxPayloadSize:65536},loadManagement:{maxConnections:1e4,backpressureThreshold:1000,messageQueueSize:1e4,gracefulShutdownTimeout:30000},autoScaling:{min:2,max:10,targetCPU:70},healthCheck:{enabled:!0,path:"/health",interval:30},metrics:{enabled:!0,port:9090,path:"/metrics"}},channels:{public:!0,private:!0,presence:!0}},highPerformance:{enabled:!0,mode:"server",server:{driver:"bun",redis:{enabled:!0,cluster:!0},rateLimit:{enabled:!0,maxConnectionsPerIp:500,maxMessagesPerSecond:200,maxPayloadSize:131072},loadManagement:{maxConnections:1e5,backpressureThreshold:5000,messageQueueSize:50000,gracefulShutdownTimeout:60000},autoScaling:{min:4,max:50,targetCPU:60}}},chat:{enabled:!0,mode:"server",server:{driver:"bun",redis:{enabled:!0},rateLimit:{enabled:!0,maxConnectionsPerIp:10,maxMessagesPerSecond:20},loadManagement:{maxConnections:50000}},channels:{public:!0,private:!0,presence:{enabled:!0,maxMembersPerChannel:500,memberInfoTtl:60}}},gaming:{enabled:!0,mode:"server",server:{driver:"bun",redis:{enabled:!0,cluster:!0},rateLimit:{enabled:!0,maxConnectionsPerIp:50,maxMessagesPerSecond:100},loadManagement:{maxConnections:50000,backpressureThreshold:2000,messageQueueSize:20000},autoScaling:{min:2,max:20,targetCPU:50}},channels:{public:!0,private:!0,presence:!0}}},serverless:{development:{enabled:!0,mode:"serverless",debug:!0,serverless:{connectionTimeout:3600,idleTimeout:600,stageName:"dev",memorySize:256,timeout:30},channels:{public:!0,private:!0,presence:!0}},production:{enabled:!0,mode:"serverless",debug:!1,serverless:{connectionTimeout:3600,idleTimeout:600,stageName:"production",memorySize:512,timeout:30,provisionedConcurrency:2},channels:{public:!0,private:!0,presence:!0}},notifications:{enabled:!0,mode:"serverless",serverless:{connectionTimeout:7200,idleTimeout:1800,memorySize:256,timeout:15},channels:{public:!0,private:!0,presence:!1}}}};var S={calendar:{github:"stacksjs/calendar",package:"@stacksjs/calendar",description:"Calendar links, ICS generation, and an STX calendar component"},table:{github:"stacksjs/table",package:"@stacksjs/table",description:"Typed table drivers and an STX data table component"}};export{i as Every,l as ExitCode,C as QueuePresets,M as RealtimePresets,s as SocialLinkIcon,h as defineModel,T as defineModels,x as getTypeName,a as isAccessToken,d as isOAuthClient,c as isPersonalAccessToken,S as stackExtensionRegistry};
2
+ function a(e){return typeof e==="object"&&e!==null&&"id"in e&&"userId"in e&&"clientId"in e&&"scopes"in e}function c(e){return a(e)&&"abilities"in e}function d(e){return typeof e==="object"&&e!==null&&"id"in e&&"name"in e&&"secret"in e&&"redirect"in e}var i;((t)=>{t.Second="* * * * * *";t.FiveSeconds="*/5 * * * * *";t.TenSeconds="*/10 * * * * *";t.ThirtySeconds="*/30 * * * * *";t.Minute="* * * * *";t.TwoMinutes="*/2 * * * *";t.FiveMinutes="*/5 * * * *";t.TenMinutes="*/10 * * * *";t.FifteenMinutes="*/15 * * * *";t.ThirtyMinutes="*/30 * * * *";t.Hour="0 * * * *";t.HalfHour="0,30 * * * *";t.Day="0 0 * * *";t.Week="0 0 * * 0";t.Weekday="0 0 * * 1-5";t.Weekend="0 0 * * 0,6";t.Month="0 0 1 * *";t.Year="0 0 1 1 *"})(i||={});var s;((r)=>{r.Bluesky="bluesky";r.Discord="discord";r.Facebook="facebook";r.GitHub="github";r.Instagram="instagram";r.LinkedIn="linkedin";r.Mastodon="mastodon";r.Slack="slack";r.Twitter="twitter";r.YouTube="youtube"})(s||={});var l;((n)=>{n[n.Success=0]="Success";n[n.FatalError=1]="FatalError";n[n.InvalidArgument=9]="InvalidArgument"})(l||={});import{toString as p}from"@stacksjs/strings";function y(e){if(e===null)return"null";let o=p(e).slice(8,-1).toLowerCase();return typeof e==="object"||typeof e==="function"?o:typeof e}function h(e){return e}function T(e){return e}var C={development:{default:"sync",connections:{sync:{driver:"sync"}},failed:{driver:"database",table:"failed_jobs"}},production:{default:"redis",connections:{redis:{driver:"redis",prefix:"stacks:queue",concurrency:5,distributedLock:!0,metrics:{enabled:!0},defaultDeadLetterOptions:{enabled:!0,maxRetries:3}}},failed:{driver:"redis",prefix:"stacks:failed"},worker:{concurrency:5,shutdownTimeout:30000}},highPerformance:{default:"redis",connections:{redis:{driver:"redis",prefix:"stacks:queue",concurrency:20,distributedLock:!0,metrics:{enabled:!0,collectInterval:5000},horizontalScaling:{enabled:!0,maxWorkersPerInstance:20,jobsPerWorker:50},defaultDeadLetterOptions:{enabled:!0,maxRetries:5}}},failed:{driver:"redis",prefix:"stacks:failed"},worker:{concurrency:20,shutdownTimeout:60000}},database:{default:"database",connections:{database:{driver:"database",table:"jobs",queue:"default",retryAfter:90}},failed:{driver:"database",table:"failed_jobs"}}};var M={server:{development:{enabled:!0,mode:"server",debug:!0,server:{host:"localhost",port:6001,scheme:"ws",driver:"bun",rateLimit:{enabled:!1},healthCheck:{enabled:!0,path:"/health"}},channels:{public:!0,private:!0,presence:!0}},production:{enabled:!0,mode:"server",debug:!1,server:{host:"0.0.0.0",port:6001,scheme:"wss",driver:"bun",redis:{enabled:!0,prefix:"stacks:realtime:"},rateLimit:{enabled:!0,maxConnectionsPerIp:100,maxMessagesPerSecond:50,maxPayloadSize:65536},loadManagement:{maxConnections:1e4,backpressureThreshold:1000,messageQueueSize:1e4,gracefulShutdownTimeout:30000},autoScaling:{min:2,max:10,targetCPU:70},healthCheck:{enabled:!0,path:"/health",interval:30},metrics:{enabled:!0,port:9090,path:"/metrics"}},channels:{public:!0,private:!0,presence:!0}},highPerformance:{enabled:!0,mode:"server",server:{driver:"bun",redis:{enabled:!0,cluster:!0},rateLimit:{enabled:!0,maxConnectionsPerIp:500,maxMessagesPerSecond:200,maxPayloadSize:131072},loadManagement:{maxConnections:1e5,backpressureThreshold:5000,messageQueueSize:50000,gracefulShutdownTimeout:60000},autoScaling:{min:4,max:50,targetCPU:60}}},chat:{enabled:!0,mode:"server",server:{driver:"bun",redis:{enabled:!0},rateLimit:{enabled:!0,maxConnectionsPerIp:10,maxMessagesPerSecond:20},loadManagement:{maxConnections:50000}},channels:{public:!0,private:!0,presence:{enabled:!0,maxMembersPerChannel:500,memberInfoTtl:60}}},gaming:{enabled:!0,mode:"server",server:{driver:"bun",redis:{enabled:!0,cluster:!0},rateLimit:{enabled:!0,maxConnectionsPerIp:50,maxMessagesPerSecond:100},loadManagement:{maxConnections:50000,backpressureThreshold:2000,messageQueueSize:20000},autoScaling:{min:2,max:20,targetCPU:50}},channels:{public:!0,private:!0,presence:!0}}},serverless:{development:{enabled:!0,mode:"serverless",debug:!0,serverless:{connectionTimeout:3600,idleTimeout:600,stageName:"dev",memorySize:256,timeout:30},channels:{public:!0,private:!0,presence:!0}},production:{enabled:!0,mode:"serverless",debug:!1,serverless:{connectionTimeout:3600,idleTimeout:600,stageName:"production",memorySize:512,timeout:30,provisionedConcurrency:2},channels:{public:!0,private:!0,presence:!0}},notifications:{enabled:!0,mode:"serverless",serverless:{connectionTimeout:7200,idleTimeout:1800,memorySize:256,timeout:15},channels:{public:!0,private:!0,presence:!1}}}};var S={calendar:{github:"stacksjs/calendar",package:"@stacksjs/calendar",description:"Calendar links, ICS generation, and an STX calendar component"},table:{github:"stacksjs/table",package:"@stacksjs/table",description:"Typed table drivers and an STX data table component"}};export{i as Every,l as ExitCode,C as QueuePresets,M as RealtimePresets,s as SocialLinkIcon,h as defineModel,T as defineModels,y as getTypeName,a as isAccessToken,d as isOAuthClient,c as isPersonalAccessToken,S as stackExtensionRegistry};
@@ -1 +1,25 @@
1
- export type ModelNames = 'Tag' | 'PaymentProduct' | 'FailedJob' | 'SocialPost' | 'PaymentMethod' | 'Campaign' | 'PaymentTransaction' | 'Request' | 'Activity' | 'EmailList' | 'Notification' | 'Job' | 'Log' | 'Subscription' | 'Error' | 'Comment' | 'User' | 'Websocket' | 'Page' | 'Author' | 'Post' | 'PrintDevice' | 'Category' | 'Payment' | 'Driver' | 'WaitlistProduct' | 'DigitalDelivery' | 'Manufacturer' | 'OrderItem' | 'ShippingZone' | 'Customer' | 'Product' | 'Receipt' | 'ProductVariant' | 'LicenseKey' | 'WaitlistRestaurant' | 'Review' | 'ProductUnit' | 'GiftCard' | 'Order' | 'Coupon' | 'TaxRate' | 'Transaction' | 'LoyaltyPoint' | 'LoyaltyReward' | 'ShippingMethod' | 'ShippingRate' | 'Cart' | 'DeliveryRoute' | 'CartItem';
1
+ /**
2
+ * Every model this application has, by the name the ORM exposes it under.
3
+ *
4
+ * This used to be a hand-written union, and it was 50 names against the 97 the
5
+ * application actually had - so `belongsTo: ['Site']` was a type error for a
6
+ * model that exists, and had been for as long as nobody added it here. A list
7
+ * maintained alongside the thing it lists only ever drifts one way.
8
+ *
9
+ * `storage/framework/types/models.d.ts` fills the registry below from the
10
+ * models barrel, which is generated for the RUNTIME (`injectGlobalAutoImports`
11
+ * imports it to put the models on `globalThis`), so this adds no generation
12
+ * step of its own and cannot disagree with what the runtime has.
13
+ */
14
+ // eslint-disable-next-line ts/no-empty-object-type -- augmentation target; empty by design
15
+ export declare interface ModelRegistry {}
16
+ /**
17
+ * A model name, as narrow as the application has made it.
18
+ *
19
+ * Falls back to `string` while the registry is empty. A project whose barrel
20
+ * has not been generated yet has no list to check against, and rejecting every
21
+ * model name until `buddy generate` runs would be worse than checking none.
22
+ */
23
+ export type ModelNames = keyof ModelRegistry extends never
24
+ ? string
25
+ : keyof ModelRegistry & string;
package/dist/storage.d.ts CHANGED
@@ -49,7 +49,7 @@ export declare interface MimeTypeOptions {
49
49
  useExtension?: boolean
50
50
  }
51
51
  export declare interface StorageOptions {
52
- driver: 's3' | 'efs' | 'local' | 'bun' | 'memory'
52
+ driver: 'local' | 'public' | 's3'
53
53
  root?: string
54
54
  s3?: {
55
55
  bucket: string
@@ -1 +1,45 @@
1
- export type TableNames = 'tags' | 'taggables' | 'categorizables' | 'comments' | 'commentables' | 'commentable_upvotes' | 'passkeys' | 'password_resets' | 'query_logs' | 'migrations' | 'tags' | 'payment_products' | 'failed_jobs' | 'social_posts' | 'payment_methods' | 'campaigns' | 'payment_transactions' | 'requests' | 'activities' | 'email_lists' | 'notifications' | 'jobs' | 'logs' | 'subscriptions' | 'errors' | 'comments' | 'users' | 'websockets' | 'pages' | 'authors' | 'posts' | 'print_devices' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'receipts' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'transactions' | 'loyalty_points' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'carts' | 'delivery_routes' | 'cart_items' | 'subscribers' | 'subscriber_emails';
1
+ /**
2
+ * Every table this application's models write to.
3
+ *
4
+ * Derived from the models rather than listed beside them. The hand-written
5
+ * union this replaces had 62 entries against 97 models, listed `tags` and
6
+ * `comments` twice, and had no way to know about a table added since whoever
7
+ * last edited it.
8
+ *
9
+ * `storage/framework/types/models.d.ts` fills the registry from the models
10
+ * barrel and each model's own `table`, so the answer to "which tables are
11
+ * there" is "the ones the models declare".
12
+ */
13
+ // eslint-disable-next-line ts/no-empty-object-type -- augmentation target; empty by design
14
+ export declare interface TableRegistry {}
15
+ /**
16
+ * The pivot tables the trait migrations own.
17
+ *
18
+ * Declared here rather than derived because no model declares them: they are
19
+ * created by `migrateTraitTables()` for whichever models opt into the
20
+ * commentable / taggable / categorizable traits. `traitTableNames()` in
21
+ * `@stacksjs/database` is typed against this, so the runtime list and the type
22
+ * cannot drift apart without a compile error.
23
+ */
24
+ export type TraitTableName = | 'commentables'
25
+ | 'taggables'
26
+ | 'categorizables'
27
+ | 'commentable_upvotes'
28
+ | 'taggable_models'
29
+ | 'categorizable_models';
30
+ /**
31
+ * Every table the framework owns that no model declares.
32
+ */
33
+ export type FrameworkTableName = | TraitTableName
34
+ | 'categories_models'
35
+ | 'passkeys'
36
+ | 'password_resets'
37
+ | 'migrations';
38
+ /**
39
+ * A table name, as narrow as the application has made it.
40
+ *
41
+ * Falls back to `string` while the registry is empty, for the same reason
42
+ * {@link ModelNames} does.
43
+ */
44
+ export type TableNames = | (keyof TableRegistry extends never ? string : keyof TableRegistry & string)
45
+ | FrameworkTableName;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.72.98",
4
+ "version": "0.72.99",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -57,8 +57,9 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@stacksjs/bunpress": "^0.2.8",
60
+ "@stacksjs/events": "0.72.99",
60
61
  "@stacksjs/clapp": "^0.2.12",
61
- "@stacksjs/stx": "^0.2.236",
62
+ "@stacksjs/stx": "^0.2.245",
62
63
  "@stacksjs/ts-validation": "^0.5.6",
63
64
  "bun-query-builder": "^0.2.53"
64
65
  },
@@ -71,7 +72,7 @@
71
72
  }
72
73
  },
73
74
  "devDependencies": {
74
- "@stacksjs/validation": "0.72.98",
75
+ "@stacksjs/validation": "0.72.99",
75
76
  "better-dx": "^0.2.24",
76
77
  "meilisearch": "^0.59.0"
77
78
  },
@@ -1 +0,0 @@
1
- export type * as GeneratedAttributes from '../../../types/attributes';