@distilled.cloud/azure 0.17.0 → 0.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/azure",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/alchemy-run/distilled",
@@ -73,7 +73,7 @@
73
73
  "specs:update": "git -C specs/azure-rest-api-specs fetch && git -C specs/azure-rest-api-specs checkout main && git -C specs/azure-rest-api-specs pull"
74
74
  },
75
75
  "dependencies": {
76
- "@distilled.cloud/core": "0.17.0"
76
+ "@distilled.cloud/core": "0.18.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@types/bun": "^1.3.0",
@@ -1,7 +1,9 @@
1
+ import * as EffectConfig from "effect/Config";
2
+ import * as Context from "effect/Context";
1
3
  import * as Effect from "effect/Effect";
2
4
  import * as Layer from "effect/Layer";
5
+ import * as Option from "effect/Option";
3
6
  import * as Redacted from "effect/Redacted";
4
- import * as Context from "effect/Context";
5
7
  import { ConfigError } from "@distilled.cloud/core/errors";
6
8
 
7
9
  /**
@@ -24,6 +26,15 @@ export class Credentials extends Context.Service<Credentials, Config>()(
24
26
  "AzureCredentials",
25
27
  ) {}
26
28
 
29
+ const envConfig = EffectConfig.all({
30
+ bearerToken: EffectConfig.string("AZURE_BEARER_TOKEN"),
31
+ subscriptionId: EffectConfig.string("AZURE_SUBSCRIPTION_ID"),
32
+ tenantId: EffectConfig.option(EffectConfig.string("AZURE_TENANT_ID")),
33
+ apiBaseUrl: EffectConfig.string("AZURE_API_BASE_URL").pipe(
34
+ EffectConfig.withDefault(DEFAULT_API_BASE_URL),
35
+ ),
36
+ });
37
+
27
38
  /**
28
39
  * Reads Azure credentials from environment variables:
29
40
  *
@@ -34,28 +45,19 @@ export class Credentials extends Context.Service<Credentials, Config>()(
34
45
  */
35
46
  export const CredentialsFromEnv = Layer.effect(
36
47
  Credentials,
37
- Effect.gen(function* () {
38
- const bearerToken = process.env.AZURE_BEARER_TOKEN;
39
-
40
- if (!bearerToken) {
41
- return yield* new ConfigError({
42
- message: "AZURE_BEARER_TOKEN environment variable is required",
43
- });
44
- }
45
-
46
- const subscriptionId = process.env.AZURE_SUBSCRIPTION_ID;
47
-
48
- if (!subscriptionId) {
49
- return yield* new ConfigError({
50
- message: "AZURE_SUBSCRIPTION_ID environment variable is required",
51
- });
52
- }
53
-
54
- return {
48
+ envConfig.asEffect().pipe(
49
+ Effect.mapError(
50
+ () =>
51
+ new ConfigError({
52
+ message:
53
+ "AZURE_BEARER_TOKEN and AZURE_SUBSCRIPTION_ID environment variables are required",
54
+ }),
55
+ ),
56
+ Effect.map(({ bearerToken, subscriptionId, tenantId, apiBaseUrl }) => ({
55
57
  bearerToken: Redacted.make(bearerToken),
56
58
  subscriptionId,
57
- tenantId: process.env.AZURE_TENANT_ID,
58
- apiBaseUrl: process.env.AZURE_API_BASE_URL ?? DEFAULT_API_BASE_URL,
59
- };
60
- }),
59
+ tenantId: Option.getOrUndefined(tenantId),
60
+ apiBaseUrl,
61
+ })),
62
+ ),
61
63
  );
@@ -3884,7 +3884,7 @@ export type OperationsListOutput = typeof OperationsListOutput.Type;
3884
3884
 
3885
3885
  // The operation
3886
3886
  /**
3887
- * List all available Microsoft.AzureStackHCI provider operations
3887
+ * List the operations for the provider
3888
3888
  *
3889
3889
  * @param api-version - The API version to use for this operation.
3890
3890
  */
@@ -3636,25 +3636,19 @@ export type OperationsListInput = typeof OperationsListInput.Type;
3636
3636
 
3637
3637
  // Output Schema
3638
3638
  export const OperationsListOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
3639
- value: Schema.optional(
3640
- Schema.Array(
3641
- Schema.Struct({
3642
- name: Schema.optional(Schema.String),
3643
- isDataAction: Schema.optional(Schema.Boolean),
3644
- display: Schema.optional(
3645
- Schema.Struct({
3646
- provider: Schema.optional(Schema.String),
3647
- resource: Schema.optional(Schema.String),
3648
- operation: Schema.optional(Schema.String),
3649
- description: Schema.optional(Schema.String),
3650
- }),
3651
- ),
3652
- origin: Schema.optional(
3653
- Schema.Literals(["user", "system", "user,system"]),
3654
- ),
3655
- actionType: Schema.optional(Schema.Literals(["Internal"])),
3656
- }),
3657
- ),
3639
+ value: Schema.Array(
3640
+ Schema.Struct({
3641
+ origin: Schema.optional(Schema.String),
3642
+ name: Schema.optional(Schema.String),
3643
+ display: Schema.optional(
3644
+ Schema.Struct({
3645
+ operation: Schema.optional(Schema.String),
3646
+ resource: Schema.optional(Schema.String),
3647
+ description: Schema.optional(Schema.String),
3648
+ provider: Schema.optional(Schema.String),
3649
+ }),
3650
+ ),
3651
+ }),
3658
3652
  ),
3659
3653
  nextLink: Schema.optional(Schema.String),
3660
3654
  });
@@ -3662,7 +3656,7 @@ export type OperationsListOutput = typeof OperationsListOutput.Type;
3662
3656
 
3663
3657
  // The operation
3664
3658
  /**
3665
- * List the operations for the provider
3659
+ * Gets a list of operations.
3666
3660
  *
3667
3661
  * @param api-version - The API version to use for this operation.
3668
3662
  */
@@ -1434,7 +1434,7 @@ export type OperationsListOutput = typeof OperationsListOutput.Type;
1434
1434
 
1435
1435
  // The operation
1436
1436
  /**
1437
- * List the operations for the provider
1437
+ * Lists all of the available Microsoft.Marketplace REST API operations.
1438
1438
  *
1439
1439
  * @param api-version - The API version to use for this operation.
1440
1440
  */
@@ -10991,9 +10991,9 @@ export const ManagementLocksListByScope = /*@__PURE__*/ /*#__PURE__*/ API.make(
10991
10991
  }),
10992
10992
  );
10993
10993
  // Input Schema
10994
- export const OperationsListInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct(
10995
- {},
10996
- ).pipe(
10994
+ export const OperationsListInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
10995
+ "api-version": Schema.String,
10996
+ }).pipe(
10997
10997
  T.Http({ method: "GET", path: "/providers/Microsoft.Resources/operations" }),
10998
10998
  );
10999
10999
  export type OperationsListInput = typeof OperationsListInput.Type;
@@ -11004,6 +11004,7 @@ export const OperationsListOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
11004
11004
  Schema.Array(
11005
11005
  Schema.Struct({
11006
11006
  name: Schema.optional(Schema.String),
11007
+ isDataAction: Schema.optional(Schema.Boolean),
11007
11008
  display: Schema.optional(
11008
11009
  Schema.Struct({
11009
11010
  provider: Schema.optional(Schema.String),
@@ -11012,6 +11013,10 @@ export const OperationsListOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
11012
11013
  description: Schema.optional(Schema.String),
11013
11014
  }),
11014
11015
  ),
11016
+ origin: Schema.optional(
11017
+ Schema.Literals(["user", "system", "user,system"]),
11018
+ ),
11019
+ actionType: Schema.optional(Schema.Literals(["Internal"])),
11015
11020
  }),
11016
11021
  ),
11017
11022
  ),
@@ -11021,7 +11026,9 @@ export type OperationsListOutput = typeof OperationsListOutput.Type;
11021
11026
 
11022
11027
  // The operation
11023
11028
  /**
11024
- * Lists all of the available Microsoft.Resources REST API operations.
11029
+ * List the operations for the provider
11030
+ *
11031
+ * @param api-version - The API version to use for this operation.
11025
11032
  */
11026
11033
  export const OperationsList = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
11027
11034
  inputSchema: OperationsListInput,