@gol/sdk 0.1.0-next.0
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 +70 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +19 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/platform.d.ts +2137 -0
- package/dist/generated/platform.d.ts.map +1 -0
- package/dist/generated/platform.js +9 -0
- package/dist/generated/platform.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +164 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# GOL SDK
|
|
2
|
+
|
|
3
|
+
Public TypeScript interfaces for GOL Network.
|
|
4
|
+
|
|
5
|
+
This first package covers developer onboarding and API credential verification through the public GOL Platform API. Mandates, payment actions, receipts, and webhooks are intentionally not exposed until their contract and platform interfaces exist.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
The package is not published yet. After a release is available:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @gol/sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use Node.js 22 or later. The root entry point exports browser-safe types and errors. API clients that accept session tokens or API keys are available only from `@gol/sdk/server`.
|
|
16
|
+
|
|
17
|
+
## API key authentication
|
|
18
|
+
|
|
19
|
+
Send a project API key in the bearer authorization header. Keep the value in a server-side environment variable and never commit it or place it in browser code.
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
curl "https://api.gol.network/v1/whoami" \
|
|
23
|
+
--header "Accept: application/json" \
|
|
24
|
+
--header "Authorization: Bearer $GOL_API_KEY"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The server client applies the same header:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { GolApiClient } from "@gol/sdk/server";
|
|
31
|
+
|
|
32
|
+
const gol = new GolApiClient({
|
|
33
|
+
baseUrl: "https://api.gol.network",
|
|
34
|
+
apiKey: process.env.GOL_API_KEY!,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const identity = await gol.whoami();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Console management operations use a developer session token instead:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { GolManagementClient } from "@gol/sdk/server";
|
|
44
|
+
|
|
45
|
+
const gol = new GolManagementClient({
|
|
46
|
+
baseUrl: "https://api.gol.network",
|
|
47
|
+
sessionToken: "replace-with-a-server-side-session-token",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const projects = await gol.listProjects();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Development
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm install --frozen-lockfile
|
|
57
|
+
pnpm sync:openapi
|
|
58
|
+
pnpm generate:check
|
|
59
|
+
pnpm upstream:check
|
|
60
|
+
pnpm typecheck
|
|
61
|
+
pnpm lint
|
|
62
|
+
pnpm test
|
|
63
|
+
pnpm build
|
|
64
|
+
pnpm verify:pack
|
|
65
|
+
pnpm format:check
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`openapi/platform.json` is a versioned snapshot of the platform contract. `pnpm sync:openapi` refreshes the snapshot from `../platform/openapi/openapi.json` by default and regenerates TypeScript declarations. Set `GOL_PLATFORM_OPENAPI_PATH` when the platform repository is elsewhere.
|
|
69
|
+
|
|
70
|
+
`pnpm verify:pack` builds and packs the SDK, installs the archive into a temporary clean consumer, checks both package entry points, runs the compiled consumer, and deletes the temporary files. It does not publish the package.
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class GolApiError extends Error {
|
|
2
|
+
readonly status: number;
|
|
3
|
+
readonly code: string;
|
|
4
|
+
readonly correlationId: string | null;
|
|
5
|
+
constructor(status: number, code: string, message: string, correlationId: string | null);
|
|
6
|
+
}
|
|
7
|
+
export declare class GolTransportError extends Error {
|
|
8
|
+
constructor(message: string, options?: ErrorOptions);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;IAElC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;gBAH5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,aAAa,EAAE,MAAM,GAAG,IAAI;CAKxC;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class GolApiError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
code;
|
|
4
|
+
correlationId;
|
|
5
|
+
constructor(status, code, message, correlationId) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.correlationId = correlationId;
|
|
10
|
+
this.name = "GolApiError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export class GolTransportError extends Error {
|
|
14
|
+
constructor(message, options) {
|
|
15
|
+
super(message, options);
|
|
16
|
+
this.name = "GolTransportError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAY,SAAQ,KAAK;IAEzB;IACA;IAEA;IAJX,YACW,MAAc,EACd,IAAY,EACrB,OAAe,EACN,aAA4B;QAErC,KAAK,CAAC,OAAO,CAAC,CAAC;QALN,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,kBAAa,GAAb,aAAa,CAAe;QAGrC,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe,EAAE,OAAsB;QACjD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF"}
|