@sparkrewards/sra-sdk 0.0.1 → 0.0.3
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 +66 -0
- package/dist-cjs/openapi.json +1 -4
- package/dist-es/openapi.json +1 -4
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
## @sparkrewards/app-api-server-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript server-side SDK for the Spark Rewards App API, generated from the Smithy service model.
|
|
4
|
+
It contains:
|
|
5
|
+
|
|
6
|
+
- Strongly typed request/response models for all operations.
|
|
7
|
+
- Operation handlers and service interfaces to implement the API.
|
|
8
|
+
- A generated OpenAPI JSON export (`OpenApiJSON`) that can be used with tooling like CDK.
|
|
9
|
+
|
|
10
|
+
### Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @sparkrewards/app-api-server-sdk
|
|
14
|
+
# or
|
|
15
|
+
yarn add @sparkrewards/app-api-server-sdk
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Basic usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import {
|
|
22
|
+
AppAPIService,
|
|
23
|
+
getAppAPIServiceHandler,
|
|
24
|
+
} from "@sparkrewards/app-api-server-sdk";
|
|
25
|
+
|
|
26
|
+
const service: AppAPIService<unknown> = {
|
|
27
|
+
async GetUser(input, ctx) {
|
|
28
|
+
// implement your business logic here
|
|
29
|
+
return {
|
|
30
|
+
message: "ok",
|
|
31
|
+
user: {
|
|
32
|
+
// ... user fields ...
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
// implement other operations...
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const handler = getAppAPIServiceHandler(service);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### OpenAPI export
|
|
43
|
+
|
|
44
|
+
The server SDK also exports the OpenAPI specification for the App API:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { OpenApiJSON } from "@sparkrewards/app-api-server-sdk";
|
|
48
|
+
|
|
49
|
+
console.log(OpenApiJSON.openapi); // "3.1.0"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This is used by the CDK stack to configure API Gateway.
|
|
53
|
+
|
|
54
|
+
### Regenerating from the Smithy model
|
|
55
|
+
|
|
56
|
+
This package is generated by the `typescript-ssdk-codegen` Smithy plugin. To regenerate it:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
./gradlew :smithy:smithyBuild
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The generated package lives under:
|
|
63
|
+
|
|
64
|
+
- `smithy/build/smithyprojections/smithy/source/typescript-ssdk-codegen`
|
|
65
|
+
|
|
66
|
+
|
package/dist-cjs/openapi.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"openapi": "3.
|
|
2
|
+
"openapi": "3.0.2",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Spark Rewards App API Structure",
|
|
5
5
|
"version": "2025-10-29",
|
|
@@ -2696,9 +2696,6 @@
|
|
|
2696
2696
|
"type": "object",
|
|
2697
2697
|
"additionalProperties": {
|
|
2698
2698
|
"$ref": "#/components/schemas/Tier"
|
|
2699
|
-
},
|
|
2700
|
-
"propertyNames": {
|
|
2701
|
-
"type": "string"
|
|
2702
2699
|
}
|
|
2703
2700
|
},
|
|
2704
2701
|
"UpdateUserRequestContent": {
|
package/dist-es/openapi.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"openapi": "3.
|
|
2
|
+
"openapi": "3.0.2",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Spark Rewards App API Structure",
|
|
5
5
|
"version": "2025-10-29",
|
|
@@ -2696,9 +2696,6 @@
|
|
|
2696
2696
|
"type": "object",
|
|
2697
2697
|
"additionalProperties": {
|
|
2698
2698
|
"$ref": "#/components/schemas/Tier"
|
|
2699
|
-
},
|
|
2700
|
-
"propertyNames": {
|
|
2701
|
-
"type": "string"
|
|
2702
2699
|
}
|
|
2703
2700
|
},
|
|
2704
2701
|
"UpdateUserRequestContent": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkrewards/sra-sdk",
|
|
3
3
|
"description": "@sparkrewards/sra-sdk server",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
7
7
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|