Skip to content

Commit 366aeff

Browse files
committed
feat: add types
0 parents  commit 366aeff

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

.gitignore

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Ignore built ts files
2+
dist/**/*
3+
4+
5+
### Node template
6+
# Logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Dependency directory
19+
node_modules
20+
bower_components
21+
22+
23+
# Editors
24+
.idea
25+
*.iml
26+
27+
28+
# Directory for instrumented libs generated by jscoverage/JSCover
29+
lib-cov
30+
31+
# Coverage directory used by tools like istanbul
32+
coverage
33+
34+
# nyc test coverage
35+
.nyc_output
36+
37+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
38+
.grunt
39+
40+
# Bower dependency directory (https://bower.io/)
41+
bower_components
42+
43+
# node-waf configuration
44+
.lock-wscript
45+
46+
# Compiled binary addons (https://nodejs.org/api/addons.html)
47+
build/Release
48+
49+
# Dependency directories
50+
node_modules/
51+
jspm_packages/
52+
53+
# Typescript v1 declaration files
54+
typings/
55+
56+
# Optional npm cache directory
57+
.npm
58+
59+
# Optional eslint cache
60+
.eslintcache
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
74+
lib/
75+
76+
.DS_Store
77+
temp
78+
__diff_output__

index.d.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { DocumentNode } from 'graphql';
2+
3+
export type GqlRequest = <Result = {}, Variables = {}>(
4+
gqlTag: DocumentNode,
5+
variables?: Variables,
6+
options?: {
7+
checkPermissions?: boolean;
8+
headers?: Record<string, any>;
9+
},
10+
) => Promise<Result>;
11+
12+
export type FunctionContext = {
13+
api: {
14+
gqlRequest: GqlRequest;
15+
};
16+
invokeFunction: <Result = {}, Args = {}>(
17+
name: string,
18+
args?: Args,
19+
options?: { waitForResponse: boolean; checkPermissions?: boolean },
20+
) => Promise<Result>;
21+
};
22+
23+
export type FunctionEvent<Data = {}, OriginalObject = {}, ExtendObject = {}, Error = {}> = {
24+
data: Data;
25+
originalObject: OriginalObject;
26+
errors: Error[];
27+
body?: string;
28+
headers: { [key: string]: string | undefined };
29+
} & ExtendObject;
30+
31+
export type FunctionResult<Data = {}, OriginalObject = {}, ExtendObject = {}, Error = {}> = Promise<
32+
{
33+
data?: Data;
34+
originalObject?: OriginalObject;
35+
errors?: Error[];
36+
body?: string;
37+
} & ExtendObject
38+
>;

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "8base-cli-types",
3+
"version": "0.0.99",
4+
"description": "8base CLI",
5+
"author": "8base",
6+
"license": "MIT",
7+
"types": "index.d.ts"
8+
}

0 commit comments

Comments
 (0)