@leaflow/sdk 0.0.0-dev.13.g732c6b7 → 0.0.0-dev.132.gf5ad077

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.
Files changed (36) hide show
  1. package/README.md +22 -12
  2. package/dist/account/v1/index.d.ts +14 -2
  3. package/dist/account/v1/schema.d.ts +368 -81
  4. package/dist/assistant/v1/index.d.ts +30 -2
  5. package/dist/assistant/v1/schema.d.ts +1089 -133
  6. package/dist/billing/v1/index.d.ts +192 -0
  7. package/dist/billing/v1/index.js +5 -0
  8. package/dist/billing/v1/schema.d.ts +4640 -0
  9. package/dist/billing/v1/schema.js +5 -0
  10. package/dist/canopy/v1/schema.d.ts +113 -109
  11. package/dist/compute/v1/index.d.ts +30 -6
  12. package/dist/compute/v1/schema.d.ts +1202 -273
  13. package/dist/dns/v1/index.d.ts +42 -0
  14. package/dist/dns/v1/index.js +5 -0
  15. package/dist/dns/v1/schema.d.ts +887 -0
  16. package/dist/dns/v1/schema.js +5 -0
  17. package/dist/fleet/v1/index.d.ts +6 -0
  18. package/dist/fleet/v1/index.js +5 -0
  19. package/dist/fleet/v1/schema.d.ts +156 -0
  20. package/dist/fleet/v1/schema.js +5 -0
  21. package/dist/iam/v1/index.d.ts +26 -4
  22. package/dist/iam/v1/schema.d.ts +515 -88
  23. package/dist/index.d.ts +5 -0
  24. package/dist/monitoring/v1/index.d.ts +84 -4
  25. package/dist/monitoring/v1/schema.d.ts +2420 -527
  26. package/dist/notification/v1/index.d.ts +76 -0
  27. package/dist/notification/v1/index.js +5 -0
  28. package/dist/notification/v1/schema.d.ts +2048 -0
  29. package/dist/notification/v1/schema.js +5 -0
  30. package/dist/support/v1/index.d.ts +50 -0
  31. package/dist/support/v1/index.js +5 -0
  32. package/dist/support/v1/schema.d.ts +1082 -0
  33. package/dist/support/v1/schema.js +5 -0
  34. package/dist/tunnel/v1/index.d.ts +14 -36
  35. package/dist/tunnel/v1/schema.d.ts +70 -510
  36. package/package.json +2 -2
package/README.md CHANGED
@@ -1,24 +1,34 @@
1
1
  # leaflow-ts
2
2
 
3
- Leaflow 平台的 TypeScript SDK(`@leaflow/sdk`)。
4
- `gen/` 下全是产物,源在 `LeaflowNET/leaflowapis`。
3
+ Leaflow 平台的 TypeScript SDK(`@leaflow/sdk`),由
4
+ [leaflowapis](https://github.com/leaflowapis/leaflowapis) 生成。
5
5
 
6
- ## 为什么和 Go 分开在两个仓库
6
+ ```
7
+ npm i @leaflow/sdk openapi-fetch
8
+ ```
7
9
 
8
- **它们在同一个仓库里会抢同一个 tag 空间。** Go 的子目录模块要 `go/v1.2.3` 这种带前缀的 tag,
9
- npm 要 `v1.2.3`——上一版两者挤在一个仓库里,结果是 Go 那半从来没被正确发布过,而没有任何东西
10
- 会报错(`go get` 只是拿不到)。
10
+ 当前只含类型。请求由 `openapi-fetch` 发出,路径与参数由契约约束。
11
11
 
12
- ## 契约是一个 submodule
12
+ ```ts
13
+ import createClient from 'openapi-fetch';
14
+ import type { compute } from '@leaflow/sdk';
13
15
 
16
+ const api = createClient<compute.paths>({
17
+ baseUrl: 'https://compute.leaflow.cloud',
18
+ headers: { Authorization: `Bearer ${token}` },
19
+ });
20
+
21
+ const { data, error } = await api.GET('/api/v1/instances', {
22
+ params: { query: { limit: 20 } },
23
+ });
14
24
  ```
15
- leaflowapis/ 钉在某一个 commit 上——那个指针就是「这版 SDK 出自哪版契约」的答案
16
- ```
25
+
26
+ 每个操作另有 `<操作>Result` / `<操作>Body` / `<操作>Query` 三个类型别名。
27
+
28
+ ## 重新生成
17
29
 
18
30
  ```
19
- git submodule update --remote leaflowapis # 要跟进新契约时才做
20
31
  npm run generate
21
32
  ```
22
33
 
23
- 产物由人在本地跑完提交,CI 只验证不写回:一个会 commit 回来的流水线,在两次推送挨得近时只能靠
24
- 重试或者强推——前者会打架,后者会丢东西。
34
+ 契约版本记在 `CONTRACTS_REF`。
@@ -1,5 +1,9 @@
1
1
  export type { paths, components, operations, webhooks } from "./schema.js";
2
2
  import type { operations } from "./schema.js";
3
+ /** `GET /account/v1/settings` 成功时的响应体。 */
4
+ export type GetSettingsResult = operations["get-settings"]["responses"][200]["content"]["application/json"];
5
+ /** `GET /account/v1/locales` 成功时的响应体。 */
6
+ export type ListLocalesResult = operations["list-locales"]["responses"][200]["content"]["application/json"];
3
7
  /** `GET /account/v1/agreements` 成功时的响应体。 */
4
8
  export type ListAgreementsResult = operations["list-agreements"]["responses"][200]["content"]["application/json"];
5
9
  /** `GET /account/v1/me/consents` 成功时的响应体。 */
@@ -14,6 +18,10 @@ export type RegisterResult = operations["register"]["responses"][201]["content"]
14
18
  export type RegisterBody = NonNullable<operations["register"]["requestBody"]>["content"]["application/json"];
15
19
  /** `GET /account/v1/me` 成功时的响应体。 */
16
20
  export type GetAccountResult = operations["get-account"]["responses"][200]["content"]["application/json"];
21
+ /** `PATCH /account/v1/me` 成功时的响应体。 */
22
+ export type UpdateAccountResult = operations["update-account"]["responses"][200]["content"]["application/json"];
23
+ /** `PATCH /account/v1/me` 的请求体。 */
24
+ export type UpdateAccountBody = NonNullable<operations["update-account"]["requestBody"]>["content"]["application/json"];
17
25
  /** `GET /account/v1/me/identity-verification` 成功时的响应体。 */
18
26
  export type GetIdentityVerificationResult = operations["get-identity-verification"]["responses"][200]["content"]["application/json"];
19
27
  /** `POST /account/v1/me/identity-verification` 成功时的响应体。 */
@@ -24,6 +32,10 @@ export type SubmitIdentityVerificationBody = NonNullable<operations["submit-iden
24
32
  export type ListMyInvitationsResult = operations["list-my-invitations"]["responses"][200]["content"]["application/json"];
25
33
  /** `GET /account/v1/me/invitations` 的查询参数。 */
26
34
  export type ListMyInvitationsQuery = operations["list-my-invitations"]["parameters"]["query"];
35
+ /** `GET /account/v1/invitations/by-token` 成功时的响应体。 */
36
+ export type PreviewInvitationByTokenResult = operations["preview-invitation-by-token"]["responses"][200]["content"]["application/json"];
37
+ /** `GET /account/v1/invitations/by-token` 的查询参数。 */
38
+ export type PreviewInvitationByTokenQuery = operations["preview-invitation-by-token"]["parameters"]["query"];
27
39
  /** `POST /account/v1/me/invitations/accept` 成功时的响应体。 */
28
40
  export type AcceptInvitationByTokenResult = operations["accept-invitation-by-token"]["responses"][200]["content"]["application/json"];
29
41
  /** `POST /account/v1/me/invitations/accept` 的请求体。 */
@@ -38,5 +50,5 @@ export type ListProjectsQuery = operations["list-projects"]["parameters"]["query
38
50
  export type CreateProjectResult = operations["create-project"]["responses"][201]["content"]["application/json"];
39
51
  /** `POST /account/v1/projects` 的请求体。 */
40
52
  export type CreateProjectBody = NonNullable<operations["create-project"]["requestBody"]>["content"]["application/json"];
41
- /** `POST /account/v1/projects/{projectId}/token` 成功时的响应体。 */
42
- export type ExchangeProjectTokenResult = operations["exchange-project-token"]["responses"][201]["content"]["application/json"];
53
+ /** `POST /account/v1/projects/{projectId}/scoped-tokens` 成功时的响应体。 */
54
+ export type CreateScopedTokenResult = operations["create-scoped-token"]["responses"][201]["content"]["application/json"];