@fastly/compute-js-context 0.5.1 → 0.5.2
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/CHANGELOG.md +8 -1
- package/README.md +15 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.5.2] - 2025-10-16
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Updated README
|
|
15
|
+
|
|
10
16
|
## [0.5.1] - 2025-10-14
|
|
11
17
|
|
|
12
18
|
### Fixed
|
|
@@ -41,7 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
41
47
|
|
|
42
48
|
- Initial public release
|
|
43
49
|
|
|
44
|
-
[unreleased]: https://github.com/fastly/compute-js-context/compare/v0.5.
|
|
50
|
+
[unreleased]: https://github.com/fastly/compute-js-context/compare/v0.5.2...HEAD
|
|
51
|
+
[0.5.2]: https://github.com/fastly/compute-js-context/compare/v0.5.1...v0.5.2
|
|
45
52
|
[0.5.1]: https://github.com/fastly/compute-js-context/compare/v0.5.0...v0.5.1
|
|
46
53
|
[0.5.0]: https://github.com/fastly/compute-js-context/compare/v0.4.2...v0.5.0
|
|
47
54
|
[0.4.2]: https://github.com/fastly/compute-js-context/compare/v0.4.1...v0.4.2
|
package/README.md
CHANGED
|
@@ -124,16 +124,29 @@ Creates the main immutable `Context`. Each sub-object is a `Proxy` that:
|
|
|
124
124
|
- **Returns `undefined`** for names that don’t exist (except for `ENV`, which returns `''`)
|
|
125
125
|
- **Is not enumerable** by design (don’t rely on `Object.keys`)
|
|
126
126
|
|
|
127
|
-
### `buildContextProxy<T>(
|
|
127
|
+
### `buildContextProxy<T>(bindingsDefs: T): ContextProxy<T>`
|
|
128
128
|
|
|
129
129
|
Creates a custom, strongly-typed proxy object based on your definitions.
|
|
130
130
|
|
|
131
|
-
- `context`: An instance of the main `Context` object
|
|
132
131
|
- `bindingsDefs`: A `const` object defining your desired bindings
|
|
133
132
|
- **Key**: The property name you want on your final `contextProxy` object
|
|
134
133
|
- **Value**: A string in the format `'ResourceType'` or `'ResourceType:actual-name'`
|
|
135
134
|
- **Returns**: A proxy object `contextProxy` with your custom bindings. Accessing a property on this object looks up the resource from the main `Context`
|
|
136
135
|
|
|
136
|
+
### Type `ContentProxy<T>`
|
|
137
|
+
|
|
138
|
+
Defines a type that represents the content proxy, inferred from your bindings definitions.
|
|
139
|
+
|
|
140
|
+
### (Advanced) `buildContextProxyOn<C, T>(target: C, bindingsDefs: T): C & ContextProxy<T>`
|
|
141
|
+
|
|
142
|
+
Extends the passed-in object with a custom, strongly-typed proxy object based on your definitions.
|
|
143
|
+
|
|
144
|
+
- `target`: An object to extend
|
|
145
|
+
- `bindingsDefs`: A `const` object defining your desired bindings
|
|
146
|
+
- **Key**: The property name you want on your final `contextProxy` object
|
|
147
|
+
- **Value**: A string in the format `'ResourceType'` or `'ResourceType:actual-name'`
|
|
148
|
+
- **Returns**: A proxy object `contextProxy` that extends `target` with your custom bindings. Accessing a property on this object looks up the resource from the main `Context` before falling back to `target`.
|
|
149
|
+
|
|
137
150
|
### Context Categories & Shapes
|
|
138
151
|
|
|
139
152
|
> These are the raw shapes available on the main `Context` object.
|
|
@@ -152,7 +165,6 @@ Creates a custom, strongly-typed proxy object based on your definitions.
|
|
|
152
165
|
- **Don’t mutate** the context or its sub-objects; it’s intentionally `Readonly`
|
|
153
166
|
- **Expect `undefined`** for missing resources and code accordingly (`?.`/guard)
|
|
154
167
|
|
|
155
|
-
|
|
156
168
|
## Issues
|
|
157
169
|
|
|
158
170
|
If you encounter any non-security-related bug or unexpected behavior, please [file an issue][bug] using the bug report template.
|