Skip to content

Commit 4ef5559

Browse files
committed
Fix ci/cd publish and before delete trigger types
1 parent a1d3d66 commit 4ef5559

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
node-version: 16
2626
cache: npm
2727
cache-dependency-path: package-lock.json
28+
registry-url: https://registry.npmjs.org
2829

2930
- name: Install dependencies
3031
run: npm ci

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@8base/functions-types",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Types for 8base Custom Functions",
55
"author": "8base",
66
"license": "MIT",

src/index.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,14 @@ export type FunctionResponseObject<DataT = AnyObject, ErrorT = AnyObject> = {
5252
errors?: ErrorT[];
5353
};
5454

55-
export type FunctionResponseObjectWithoutErrors<DataT = AnyObject> = {
55+
export type FunctionDataResponseObject<DataT = AnyObject> = {
5656
data: DataT;
5757
};
5858

59+
export type FunctionErrorResponseObject<ErrorT = AnyObject> = {
60+
errors: ErrorT[];
61+
};
62+
5963
export type ResolverFunctionEvent<DataT = AnyObject> = {
6064
data: DataT;
6165
headers: StringMap;
@@ -117,7 +121,7 @@ export type BeforeDeleteTriggerFunctionEvent<
117121
export type BeforeDeleteTriggerResponse<
118122
DataT = AnyObject,
119123
ErrorT = AnyObject
120-
> = Promise<FunctionResponseObject<DataT, ErrorT> | void>;
124+
> = Promise<FunctionErrorResponseObject<ErrorT> | void>;
121125

122126
export type AfterCreateTriggerFunctionEvent<
123127
DataT = AnyObject,
@@ -130,7 +134,7 @@ export type AfterCreateTriggerFunctionEvent<
130134
} & ExtendObjectT;
131135

132136
export type AfterCreateTriggerResponse<DataT = AnyObject> =
133-
Promise<FunctionResponseObjectWithoutErrors<DataT> | void>;
137+
Promise<FunctionDataResponseObject<DataT> | void>;
134138

135139
export type AfterUpdateTriggerFunctionEvent<
136140
DataT = AnyObject,
@@ -145,7 +149,7 @@ export type AfterUpdateTriggerFunctionEvent<
145149
} & ExtendObjectT;
146150

147151
export type AfterUpdateTriggerResponse<DataT = AnyObject> =
148-
Promise<FunctionResponseObjectWithoutErrors<DataT> | void>;
152+
Promise<FunctionDataResponseObject<DataT> | void>;
149153

150154
export type AfterDeleteTriggerFunctionEvent<
151155
DataT = AnyObject,
@@ -210,12 +214,11 @@ export type BeforeUpdateTriggerFunction<
210214

211215
export type BeforeDeleteTriggerFunction<
212216
EventOriginalObject = AnyObject,
213-
ResultData = AnyObject,
214217
ResultError = AnyObject
215218
> = (
216219
event: BeforeDeleteTriggerFunctionEvent<EventOriginalObject>,
217220
ctx: FunctionContext
218-
) => BeforeDeleteTriggerResponse<ResultData, ResultError>;
221+
) => BeforeDeleteTriggerResponse<ResultError>;
219222

220223
export type AfterCreateTriggerFunction<
221224
EventData = AnyObject,

0 commit comments

Comments
 (0)