@stacksjs/actions 0.70.368 → 0.70.370
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 +13 -0
- package/dist/action.js +1 -1
- package/package.json +19 -19
package/dist/action.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ export declare interface ValidationResult {
|
|
|
28
28
|
valid: boolean
|
|
29
29
|
errors: Record<string, string[]>
|
|
30
30
|
}
|
|
31
|
+
/** One documented answer: a sentence, and optionally the shape of the body. */
|
|
32
|
+
export declare interface ActionResponse {
|
|
33
|
+
description: string
|
|
34
|
+
schema?: Record<string, unknown>
|
|
35
|
+
}
|
|
31
36
|
declare interface ActionOptions<TModel = string, TValidations extends ActionValidations | undefined = undefined, TPath extends string = '',> {
|
|
32
37
|
name?: string
|
|
33
38
|
description?: string
|
|
@@ -40,6 +45,8 @@ declare interface ActionOptions<TModel = string, TValidations extends ActionVali
|
|
|
40
45
|
enabled?: JobOptions['enabled']
|
|
41
46
|
path?: TPath
|
|
42
47
|
requestFile?: string
|
|
48
|
+
responses?: ActionResponses
|
|
49
|
+
responseHeaders?: Record<string, { description: string, schema?: Record<string, unknown> }>
|
|
43
50
|
model?: TModel
|
|
44
51
|
skipCsrf?: boolean
|
|
45
52
|
csrf?: boolean
|
|
@@ -80,6 +87,8 @@ declare type ResolveBody<TModel, TValidations> = TModel extends { _isStacksModel
|
|
|
80
87
|
declare type InferRequest<TModel, TValidations, TPath extends string> = TPath extends ''
|
|
81
88
|
? RequestInstance<ResolveBody<TModel, TValidations>>
|
|
82
89
|
: RequestInstance<ResolveBody<TModel, TValidations>, ExtractParams<TPath>>;
|
|
90
|
+
/** Documented answers, keyed by status code. */
|
|
91
|
+
export type ActionResponses = Record<string | number, ActionResponse>;
|
|
83
92
|
/**
|
|
84
93
|
* Everything an action's `handle()` is allowed to return. The router's
|
|
85
94
|
* `formatResult()` walks each branch:
|
|
@@ -117,6 +126,8 @@ export declare class Action<TModel = string, TValidations extends ActionValidati
|
|
|
117
126
|
method?: ActionOptions['method'];
|
|
118
127
|
validations?: TValidations;
|
|
119
128
|
requestFile?: string;
|
|
129
|
+
responses?: ActionResponses;
|
|
130
|
+
responseHeaders?: ActionOptions['responseHeaders'];
|
|
120
131
|
skipCsrf?: boolean;
|
|
121
132
|
csrf?: boolean;
|
|
122
133
|
authorize?: ActionOptions<TModel, TValidations, TPath>['authorize'];
|
|
@@ -137,6 +148,8 @@ export declare class Action<TModel = string, TValidations extends ActionValidati
|
|
|
137
148
|
path,
|
|
138
149
|
method,
|
|
139
150
|
requestFile,
|
|
151
|
+
responses,
|
|
152
|
+
responseHeaders,
|
|
140
153
|
model,
|
|
141
154
|
skipCsrf,
|
|
142
155
|
csrf,
|
package/dist/action.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export class Action{name;description;apiResponse;rate;tries;backoff;enabled;path;method;validations;requestFile;skipCsrf;csrf;authorize;before;handle;model;modelDefinition;_dependenciesFactory;_resolvedDeps;_depsOverrides;constructor({name,description,apiResponse,validations,handle,rate,tries,backoff,enabled,path,method,requestFile,model,skipCsrf,csrf,authorize,before,dependencies}){this.name=name;this.description=description;this.apiResponse=apiResponse;this.validations=validations;this.rate=rate;this.tries=tries;this.backoff=backoff;this.enabled=enabled;this.path=path;this.method=method;this.handle=handle;this.requestFile=requestFile;this.skipCsrf=skipCsrf;this.csrf=csrf;this.authorize=authorize;this.before=before;this._dependenciesFactory=dependencies;this.modelDefinition=model;if(model&&typeof model==="object"&&"name"in model)this.model=model.name;else if(typeof model==="string")this.model=model}get deps(){if(!this._resolvedDeps)this._resolvedDeps=this._dependenciesFactory?.()??{};if(this._depsOverrides)return{...this._resolvedDeps,...this._depsOverrides};return this._resolvedDeps}overrideDependencies(overrides){this._depsOverrides={...this._depsOverrides??{},...overrides}}resetDependencies(){this._depsOverrides=void 0;this._resolvedDeps=void 0}}
|
|
1
|
+
export class Action{name;description;apiResponse;rate;tries;backoff;enabled;path;method;validations;requestFile;responses;responseHeaders;skipCsrf;csrf;authorize;before;handle;model;modelDefinition;_dependenciesFactory;_resolvedDeps;_depsOverrides;constructor({name,description,apiResponse,validations,handle,rate,tries,backoff,enabled,path,method,requestFile,responses,responseHeaders,model,skipCsrf,csrf,authorize,before,dependencies}){this.name=name;this.description=description;this.apiResponse=apiResponse;this.validations=validations;this.rate=rate;this.tries=tries;this.backoff=backoff;this.enabled=enabled;this.path=path;this.method=method;this.handle=handle;this.requestFile=requestFile;this.responses=responses;this.responseHeaders=responseHeaders;this.skipCsrf=skipCsrf;this.csrf=csrf;this.authorize=authorize;this.before=before;this._dependenciesFactory=dependencies;this.modelDefinition=model;if(model&&typeof model==="object"&&"name"in model)this.model=model.name;else if(typeof model==="string")this.model=model}get deps(){if(!this._resolvedDeps)this._resolvedDeps=this._dependenciesFactory?.()??{};if(this._depsOverrides)return{...this._resolvedDeps,...this._depsOverrides};return this._resolvedDeps}overrideDependencies(overrides){this._depsOverrides={...this._depsOverrides??{},...overrides}}resetDependencies(){this._depsOverrides=void 0;this._resolvedDeps=void 0}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.370",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -59,34 +59,34 @@
|
|
|
59
59
|
"prepublishOnly": "bun run build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@stacksjs/config": "0.70.
|
|
62
|
+
"@stacksjs/config": "0.70.370",
|
|
63
63
|
"@stacksjs/bumpx": "^0.2.6",
|
|
64
|
-
"@stacksjs/bunpress": "^0.
|
|
64
|
+
"@stacksjs/bunpress": "^0.2.2",
|
|
65
65
|
"@stacksjs/logsmith": "^0.2.3",
|
|
66
|
-
"@stacksjs/registry": "0.70.
|
|
66
|
+
"@stacksjs/registry": "0.70.370",
|
|
67
67
|
"@stacksjs/stx": "^0.2.176",
|
|
68
68
|
"@stacksjs/ts-cloud": "^0.7.103",
|
|
69
69
|
"@stacksjs/ts-md": "^0.1.1",
|
|
70
70
|
"craft-native": ">=0.0.55"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@stacksjs/api": "0.70.
|
|
74
|
-
"@stacksjs/cli": "0.70.
|
|
75
|
-
"@stacksjs/database": "0.70.
|
|
73
|
+
"@stacksjs/api": "0.70.370",
|
|
74
|
+
"@stacksjs/cli": "0.70.370",
|
|
75
|
+
"@stacksjs/database": "0.70.370",
|
|
76
76
|
"@stacksjs/tlsx": "^0.13.2",
|
|
77
77
|
"better-dx": "^0.2.17",
|
|
78
|
-
"@stacksjs/dns": "0.70.
|
|
79
|
-
"@stacksjs/enums": "0.70.
|
|
80
|
-
"@stacksjs/env": "0.70.
|
|
81
|
-
"@stacksjs/error-handling": "0.70.
|
|
82
|
-
"@stacksjs/image": "0.70.
|
|
83
|
-
"@stacksjs/logging": "0.70.
|
|
84
|
-
"@stacksjs/path": "0.70.
|
|
85
|
-
"@stacksjs/security": "0.70.
|
|
86
|
-
"@stacksjs/storage": "0.70.
|
|
87
|
-
"@stacksjs/strings": "0.70.
|
|
88
|
-
"@stacksjs/utils": "0.70.
|
|
89
|
-
"@stacksjs/validation": "0.70.
|
|
78
|
+
"@stacksjs/dns": "0.70.370",
|
|
79
|
+
"@stacksjs/enums": "0.70.370",
|
|
80
|
+
"@stacksjs/env": "0.70.370",
|
|
81
|
+
"@stacksjs/error-handling": "0.70.370",
|
|
82
|
+
"@stacksjs/image": "0.70.370",
|
|
83
|
+
"@stacksjs/logging": "0.70.370",
|
|
84
|
+
"@stacksjs/path": "0.70.370",
|
|
85
|
+
"@stacksjs/security": "0.70.370",
|
|
86
|
+
"@stacksjs/storage": "0.70.370",
|
|
87
|
+
"@stacksjs/strings": "0.70.370",
|
|
88
|
+
"@stacksjs/utils": "0.70.370",
|
|
89
|
+
"@stacksjs/validation": "0.70.370"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"pickier": "^0.1.35"
|