@cogover/sdk 0.1.1 → 0.1.2
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/README.md +16 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# `@cogover/sdk`
|
|
2
2
|
|
|
3
|
-
TypeScript SDK
|
|
4
|
-
|
|
3
|
+
The TypeScript SDK for customer code running on Cogover. The package includes
|
|
4
|
+
type declarations for IDE autocomplete, inline documentation, and type checking.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Requirements
|
|
7
7
|
|
|
8
|
-
- Node.js 18
|
|
9
|
-
-
|
|
8
|
+
- Node.js 18 or later.
|
|
9
|
+
- A TypeScript project using ECMAScript Modules (ESM).
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Installation
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npm install @cogover/sdk
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Quick start
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
20
|
import { createGreeting } from "@cogover/sdk";
|
|
@@ -23,9 +23,9 @@ const greeting = createGreeting("Cogover");
|
|
|
23
23
|
console.log(greeting); // Hello Cogover
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
SDK
|
|
26
|
+
The SDK uses named exports and currently has no default export.
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Use in a Cogover handler
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
31
|
import { createGreeting } from "@cogover/sdk";
|
|
@@ -43,20 +43,20 @@ export default function handler(inputJson: string): string {
|
|
|
43
43
|
}
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
A handler must default-export a synchronous function that accepts
|
|
47
|
+
`inputJson: string` and returns a JSON string or `null`.
|
|
48
48
|
|
|
49
49
|
## API
|
|
50
50
|
|
|
51
51
|
### `createGreeting(name)`
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
Creates a greeting by adding the `Hello ` prefix to a name.
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
56
|
function createGreeting(name: string): string;
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Example:
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
62
|
createGreeting("Cogover"); // "Hello Cogover"
|
|
@@ -64,10 +64,10 @@ createGreeting("Cogover"); // "Hello Cogover"
|
|
|
64
64
|
|
|
65
65
|
## TypeScript
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
resolve
|
|
67
|
+
Type declarations are included in the package. After installation, IDEs can
|
|
68
|
+
resolve `@cogover/sdk` without a separate type package.
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Recommended `tsconfig.json` options:
|
|
71
71
|
|
|
72
72
|
```json
|
|
73
73
|
{
|