@bjorntech/alchemy-azure 0.2.0-beta.57

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.
@@ -0,0 +1,170 @@
1
+ # Architecture
2
+
3
+ This document explains how `@bjorntech/alchemy-azure` is organised and why. It's aimed at contributors and at anyone who wants to add a new Azure resource type.
4
+
5
+ For an end-user view of the package, see the [README](./README.md). For the upstream v2 model this package implements, see [v2.alchemy.run](https://v2.alchemy.run/).
6
+
7
+ ## File layout
8
+
9
+ ```
10
+ src/
11
+ index.ts ← public re-exports
12
+ Providers.ts ← the providers() layer (Provider.collection + AuthProvider + Credentials)
13
+ AuthProvider.ts ← AzureAuth (env + stored) + resolveFromEnv / resolveFromStored
14
+ Credentials.ts ← AzureCredentials Context.Service + fromAuthProvider() bridge
15
+ Clients.ts ← Azure SDK client factory keyed off AzureCredentials
16
+ Errors.ts ← AzureError tagged error + isNotFound / isAlreadyExists
17
+ Internal.ts ← physicalName / resourceGroupName / requireLocation helpers
18
+
19
+ ResourceGroup.ts ← one file per resource type
20
+ StorageAccount.ts
21
+ BlobContainer.ts
22
+ ContainerAppEnvironment.ts
23
+ ContainerRegistry.ts
24
+ ContainerImage.ts
25
+ ContainerApp.ts ← experimental Platform host
26
+ MoreResources.ts ← bulk file containing the simpler "shape" resources
27
+
28
+ BlobState.ts ← Azure Blob-backed state store (alternative to local state)
29
+
30
+ test/
31
+ *.test.ts ← Bun test suites
32
+ ```
33
+
34
+ ## How a resource is wired
35
+
36
+ Every resource follows the same five-step contract from [v2.alchemy.run/concepts/provider](https://v2.alchemy.run/concepts/provider):
37
+
38
+ 1. **Props + Attributes types** describe inputs and outputs.
39
+ 2. **`Resource<T>(type)`** constructs the typed handle.
40
+ 3. **`Provider.effect(R, Effect.gen(...))`** wraps the lifecycle methods.
41
+ 4. **`R.Provider.of({ stables, diff, read, reconcile, delete })`** types each method against the resource's props/attrs.
42
+ 5. The provider Layer is added to `Provider.collection([...])` in `src/Providers.ts` and `Layer.provide`d to it.
43
+
44
+ Concretely, a minimal resource looks like this:
45
+
46
+ ```ts
47
+ // MyResource.ts
48
+ export interface MyResourceProps extends BaseProps { /* ... */ }
49
+ export type MyResource = Resource<"Azure.MyResource", MyResourceProps, Attrs<{ ... }>, never, Providers>;
50
+ export const MyResource = Resource<MyResource>("Azure.MyResource");
51
+
52
+ export const MyResourceProvider = () =>
53
+ Provider.effect(
54
+ MyResource,
55
+ Effect.gen(function* () {
56
+ const clients = yield* makeAzureClients;
57
+ const nameOf = (id, props) => physicalName(id, props.name, { maxLength: 64 });
58
+
59
+ return MyResource.Provider.of({
60
+ stables: ["name", "resourceGroupName", "resourceId"],
61
+ diff: Effect.fnUntraced(function* ({ olds, news, output }) { /* replace identity, update mutable */ }),
62
+ read: Effect.fnUntraced(function* ({ id, olds, output }) { /* ... */ }),
63
+ reconcile: Effect.fnUntraced(function* ({ id, news }) { /* ... */ }),
64
+ delete: Effect.fnUntraced(function* ({ olds, output, session }) { /* ... */ }),
65
+ });
66
+ }),
67
+ );
68
+ ```
69
+
70
+ Then register it in `src/Providers.ts`:
71
+
72
+ ```ts
73
+ Provider.collection([..., MyResource])
74
+ .pipe(Layer.provide(Layer.mergeAll(..., MyResourceProvider())))
75
+ ```
76
+
77
+ …and re-export from `src/index.ts`.
78
+
79
+ ## Conventions
80
+
81
+ ### Physical names
82
+
83
+ Use `Internal.physicalName(id, props.name, options)` to derive a deterministic Azure-safe name. The defaults respect Azure's per-service character set (lowercase, length, allowed characters). When the user supplies an explicit `name` it's used verbatim; otherwise we derive `{stack}-{stage}-{logical-id}-{instance-id}` and apply optional sanitization.
84
+
85
+ The `nameOf` closure is reused by `diff` (to detect identity changes that should trigger replacement) and by `read` (to find the live resource when adopting from cloud). Diff only returns `replace` for durable identity changes such as name, parent resource group, region, parent resource, or Azure-documented create-time properties. Mutable desired-state changes should return `update` so `reconcile` runs.
86
+
87
+ When mutability is unclear, verify against Microsoft Learn ARM template references, Azure REST API request schemas, and Terraform AzureRM `ForceNew` behavior. Prefer conservative replacement for create-time or conditionally immutable Azure properties unless the provider implements a specific safe migration path.
88
+
89
+ ### Ownership
90
+
91
+ Azure's API has no built-in concept of "this resource belongs to my IaC tool", so we do it via tags:
92
+
93
+ - `withAlchemyTags(id, props.tags)` adds `alchemy:logical-id: <id>` to every resource we create.
94
+ - `hasAlchemyTags(id, resource.tags)` checks the tag matches the logical ID we expect.
95
+ - `read` brands foreign-owned attributes with `Unowned(attrs)` from `alchemy/AdoptPolicy`. The engine then refuses to take them over unless the user passes `--adopt`.
96
+ - During state recovery (`output` is defined), still verify the current Azure ownership marker. If a previously owned resource was deleted and recreated out-of-band without our marker, return `Unowned(attrs)` from `read` or fail update reconciliation unless the user explicitly adopts it.
97
+
98
+ `BlobContainer` uses the `alchemyLogicalId` blob metadata key instead of tags, since blob containers don't support Azure resource tags.
99
+
100
+ ### Reconcile shape
101
+
102
+ Always **observe → ensure → sync → return**:
103
+
104
+ - **Observe**: try to GET the resource. If 404, treat as "needs create".
105
+ - **Ensure**: create-or-update. Most Azure ARM clients expose `beginCreateOrUpdateAndWait` which is idempotent.
106
+ - **Sync**: not all of Azure is convergent on a single `createOrUpdate`. For aspects that aren't (e.g. role assignments, custom domains), check observed state and apply only the delta.
107
+ - **Return**: build the `Attributes` object from the response.
108
+
109
+ Never branch the reconcile body on `output === undefined`. That just renames the old `create`/`update` split. A correct reconcile produces the right cloud state regardless of starting point.
110
+
111
+ ### Errors
112
+
113
+ Wrap Azure SDK calls with `Effect.tryPromise({ try, catch })`, mapping the `catch` to `azureError({ operation, resource, cause })`. This produces a tagged `AzureError` with `statusCode` / `code` extracted from the SDK error, which downstream code can match with `Effect.catchTag("AzureError", ...)`.
114
+
115
+ For 404 handling on `read` and `delete`, use `Effect.catchIf(isNotFound, ...)`. For "already exists" race conditions, use `isAlreadyExists`.
116
+
117
+ ### Secrets
118
+
119
+ Anything that's a credential — storage keys, connection strings, registry passwords, client secrets — is wrapped in `Redacted<string>` from `effect/Redacted`. The wrapper prevents accidental logging. Unwrap with `Redacted.value(x)` only at the SDK boundary.
120
+
121
+ ### Clients
122
+
123
+ `makeAzureClients` (in `Clients.ts`) is an Effect that yields `AzureCredentials` and constructs every Azure SDK client we need. Each provider's outer `Effect.gen` calls `yield* makeAzureClients` once at layer-construction time, so the clients are created once per stack and shared across `reconcile` / `read` / `delete` invocations.
124
+
125
+ ### Auth
126
+
127
+ `AzureAuth` registers itself in the `AuthProviders` registry under the name `"Azure"` via `AuthProviderLayer`. Two methods:
128
+
129
+ - **`env`**: reads `AZURE_*` environment variables. Returns `servicePrincipal` when tenant + client + secret are all set; otherwise returns `default` (the SDK's `DefaultAzureCredential` chain).
130
+ - **`stored`**: reads `~/.alchemy/credentials/{profile}/azure-stored.json` written by `alchemy login`. Same fallback logic.
131
+
132
+ `Credentials.fromAuthProvider()` is the bridge: it loads the profile, reads credentials via the registry, and yields an `AzureCredentialsService` (which contains a real `TokenCredential` ready for the SDK clients).
133
+
134
+ The two pure helpers `resolveFromEnv()` and `resolveFromStored(creds)` are exported so they can be unit-tested without standing up the full `AuthProvider` layer.
135
+
136
+ ## Testing
137
+
138
+ Tests live in `test/` and run with `bun test`. They fall into three categories:
139
+
140
+ 1. **Unit tests** for pure helpers — `resolveFromEnv`, `resolveFromStored`, `azureError`, `physicalName`. These run with no I/O.
141
+ 2. **In-memory state tests** for `BlobState.ts` using a `MemoryBlobContainer` fake.
142
+ 3. **Type-only tests** in `test/types.test.ts` that build a sample stack to ensure resources compose correctly.
143
+
144
+ Live cloud tests (real Azure resources) are **not** included. The upstream `alchemy/Test/Bun` harness can be used to add them later — see [v2.alchemy.run/concepts/testing](https://v2.alchemy.run/concepts/testing).
145
+
146
+ When mocking environment variables, use `ConfigProvider.fromEnv({ env })` and provide it as a Layer. `process.env` mutation does not propagate to Effect's `Config.string` reads.
147
+
148
+ ## Adding a new resource
149
+
150
+ 1. Pick the right Azure SDK package and add it to `dependencies` in `package.json` if it isn't already there.
151
+ 2. Create `src/MyResource.ts` following the template above. For "shape" resources that don't need anything special, you can add them to `src/MoreResources.ts` instead.
152
+ 3. Add the SDK client to `Clients.ts`.
153
+ 4. Register the provider in `src/Providers.ts` (`Provider.collection([...])` and `Layer.mergeAll(...)`).
154
+ 5. Re-export from `src/index.ts`.
155
+ 6. Add a row to the resource list in `README.md`.
156
+ 7. If the resource has non-trivial props, add a unit test that exercises `physicalName` / `diff` / `read` paths.
157
+
158
+ ## Tracking upstream alchemy
159
+
160
+ This package is exact-pinned to a specific `alchemy@2.0.0-beta.X` because v2 is still in beta and breaking changes happen between betas. To upgrade:
161
+
162
+ 1. Bump `peerDependencies.alchemy` and `devDependencies.alchemy` in `package.json` to the new beta.
163
+ 2. Run `bun install`.
164
+ 3. Run `bun run check` and `bun test`. Fix any new type errors or breakages.
165
+ 4. Bump `@bjorntech/alchemy-azure`'s own version to match: `0.1.0-beta.36` for `alchemy@2.0.0-beta.36`, etc.
166
+ 5. Update the compatibility matrix in `README.md`.
167
+ 6. Add a `CHANGELOG.md` entry describing what changed and any required migration.
168
+ 7. Tag and publish.
169
+
170
+ When `alchemy` cuts a stable `2.0.0`, this package will graduate to `0.1.0` (or `1.0.0`) with a permissive `^2.0.0` peerDep range.
package/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@bjorntech/alchemy-azure` are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the package follows the alchemy beta line — see [README › Compatibility](./README.md#compatibility).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.2.0-beta.57] - 2026-06-27
8
+
9
+ ### Added
10
+
11
+ - Long-running "sign of life" heartbeat: the slowest resources now log a progress
12
+ message to stderr every 60 seconds while an operation is in flight, so slow Azure
13
+ provisioning and teardown no longer look like a hung process. Applied selectively to
14
+ Container Apps managed environment, Container App, Cosmos DB account, SQL server, and
15
+ virtual machine create/delete paths; fast resources stay quiet.
16
+
17
+ ### Fixed
18
+
19
+ - Blob container create/update no longer fails at runtime with
20
+ `undefined is not an object (evaluating 'this.client')`. The reconcile path aliased
21
+ the Azure SDK method and invoked it unbound, detaching `this`; it now calls
22
+ `blobContainers.create` (an idempotent create-or-update PUT) directly so the SDK
23
+ method keeps its binding.
24
+
25
+ ## [0.1.1-beta.57] - 2026-06-26
26
+
27
+ ### Fixed
28
+
29
+ - Container App `Redacted` environment variables now use Container Apps secrets plus `secretRef` entries instead of writing plaintext values into normal environment variable configuration.
30
+ - Azure SDK lifecycle calls now consistently wrap failures as tagged `AzureError` values with operation/resource context.
31
+ - Key Vault tenant changes, including omitted-to-explicit changes, now plan replacement.
32
+ - Tightened Azure diff semantics against public ARM documentation and Terraform AzureRM replacement behavior: create-time fields such as storage account kind, public IP SKU/version/zones, service bus tier, Cosmos DB kind/free tier, SQL version/collation, Key Vault tenant/soft-delete retention, App Service plan OS kind, container instance runtime shape, and VM OS identity/image/network credentials now plan replacement instead of unsafe in-place updates.
33
+ - Hardened the release workflow to publish only from `main`, use deterministic package tarballs, and create/verify GitHub releases.
34
+
35
+ ## [0.1.0-beta.57] - 2026-06-21
36
+
37
+ ### Changed
38
+
39
+ - Updated compatibility target to `alchemy@2.0.0-beta.57` and Effect `>=4.0.0-beta.84`.
40
+ - Azure SDK clients are now provided through an injectable `AzureClients` Effect
41
+ service (with `AzureClientsLive` for production), so provider lifecycles can
42
+ be unit-tested with an in-memory fake. Public API is unchanged.
43
+
44
+ ### Fixed
45
+
46
+ - `isNotFound` / `isAlreadyExists` now unwrap the `cause` chain. `Effect.tryPromise(thunk)` wraps a rejected promise in `UnknownError`, so the previous top-level checks never matched a 404/409, which broke idempotent `read` / `delete` paths and `AzureError` status extraction for not-found resources. `azureError` now also extracts `statusCode` / `code` from the wrapped cause.
47
+
48
+ ### Added
49
+
50
+ - Provider lifecycle test suite covering reconcile/read/delete/diff and attribute mapping for every non-experimental resource, plus a coverage-floor gate (`coverage:check`) wired into CI and `prepublishOnly`.
51
+ - Repository hygiene: `SECURITY.md`, `CONTRIBUTING.md`, `env.example`, `.editorconfig`, Dependabot config, and issue/PR templates.
52
+
53
+ ## [0.1.0-beta.35] - 2026-06-20
54
+
55
+ Tested against `alchemy@2.0.0-beta.35`.
56
+
57
+ ### Added
58
+
59
+ - Azure resource providers: `ResourceGroup`, `StorageAccount`, `BlobContainer`, `UserAssignedIdentity`, `VirtualNetwork`, `NetworkSecurityGroup`, `PublicIPAddress`, `CognitiveServices`, `ServiceBus`, `CosmosDBAccount`, `SqlServer`, `SqlDatabase`, `KeyVault`, `AppServicePlan`, `AppService`, `FunctionApp`, `StaticWebApp`, `ContainerInstance`, `ContainerAppEnvironment`, `ContainerRegistry`, `ContainerImage`, `ContainerApp` (experimental Platform host), `VirtualMachine`.
60
+ - `Azure.providers()` layer bundling every provider, the `AzureAuth` registration, and credential resolution.
61
+ - `Azure.blobState({ ... })` for using an existing Azure Blob container as the Alchemy state store.
62
+ - `AzureAuth` AuthProvider with `env` and `stored` methods. `alchemy login` walks users through configuring a Service Principal interactively; CI defaults to `env`.
63
+ - Tagged `AzureError` (via `Schema.TaggedErrorClass`) wrapping all Azure SDK failures inside provider lifecycle methods. Carries `operation`, `resource`, `statusCode`, `code`, and the original `cause` (with stack via `Schema.DefectWithStack`). Match with `Effect.catchTag("AzureError", ...)` inside custom resources.
64
+ - `resolveFromEnv()` and `resolveFromStored(creds)` exported as pure helpers for unit testing credential resolution without standing up the full layer.
65
+ - Tag-based ownership (`alchemy:logical-id`) for safe adoption — foreign-owned resources surface as `Unowned(attrs)` and require `--adopt` to take over.
66
+ - Secrets (storage keys, connection strings, registry passwords, client secrets) returned as `Redacted<string>`.
67
+
68
+ ### Notes
69
+
70
+ - `peerDependencies.alchemy` is exact-pinned to the alchemy v2 beta this release was tested against. `peerDependencies.effect` accepts the tested Effect beta line or stable Effect 4.
71
+ - `ContainerApp` is marked experimental — its `Platform` integration with the upstream v2 binding model is still evolving.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Björn Tech AB
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.