@stacksjs/actions 0.72.6 → 0.72.7

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/action.d.ts CHANGED
@@ -33,7 +33,7 @@ export declare interface ActionResponse {
33
33
  description: string
34
34
  schema?: Record<string, unknown>
35
35
  }
36
- declare interface ActionOptions<TModel = string, TValidations extends ActionValidations | undefined = undefined, TPath extends string = '',> {
36
+ declare interface ActionOptions<TModel = string, TValidations extends ActionValidations | undefined = undefined, TPath extends string = '', /** * The payload `handle` receives when the action is invoked by something * other than the router - an event listener, for instance, which calls it * with the event object rather than a request (`app/Events.ts` maps * 'user:registered' straight onto an action name). Defaults to `never`, * which leaves every HTTP action typed exactly as before. */ TPayload = never,> {
37
37
  name?: string
38
38
  description?: string
39
39
  apiResponse?: boolean
@@ -58,7 +58,7 @@ declare interface ActionOptions<TModel = string, TValidations extends ActionVali
58
58
  ) => void | Response | Promise<void | Response>
59
59
  handle: {
60
60
  bivarianceHack: (
61
- request: InferRequest<TModel, TValidations, TPath>,
61
+ request: [TPayload] extends [never] ? InferRequest<TModel, TValidations, TPath> : TPayload,
62
62
  ) => ActionResult | Promise<ActionResult>
63
63
  }['bivarianceHack']
64
64
  dependencies?: () => Record<string, unknown>
@@ -114,7 +114,7 @@ export type ActionResult = | Response
114
114
  | boolean
115
115
  | object
116
116
  | unknown[];
117
- export declare class Action<TModel = string, TValidations extends ActionValidations | undefined = undefined, TPath extends string = '',> {
117
+ export declare class Action<TModel = string, TValidations extends ActionValidations | undefined = undefined, TPath extends string = '', TPayload = never,> {
118
118
  name?: string;
119
119
  description?: string;
120
120
  apiResponse?: boolean;
@@ -132,7 +132,7 @@ export declare class Action<TModel = string, TValidations extends ActionValidati
132
132
  csrf?: boolean;
133
133
  authorize?: ActionOptions<TModel, TValidations, TPath>['authorize'];
134
134
  before?: ActionOptions<TModel, TValidations, TPath>['before'];
135
- handle: ActionOptions<TModel, TValidations, TPath>['handle'];
135
+ handle: ActionOptions<TModel, TValidations, TPath, TPayload>['handle'];
136
136
  model?: string;
137
137
  modelDefinition?: TModel;
138
138
  constructor({
@@ -156,7 +156,7 @@ export declare class Action<TModel = string, TValidations extends ActionValidati
156
156
  authorize,
157
157
  before,
158
158
  dependencies,
159
- }: ActionOptions<TModel, TValidations, TPath>);
159
+ }: ActionOptions<TModel, TValidations, TPath, TPayload>);
160
160
  get deps(): Record<string, unknown>;
161
161
  overrideDependencies(overrides: Record<string, unknown>): void;
162
162
  resetDependencies(): void;
@@ -1,3 +1,4 @@
1
+ import type { ResponseStatus } from '@stacksjs/bun-router';
1
2
  /**
2
3
  * Turn a title into a filename-safe slug.
3
4
  *
@@ -50,6 +51,6 @@ export declare interface BlogPostInput {
50
51
  body?: string
51
52
  }
52
53
  export declare class BlogAdminError extends Error {
53
- readonly status?: number;
54
- constructor(message: string, status?: number);
54
+ readonly status?: ResponseStatus;
55
+ constructor(message: string, status?: ResponseStatus);
55
56
  }
package/dist/make.d.ts CHANGED
@@ -12,7 +12,12 @@ export declare function make(options: MakeOptions): Promise<void>;
12
12
  export declare function makeAction(options: MakeOptions): Promise<void>;
13
13
  export declare function makeComponent(options: MakeOptions): Promise<void>;
14
14
  export declare function createAction(options: MakeOptions): Promise<void>;
15
- export declare function createComponent(options: MakeOptions): Promise<void>;
15
+ /**
16
+ * Only `name` is read here, so only `name` is required. Taking the full
17
+ * `MakeOptions` - whose members are all mandatory - meant a caller with just a
18
+ * name (the dashboard's "new component" button) could not call this at all.
19
+ */
20
+ export declare function createComponent(options: Pick<MakeOptions, 'name'>): Promise<void>;
16
21
  export declare function componentFileName(name: string): string;
17
22
  export declare function makeDatabase(options: MakeOptions): void;
18
23
  export declare function createDatabase(options: MakeOptions): void;
@@ -42,7 +47,8 @@ export declare function makePage(options: MakeOptions): Promise<void>;
42
47
  export declare function createPage(options: MakeOptions): Promise<void>;
43
48
  export declare function pageFileName(name: string): string;
44
49
  export declare function makeFunction(options: MakeOptions): Promise<void>;
45
- export declare function createFunction(options: MakeOptions): Promise<void>;
50
+ /** As `createComponent`: the name is the only option this reads. */
51
+ export declare function createFunction(options: Pick<MakeOptions, 'name'>): Promise<void>;
46
52
  export declare function makeLanguage(options: MakeOptions): Promise<void>;
47
53
  export declare function createLanguage(options: MakeOptions): Promise<void>;
48
54
  export declare function makeStack(options: MakeOptions): Promise<void>;
package/dist/release.js CHANGED
@@ -1 +1 @@
1
- import{parseOptions}from"@stacksjs/cli";import{app}from"@stacksjs/config";import{Action}from"@stacksjs/enums";import{log}from"@stacksjs/logging";import{projectPath}from"@stacksjs/path";import{runActions}from".";import{BYPASS_ENV,formatPreflightFailure,runPinnedChecks}from"./release-preflight";const raw=parseOptions()??{},passthrough={};for(const[k,v]of Object.entries(raw)){if(k==="--"||k==="_")continue;passthrough[k]=v}const isDryRun=passthrough.dryRun===!0||passthrough.dryRun==="true",actions=isDryRun?[Action.GenerateLibraryEntries,Action.Bump]:[Action.GenerateLibraryEntries,Action.LintFix,Action.Bump],preflight=await runPinnedChecks({cwd:projectPath()});if(preflight.bypassed)log.warn(`${BYPASS_ENV} is set, so the pinned checks were skipped for this release.`);else if(preflight.failures.length>0)await log.exit(formatPreflightFailure(preflight.failures),1);const result=await runActions(actions,{cwd:projectPath(),...passthrough});if(result&&result.isErr)await log.exit(`Release failed: ${result.error?.message??String(result.error)}`,1);log.success(`Successfully released ${app.name}`);
1
+ import{parseOptions}from"@stacksjs/cli";import{app}from"@stacksjs/config";import{Action}from"@stacksjs/enums";import{log}from"@stacksjs/logging";import{projectPath}from"@stacksjs/path";import{runActions}from".";import{BYPASS_ENV,formatPreflightFailure,runPinnedChecks}from"./release-preflight";const raw=parseOptions()??{},passthrough={};for(const[k,v]of Object.entries(raw)){if(k==="--"||k==="_")continue;passthrough[k]=v}const isDryRun=passthrough.dryRun===!0||passthrough.dryRun==="true",actions=isDryRun?[Action.GenerateLibraryEntries,Action.Bump]:[Action.GenerateLibraryEntries,Action.LintFix,Action.Bump],preflight=await runPinnedChecks({cwd:projectPath()});if(preflight.bypassed)log.warn(`${BYPASS_ENV} is set, so the pinned checks were skipped for this release.`);else if(preflight.failures.length>0)await log.exit(formatPreflightFailure(preflight.failures),1);const result=await runActions(actions,{cwd:projectPath(),...passthrough});if(result&&result.isErr)await log.exit(`Release failed: ${result.error?.message??String(result.error)}`,1);log.success(isDryRun?`Dry run complete for ${app.name}. Nothing was committed, tagged or pushed.`:`Successfully released ${app.name}`);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/actions",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.72.6",
5
+ "version": "0.72.7",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -59,36 +59,36 @@
59
59
  "prepublishOnly": "bun run build"
60
60
  },
61
61
  "dependencies": {
62
- "@stacksjs/config": "0.72.6",
62
+ "@stacksjs/config": "0.72.7",
63
63
  "@stacksjs/bumpx": "^0.2.6",
64
64
  "@stacksjs/bunpress": "^0.2.6",
65
65
  "@stacksjs/logsmith": "^0.2.3",
66
- "@stacksjs/registry": "0.72.6",
66
+ "@stacksjs/registry": "0.72.7",
67
67
  "@stacksjs/stx": "^0.2.184",
68
68
  "@stacksjs/ts-cloud": "^0.8.3",
69
69
  "@stacksjs/ts-md": "^0.1.1",
70
70
  "craft-native": ">=0.0.55"
71
71
  },
72
72
  "devDependencies": {
73
- "@stacksjs/api": "0.72.6",
74
- "@stacksjs/cli": "0.72.6",
75
- "@stacksjs/database": "0.72.6",
73
+ "@stacksjs/api": "0.72.7",
74
+ "@stacksjs/cli": "0.72.7",
75
+ "@stacksjs/database": "0.72.7",
76
76
  "@stacksjs/tlsx": "^0.13.2",
77
77
  "better-dx": "^0.2.23",
78
- "@stacksjs/dns": "0.72.6",
79
- "@stacksjs/enums": "0.72.6",
80
- "@stacksjs/env": "0.72.6",
81
- "@stacksjs/error-handling": "0.72.6",
82
- "@stacksjs/image": "0.72.6",
83
- "@stacksjs/logging": "0.72.6",
84
- "@stacksjs/path": "0.72.6",
85
- "@stacksjs/security": "0.72.6",
86
- "@stacksjs/cms": "0.72.6",
87
- "@stacksjs/sites": "0.72.6",
88
- "@stacksjs/storage": "0.72.6",
89
- "@stacksjs/strings": "0.72.6",
90
- "@stacksjs/utils": "0.72.6",
91
- "@stacksjs/validation": "0.72.6"
78
+ "@stacksjs/dns": "0.72.7",
79
+ "@stacksjs/enums": "0.72.7",
80
+ "@stacksjs/env": "0.72.7",
81
+ "@stacksjs/error-handling": "0.72.7",
82
+ "@stacksjs/image": "0.72.7",
83
+ "@stacksjs/logging": "0.72.7",
84
+ "@stacksjs/path": "0.72.7",
85
+ "@stacksjs/security": "0.72.7",
86
+ "@stacksjs/cms": "0.72.7",
87
+ "@stacksjs/sites": "0.72.7",
88
+ "@stacksjs/storage": "0.72.7",
89
+ "@stacksjs/strings": "0.72.7",
90
+ "@stacksjs/utils": "0.72.7",
91
+ "@stacksjs/validation": "0.72.7"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "pickier": "^0.1.35"