@distilled.cloud/stackit 1.0.0-rc.14 → 1.0.0-rc.16
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/lib/credentials.d.ts +2 -2
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +32 -28
- package/lib/credentials.js.map +1 -1
- package/lib/errors.d.ts +13 -13
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +16 -16
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +22 -22
- package/lib/pagination.d.ts +1 -1
- package/lib/pagination.js +15 -15
- package/lib/protocol.d.ts +3 -3
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +31 -29
- package/lib/protocol.js.map +1 -1
- package/lib/retry.d.ts +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +24 -23
- package/lib/retry.js.map +1 -1
- package/lib/services/alb.d.ts +10 -87
- package/lib/services/alb.d.ts.map +1 -1
- package/lib/services/alb.js +73 -502
- package/lib/services/alb_waf.d.ts +9 -82
- package/lib/services/alb_waf.d.ts.map +1 -1
- package/lib/services/alb_waf.js +84 -510
- package/lib/services/authorization.d.ts +5 -47
- package/lib/services/authorization.d.ts.map +1 -1
- package/lib/services/authorization.js +67 -314
- package/lib/services/automation.d.ts +7 -47
- package/lib/services/automation.d.ts.map +1 -1
- package/lib/services/automation.js +58 -353
- package/lib/services/cdn.d.ts +8 -220
- package/lib/services/cdn.d.ts.map +1 -1
- package/lib/services/cdn.js +81 -896
- package/lib/services/certificates.d.ts +8 -27
- package/lib/services/certificates.d.ts.map +1 -1
- package/lib/services/certificates.js +45 -171
- package/lib/services/cost.d.ts +10 -37
- package/lib/services/cost.d.ts.map +1 -1
- package/lib/services/cost.js +39 -169
- package/lib/services/dns.d.ts +9 -104
- package/lib/services/dns.d.ts.map +1 -1
- package/lib/services/dns.js +98 -714
- package/lib/services/dremio.d.ts +8 -50
- package/lib/services/dremio.d.ts.map +1 -1
- package/lib/services/dremio.js +56 -307
- package/lib/services/edge.d.ts +7 -40
- package/lib/services/edge.d.ts.map +1 -1
- package/lib/services/edge.js +66 -347
- package/lib/services/functions.d.ts +1 -48
- package/lib/services/functions.d.ts.map +1 -1
- package/lib/services/functions.js +64 -393
- package/lib/services/git.d.ts +8 -61
- package/lib/services/git.d.ts.map +1 -1
- package/lib/services/git.js +87 -510
- package/lib/services/iaas.d.ts +9 -337
- package/lib/services/iaas.d.ts.map +1 -1
- package/lib/services/iaas.js +409 -3532
- package/lib/services/intake.d.ts +8 -75
- package/lib/services/intake.d.ts.map +1 -1
- package/lib/services/intake.js +74 -465
- package/lib/services/kms.d.ts +9 -92
- package/lib/services/kms.d.ts.map +1 -1
- package/lib/services/kms.js +95 -650
- package/lib/services/lb_ip_lists.d.ts +9 -25
- package/lib/services/lb_ip_lists.d.ts.map +1 -1
- package/lib/services/lb_ip_lists.js +45 -146
- package/lib/services/load_balancer.d.ts +10 -81
- package/lib/services/load_balancer.d.ts.map +1 -1
- package/lib/services/load_balancer.js +76 -486
- package/lib/services/logme.d.ts +8 -69
- package/lib/services/logme.d.ts.map +1 -1
- package/lib/services/logme.js +82 -564
- package/lib/services/logs.d.ts +8 -64
- package/lib/services/logs.d.ts.map +1 -1
- package/lib/services/logs.js +84 -465
- package/lib/services/mariadb.d.ts +8 -65
- package/lib/services/mariadb.d.ts.map +1 -1
- package/lib/services/mariadb.js +84 -541
- package/lib/services/model_experiments.d.ts +9 -48
- package/lib/services/model_experiments.d.ts.map +1 -1
- package/lib/services/model_experiments.js +66 -325
- package/lib/services/model_serving.d.ts +7 -47
- package/lib/services/model_serving.d.ts.map +1 -1
- package/lib/services/model_serving.js +55 -277
- package/lib/services/mongodb_flex.d.ts +8 -137
- package/lib/services/mongodb_flex.d.ts.map +1 -1
- package/lib/services/mongodb_flex.js +102 -793
- package/lib/services/object_storage.d.ts +12 -59
- package/lib/services/object_storage.d.ts.map +1 -1
- package/lib/services/object_storage.js +93 -528
- package/lib/services/observability.d.ts +8 -407
- package/lib/services/observability.d.ts.map +1 -1
- package/lib/services/observability.js +375 -3148
- package/lib/services/opensearch.d.ts +8 -71
- package/lib/services/opensearch.d.ts.map +1 -1
- package/lib/services/opensearch.js +85 -553
- package/lib/services/pim.d.ts +12 -108
- package/lib/services/pim.d.ts.map +1 -1
- package/lib/services/pim.js +81 -726
- package/lib/services/postgres_flex.d.ts +14 -136
- package/lib/services/postgres_flex.d.ts.map +1 -1
- package/lib/services/postgres_flex.js +114 -841
- package/lib/services/pubsub.d.ts +11 -73
- package/lib/services/pubsub.d.ts.map +1 -1
- package/lib/services/pubsub.js +92 -507
- package/lib/services/rabbitmq.d.ts +8 -76
- package/lib/services/rabbitmq.d.ts.map +1 -1
- package/lib/services/rabbitmq.js +88 -564
- package/lib/services/registry.d.ts +10 -28
- package/lib/services/registry.d.ts.map +1 -1
- package/lib/services/registry.js +49 -189
- package/lib/services/resource_manager.d.ts +9 -61
- package/lib/services/resource_manager.d.ts.map +1 -1
- package/lib/services/resource_manager.js +92 -462
- package/lib/services/run_command.d.ts +5 -28
- package/lib/services/run_command.d.ts.map +1 -1
- package/lib/services/run_command.js +38 -176
- package/lib/services/sca.d.ts +8 -79
- package/lib/services/sca.d.ts.map +1 -1
- package/lib/services/sca.js +63 -435
- package/lib/services/scf.d.ts +8 -64
- package/lib/services/scf.d.ts.map +1 -1
- package/lib/services/scf.js +99 -660
- package/lib/services/secrets_manager.d.ts +8 -61
- package/lib/services/secrets_manager.d.ts.map +1 -1
- package/lib/services/secrets_manager.js +99 -601
- package/lib/services/server_backup.d.ts +7 -50
- package/lib/services/server_backup.d.ts.map +1 -1
- package/lib/services/server_backup.js +70 -444
- package/lib/services/server_update.d.ts +7 -35
- package/lib/services/server_update.d.ts.map +1 -1
- package/lib/services/server_update.js +58 -342
- package/lib/services/service_account.d.ts +10 -68
- package/lib/services/service_account.d.ts.map +1 -1
- package/lib/services/service_account.js +75 -495
- package/lib/services/service_enablement.d.ts +7 -29
- package/lib/services/service_enablement.d.ts.map +1 -1
- package/lib/services/service_enablement.js +40 -147
- package/lib/services/sfs.d.ts +4 -96
- package/lib/services/sfs.d.ts.map +1 -1
- package/lib/services/sfs.js +117 -782
- package/lib/services/ske.d.ts +9 -108
- package/lib/services/ske.d.ts.map +1 -1
- package/lib/services/ske.js +67 -549
- package/lib/services/sqlserverflex.d.ts +11 -152
- package/lib/services/sqlserverflex.d.ts.map +1 -1
- package/lib/services/sqlserverflex.js +112 -925
- package/lib/services/stackit_marketplace.d.ts +9 -38
- package/lib/services/stackit_marketplace.d.ts.map +1 -1
- package/lib/services/stackit_marketplace.js +64 -369
- package/lib/services/telemetry_link.d.ts +8 -61
- package/lib/services/telemetry_link.d.ts.map +1 -1
- package/lib/services/telemetry_link.js +81 -522
- package/lib/services/telemetry_router.d.ts +8 -72
- package/lib/services/telemetry_router.d.ts.map +1 -1
- package/lib/services/telemetry_router.js +73 -474
- package/lib/services/ufw.d.ts +7 -42
- package/lib/services/ufw.d.ts.map +1 -1
- package/lib/services/ufw.js +55 -269
- package/lib/services/valkey.d.ts +8 -68
- package/lib/services/valkey.d.ts.map +1 -1
- package/lib/services/valkey.js +85 -557
- package/lib/services/vpn.d.ts +21 -186
- package/lib/services/vpn.d.ts.map +1 -1
- package/lib/services/vpn.js +105 -920
- package/lib/services/workflows.d.ts +15 -84
- package/lib/services/workflows.d.ts.map +1 -1
- package/lib/services/workflows.js +67 -497
- package/lib/traits.d.ts +1 -1
- package/lib/traits.js +10 -10
- package/package.json +13 -9
- package/src/credentials.ts +21 -18
- package/src/errors.ts +10 -14
- package/src/index.ts +2 -2
- package/src/pagination.ts +2 -2
- package/src/protocol.ts +12 -9
- package/src/retry.ts +6 -4
- package/src/services/alb.ts +599 -655
- package/src/services/alb_waf.ts +597 -637
- package/src/services/authorization.ts +400 -383
- package/src/services/automation.ts +422 -405
- package/src/services/cdn.ts +817 -1375
- package/src/services/certificates.ts +209 -190
- package/src/services/cost.ts +100 -207
- package/src/services/dns.ts +793 -833
- package/src/services/dremio.ts +356 -349
- package/src/services/edge.ts +406 -366
- package/src/services/functions.ts +465 -463
- package/src/services/git.ts +602 -547
- package/src/services/iaas.ts +3931 -3821
- package/src/services/intake.ts +521 -549
- package/src/services/kms.ts +715 -692
- package/src/services/lb_ip_lists.ts +173 -152
- package/src/services/load_balancer.ts +576 -619
- package/src/services/logme.ts +696 -641
- package/src/services/logs.ts +510 -493
- package/src/services/mariadb.ts +671 -604
- package/src/services/model_experiments.ts +343 -356
- package/src/services/model_serving.ts +337 -328
- package/src/services/mongodb_flex.ts +955 -1007
- package/src/services/object_storage.ts +614 -557
- package/src/services/observability.ts +3469 -3866
- package/src/services/opensearch.ts +679 -628
- package/src/services/pim.ts +672 -909
- package/src/services/postgres_flex.ts +966 -986
- package/src/services/pubsub.ts +524 -546
- package/src/services/rabbitmq.ts +693 -654
- package/src/services/registry.ts +227 -194
- package/src/services/resource_manager.ts +520 -517
- package/src/services/run_command.ts +219 -211
- package/src/services/sca.ts +543 -570
- package/src/services/scf.ts +790 -716
- package/src/services/secrets_manager.ts +707 -622
- package/src/services/server_backup.ts +490 -475
- package/src/services/server_update.ts +353 -356
- package/src/services/service_account.ts +515 -553
- package/src/services/service_enablement.ts +162 -166
- package/src/services/sfs.ts +879 -958
- package/src/services/ske.ts +694 -769
- package/src/services/sqlserverflex.ts +1042 -1117
- package/src/services/stackit_marketplace.ts +377 -372
- package/src/services/telemetry_link.ts +530 -531
- package/src/services/telemetry_router.ts +509 -534
- package/src/services/ufw.ts +305 -307
- package/src/services/valkey.ts +684 -629
- package/src/services/vpn.ts +935 -1195
- package/src/services/workflows.ts +426 -586
- package/src/traits.ts +1 -1
- package/lib/protocol.test.d.ts +0 -2
- package/lib/protocol.test.d.ts.map +0 -1
- package/lib/protocol.test.js +0 -181
- package/lib/protocol.test.js.map +0 -1
- package/lib/services/alb.js.map +0 -1
- package/lib/services/alb_waf.js.map +0 -1
- package/lib/services/authorization.js.map +0 -1
- package/lib/services/automation.js.map +0 -1
- package/lib/services/cdn.js.map +0 -1
- package/lib/services/certificates.js.map +0 -1
- package/lib/services/cost.js.map +0 -1
- package/lib/services/dns.js.map +0 -1
- package/lib/services/dremio.js.map +0 -1
- package/lib/services/edge.js.map +0 -1
- package/lib/services/functions.js.map +0 -1
- package/lib/services/git.js.map +0 -1
- package/lib/services/iaas.js.map +0 -1
- package/lib/services/intake.js.map +0 -1
- package/lib/services/kms.js.map +0 -1
- package/lib/services/lb_ip_lists.js.map +0 -1
- package/lib/services/load_balancer.js.map +0 -1
- package/lib/services/logme.js.map +0 -1
- package/lib/services/logs.js.map +0 -1
- package/lib/services/mariadb.js.map +0 -1
- package/lib/services/model_experiments.js.map +0 -1
- package/lib/services/model_serving.js.map +0 -1
- package/lib/services/mongodb_flex.js.map +0 -1
- package/lib/services/object_storage.js.map +0 -1
- package/lib/services/observability.js.map +0 -1
- package/lib/services/opensearch.js.map +0 -1
- package/lib/services/pim.js.map +0 -1
- package/lib/services/postgres_flex.js.map +0 -1
- package/lib/services/pubsub.js.map +0 -1
- package/lib/services/rabbitmq.js.map +0 -1
- package/lib/services/registry.js.map +0 -1
- package/lib/services/resource_manager.js.map +0 -1
- package/lib/services/run_command.js.map +0 -1
- package/lib/services/sca.js.map +0 -1
- package/lib/services/scf.js.map +0 -1
- package/lib/services/secrets_manager.js.map +0 -1
- package/lib/services/server_backup.js.map +0 -1
- package/lib/services/server_update.js.map +0 -1
- package/lib/services/service_account.js.map +0 -1
- package/lib/services/service_enablement.js.map +0 -1
- package/lib/services/sfs.js.map +0 -1
- package/lib/services/ske.js.map +0 -1
- package/lib/services/sqlserverflex.js.map +0 -1
- package/lib/services/stackit_marketplace.js.map +0 -1
- package/lib/services/telemetry_link.js.map +0 -1
- package/lib/services/telemetry_router.js.map +0 -1
- package/lib/services/ufw.js.map +0 -1
- package/lib/services/valkey.js.map +0 -1
- package/lib/services/vpn.js.map +0 -1
- package/lib/services/workflows.js.map +0 -1
- package/src/protocol.test.ts +0 -304
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/stackit",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"types": "./lib/index.d.ts",
|
|
20
20
|
"bun": "./src/index.ts",
|
|
21
21
|
"worker": "./src/index.ts",
|
|
22
|
-
"
|
|
22
|
+
"module": "./lib/index.full.js",
|
|
23
|
+
"module-sync": "./lib/index.js",
|
|
24
|
+
"default": "./lib/index.full.js"
|
|
23
25
|
},
|
|
24
26
|
"./Credentials": {
|
|
25
27
|
"types": "./lib/credentials.d.ts",
|
|
@@ -61,27 +63,29 @@
|
|
|
61
63
|
"types": "./lib/services/*.d.ts",
|
|
62
64
|
"bun": "./src/services/*.ts",
|
|
63
65
|
"worker": "./src/services/*.ts",
|
|
64
|
-
"
|
|
66
|
+
"module": "./lib/services.full/*.js",
|
|
67
|
+
"module-sync": "./lib/services/*.js",
|
|
68
|
+
"default": "./lib/services.full/*.js"
|
|
65
69
|
}
|
|
66
70
|
},
|
|
67
71
|
"dependencies": {
|
|
68
|
-
"@distilled.cloud/core": "1.0.0-rc.
|
|
72
|
+
"@distilled.cloud/core": "1.0.0-rc.16"
|
|
69
73
|
},
|
|
70
74
|
"devDependencies": {
|
|
71
|
-
"@types/node": "26.
|
|
75
|
+
"@types/node": "26.6.5"
|
|
72
76
|
},
|
|
73
77
|
"peerDependencies": {
|
|
74
|
-
"effect": "^4.0.
|
|
78
|
+
"effect": "^4.0.5"
|
|
75
79
|
},
|
|
76
80
|
"distilled": {
|
|
77
|
-
"generatedAt": "2026-10-
|
|
81
|
+
"generatedAt": "2026-10-09",
|
|
78
82
|
"specUpdatedAt": "2026-10-03"
|
|
79
83
|
},
|
|
80
84
|
"scripts": {
|
|
81
|
-
"build": "
|
|
85
|
+
"build": "tsrs -b",
|
|
82
86
|
"convert": "node --conditions=bun scripts/convert.ts",
|
|
83
87
|
"generate": "node --conditions=bun scripts/generate.ts",
|
|
84
|
-
"typecheck": "
|
|
88
|
+
"typecheck": "tsrs -p tsconfig.json",
|
|
85
89
|
"specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-stackit",
|
|
86
90
|
"specs:update": "git submodule update --remote --force --depth=1 specs/spec-mirror-stackit"
|
|
87
91
|
}
|
package/src/credentials.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
2
1
|
/**
|
|
3
|
-
* STACKIT credentials
|
|
2
|
+
* STACKIT credentials -- hand-written.
|
|
4
3
|
*
|
|
5
4
|
* The `Credentials` service resolves `{ token, region }` per request; the
|
|
6
5
|
* protocol layer formats the `Authorization: Bearer <token>` header from it
|
|
7
6
|
* and rewrites each operation's spec `servers` URL for the region. The token
|
|
8
|
-
* is a STACKIT service-account access token
|
|
7
|
+
* is a STACKIT service-account access token -- the same value the official
|
|
9
8
|
* Go SDK, CLI and Terraform provider read from
|
|
10
9
|
* `STACKIT_SERVICE_ACCOUNT_TOKEN`. Key-file exchange
|
|
11
10
|
* (`STACKIT_SERVICE_ACCOUNT_KEY_PATH`) is not modelled: mint the token
|
|
12
11
|
* outside the SDK.
|
|
13
12
|
*
|
|
14
13
|
* Each STACKIT product has its own host (`iaas.api.eu01.stackit.cloud`,
|
|
15
|
-
* `ske.api.eu01.stackit.cloud`,
|
|
14
|
+
* `ske.api.eu01.stackit.cloud`, ...). The per-operation host is baked into
|
|
16
15
|
* the generated `T.Http` trait from the OpenAPI `servers` entry; `region`
|
|
17
16
|
* (default `eu01`) is substituted at request time. An explicit `apiBaseUrl`
|
|
18
|
-
* overrides that host for every call
|
|
17
|
+
* overrides that host for every call -- a proxy, not a per-product map.
|
|
19
18
|
*/
|
|
20
|
-
import * as EffectConfig from "
|
|
19
|
+
import * as EffectConfig from "@distilled.cloud/core/config";
|
|
20
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
21
21
|
import * as Context from "effect/Context";
|
|
22
22
|
import * as Effect from "effect/Effect";
|
|
23
23
|
import * as Layer from "effect/Layer";
|
|
@@ -29,7 +29,7 @@ export const DEFAULT_REGION = "eu01";
|
|
|
29
29
|
export interface Config {
|
|
30
30
|
readonly token: Redacted.Redacted<string>;
|
|
31
31
|
/**
|
|
32
|
-
* Region inserted into product hosts (`eu01`
|
|
32
|
+
* Region inserted into product hosts (`eu01` ->
|
|
33
33
|
* `https://iaas.api.eu01.stackit.cloud`). `"global"` leaves the spec URL
|
|
34
34
|
* unchanged.
|
|
35
35
|
*/
|
|
@@ -38,28 +38,31 @@ export interface Config {
|
|
|
38
38
|
readonly apiBaseUrl?: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export class Credentials
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
export class Credentials
|
|
42
|
+
extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config>>()(
|
|
43
|
+
"StackitCredentials",
|
|
44
|
+
) {}
|
|
44
45
|
|
|
45
|
-
const envConfig = EffectConfig.all({
|
|
46
|
+
const envConfig = /*@__PURE__*/ EffectConfig.all({
|
|
46
47
|
// `STACKIT_SERVICE_ACCOUNT_TOKEN` / `STACKIT_REGION` are what the
|
|
47
48
|
// official Go SDK, CLI and Terraform provider read.
|
|
48
|
-
token: EffectConfig.String("STACKIT_SERVICE_ACCOUNT_TOKEN"),
|
|
49
|
-
region: EffectConfig.String("STACKIT_REGION").pipe(
|
|
50
|
-
|
|
49
|
+
token: /*@__PURE__*/ EffectConfig.String("STACKIT_SERVICE_ACCOUNT_TOKEN"),
|
|
50
|
+
region: /*@__PURE__*/ EffectConfig.String("STACKIT_REGION").pipe(
|
|
51
|
+
/*@__PURE__*/ EffectConfig.withDefault(DEFAULT_REGION),
|
|
52
|
+
),
|
|
53
|
+
apiBaseUrl: /*@__PURE__*/ EffectConfig.String("STACKIT_API_BASE_URL").pipe(EffectConfig.option),
|
|
51
54
|
});
|
|
52
55
|
|
|
53
|
-
export const CredentialsFromEnv = Layer.succeed(
|
|
56
|
+
export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(
|
|
54
57
|
Credentials,
|
|
55
|
-
envConfig.pipe(
|
|
56
|
-
Effect.mapError(
|
|
58
|
+
/*@__PURE__*/ envConfig.pipe(
|
|
59
|
+
/*@__PURE__*/ Effect.mapError(
|
|
57
60
|
() =>
|
|
58
61
|
new ConfigError({
|
|
59
62
|
message: "STACKIT_SERVICE_ACCOUNT_TOKEN environment variable is required",
|
|
60
63
|
}),
|
|
61
64
|
),
|
|
62
|
-
Effect.map(({ token, region, apiBaseUrl }) => ({
|
|
65
|
+
/*@__PURE__*/ Effect.map(({ token, region, apiBaseUrl }) => ({
|
|
63
66
|
token: Redacted.make(token),
|
|
64
67
|
region,
|
|
65
68
|
apiBaseUrl: apiBaseUrl._tag === "Some" ? apiBaseUrl.value : undefined,
|
package/src/errors.ts
CHANGED
|
@@ -28,23 +28,19 @@ export {
|
|
|
28
28
|
export type { DefaultErrors } from "@distilled.cloud/core/errors";
|
|
29
29
|
|
|
30
30
|
import * as Category from "@distilled.cloud/core/category";
|
|
31
|
-
import * as Schema from "
|
|
31
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
32
32
|
|
|
33
|
-
/** Unknown STACKIT error
|
|
34
|
-
export class UnknownStackitError
|
|
35
|
-
"UnknownStackitError",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
message: Schema.optional(Schema.String),
|
|
33
|
+
/** Unknown STACKIT error -- returned when nothing else matches the failure. */
|
|
34
|
+
export class UnknownStackitError
|
|
35
|
+
extends /*@__PURE__*/ Schema.TaggedError<UnknownStackitError>()("UnknownStackitError", {
|
|
36
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
37
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
39
38
|
body: Schema.Unknown,
|
|
40
|
-
}
|
|
41
|
-
).pipe(Category.withServerError) {}
|
|
39
|
+
}).pipe(Category.withServerError) {}
|
|
42
40
|
|
|
43
41
|
/** Schema parse error wrapper. */
|
|
44
|
-
export class StackitParseError
|
|
45
|
-
"StackitParseError",
|
|
46
|
-
{
|
|
42
|
+
export class StackitParseError
|
|
43
|
+
extends /*@__PURE__*/ Schema.TaggedError<StackitParseError>()("StackitParseError", {
|
|
47
44
|
body: Schema.Unknown,
|
|
48
45
|
cause: Schema.Unknown,
|
|
49
|
-
}
|
|
50
|
-
).pipe(Category.withParseError) {}
|
|
46
|
+
}).pipe(Category.withParseError) {}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @distilled.cloud/stackit
|
|
2
|
+
* @distilled.cloud/stackit -- STACKIT Cloud API SDK for Effect.
|
|
3
3
|
*
|
|
4
4
|
* `./services` is generated by `scripts/generate.ts` from the Smithy models
|
|
5
5
|
* in `.generated-specs` (written by `scripts/convert.ts` from the OpenAPI
|
|
6
6
|
* documents mirrored at `specs/spec-mirror-stackit/specs/`). Everything else
|
|
7
7
|
* in this folder is hand-written.
|
|
8
8
|
*
|
|
9
|
-
* One module per STACKIT product (IaaS, SKE, DNS, Postgres Flex,
|
|
9
|
+
* One module per STACKIT product (IaaS, SKE, DNS, Postgres Flex, ...), using
|
|
10
10
|
* that product's latest published OpenAPI version. Auth is a service-account
|
|
11
11
|
* bearer token (`STACKIT_SERVICE_ACCOUNT_TOKEN`); each product's host is
|
|
12
12
|
* rewritten for `STACKIT_REGION` (default `eu01`).
|
package/src/pagination.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getPath, type PaginationStrategy } from "@distilled.cloud/core/pagination";
|
|
2
2
|
/**
|
|
3
|
-
* STACKIT pagination
|
|
3
|
+
* STACKIT pagination -- hand-written.
|
|
4
4
|
*
|
|
5
5
|
* Several STACKIT list operations page by NUMBER: `?page=N&pageSize=M` in,
|
|
6
6
|
* and a response carrying the collection beside `totalPages` (DNS zones /
|
|
@@ -16,7 +16,7 @@ export type { PaginatedTrait, PaginationStrategy } from "@distilled.cloud/core/p
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Stream of pages using STACKIT's `page` / `totalPages` envelope: request
|
|
19
|
-
* `page`, `page+1`,
|
|
19
|
+
* `page`, `page+1`, ... while `page < totalPages` and the collection is
|
|
20
20
|
* non-empty.
|
|
21
21
|
*/
|
|
22
22
|
export const paginateByTotalPages: PaginationStrategy = (operation, input, pagination) => {
|
package/src/protocol.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as API from "@distilled.cloud/core/api";
|
|
2
|
+
import { debugHttp } from "@distilled.cloud/core/debug";
|
|
2
3
|
import {
|
|
3
4
|
HTTP_STATUS_MAP,
|
|
4
5
|
InternalServerError,
|
|
@@ -19,7 +20,7 @@ import { validateResponse } from "@distilled.cloud/core/response-validation";
|
|
|
19
20
|
import { parseRetryAfterForStatus } from "@distilled.cloud/core/retry-after";
|
|
20
21
|
import { httpSymbol } from "@distilled.cloud/core/trait";
|
|
21
22
|
/**
|
|
22
|
-
* StackitProtocol
|
|
23
|
+
* StackitProtocol -- the shared bearer-REST protocol instantiated for STACKIT.
|
|
23
24
|
*
|
|
24
25
|
* STACKIT speaks plain JSON with no success envelope. FAILURES are
|
|
25
26
|
* `{ "message": "...", "error": "..." }` (the `ErrorMessage` schema most
|
|
@@ -29,7 +30,7 @@ import { httpSymbol } from "@distilled.cloud/core/trait";
|
|
|
29
30
|
* region (`eu01` by default).
|
|
30
31
|
*
|
|
31
32
|
* Auth is `Authorization: Bearer <token>`. The API version is a PATH
|
|
32
|
-
* segment (`/v1`, `/v2`,
|
|
33
|
+
* segment (`/v1`, `/v2`, ...), so the generated operations carry versioned
|
|
33
34
|
* routes against a version-less host.
|
|
34
35
|
*/
|
|
35
36
|
import * as Effect from "effect/Effect";
|
|
@@ -64,13 +65,13 @@ export type StackitOpContext = Credentials | HttpClient.HttpClient;
|
|
|
64
65
|
/**
|
|
65
66
|
* Rewrite a spec `servers` URL for the configured region.
|
|
66
67
|
*
|
|
67
|
-
*
|
|
68
|
+
* * `{region}` still in the template (IaaS v1:
|
|
68
69
|
* `https://iaas.api.{region}stackit.cloud`, default `eu01.`) is
|
|
69
70
|
* substituted. A glued `{region}stackit` means the spec's default
|
|
70
71
|
* includes the trailing dot.
|
|
71
|
-
*
|
|
72
|
+
* * `https://<svc>.api.stackit.cloud` becomes
|
|
72
73
|
* `https://<svc>.api.<region>.stackit.cloud`.
|
|
73
|
-
*
|
|
74
|
+
* * `region === "global"` leaves the URL alone (after dropping any
|
|
74
75
|
* leftover `{region}`).
|
|
75
76
|
*/
|
|
76
77
|
export const applyRegion = (specUrl: string, region: string): string => {
|
|
@@ -110,14 +111,16 @@ const baseUrlFor = (creds: Config, inputAst: AST.AST): string => {
|
|
|
110
111
|
const http = getAnn(inputAst, httpSymbol) as StackitHttpTrait | undefined;
|
|
111
112
|
const specUrl = http?.baseUrl;
|
|
112
113
|
if (typeof specUrl !== "string" || specUrl === "") {
|
|
113
|
-
throw new Error(
|
|
114
|
+
throw new Error(
|
|
115
|
+
"STACKIT operation is missing T.Http({ baseUrl }) \u2014 regenerate from convert",
|
|
116
|
+
);
|
|
114
117
|
}
|
|
115
118
|
return applyRegion(specUrl, creds.region);
|
|
116
119
|
};
|
|
117
120
|
|
|
118
|
-
export const StackitProtocol: Layer.Layer<API.Protocol> = Layer.succeed(
|
|
121
|
+
export const StackitProtocol: Layer.Layer<API.Protocol> = /*@__PURE__*/ Layer.succeed(
|
|
119
122
|
API.Protocol,
|
|
120
|
-
API.Protocol.of({
|
|
123
|
+
/*@__PURE__*/ API.Protocol.of({
|
|
121
124
|
encode: ({ input, inputAst }: { readonly input: unknown; readonly inputAst: AST.AST }) =>
|
|
122
125
|
Effect.gen(function* () {
|
|
123
126
|
const resolve = yield* Credentials;
|
|
@@ -142,7 +145,7 @@ export const StackitProtocol: Layer.Layer<API.Protocol> = Layer.succeed(
|
|
|
142
145
|
}) =>
|
|
143
146
|
Effect.gen(function* () {
|
|
144
147
|
const text = (yield* response.text.pipe(Effect.orDie)) ?? "";
|
|
145
|
-
if (
|
|
148
|
+
if (debugHttp()) {
|
|
146
149
|
console.error(`[distilled] <- ${response.status} ${text.slice(0, 400)}`);
|
|
147
150
|
}
|
|
148
151
|
let json: unknown;
|
package/src/retry.ts
CHANGED
|
@@ -31,17 +31,19 @@ export {
|
|
|
31
31
|
} from "@distilled.cloud/core/retry";
|
|
32
32
|
|
|
33
33
|
/** Context tag for configuring retry behavior of STACKIT API calls. */
|
|
34
|
-
export class Retry extends Context.Service<Retry, Policy>()("StackitRetry") {}
|
|
34
|
+
export class Retry extends /*@__PURE__*/ Context.Service<Retry, Policy>()("StackitRetry") {}
|
|
35
35
|
|
|
36
36
|
/** Provides a custom retry policy to every STACKIT API call below it. */
|
|
37
37
|
export const policy = (optionsOrFactory: Policy) =>
|
|
38
38
|
Effect.provide(Layer.succeed(Retry, optionsOrFactory));
|
|
39
39
|
|
|
40
40
|
/** Disables all automatic retries. */
|
|
41
|
-
export const none = Effect.provide(
|
|
41
|
+
export const none = /*@__PURE__*/ Effect.provide(
|
|
42
|
+
/*@__PURE__*/ Layer.succeed(Retry, { while: () => false }),
|
|
43
|
+
);
|
|
42
44
|
|
|
43
45
|
/** Apply the throttling retry policy (retries throttling errors indefinitely). */
|
|
44
|
-
export const throttling = policy(throttlingFactory);
|
|
46
|
+
export const throttling = /*@__PURE__*/ policy(throttlingFactory);
|
|
45
47
|
|
|
46
48
|
/** Apply the transient retry policy (retries all transient errors indefinitely). */
|
|
47
|
-
export const transient = policy(transientFactory);
|
|
49
|
+
export const transient = /*@__PURE__*/ policy(transientFactory);
|