@fastly/hono-fastly-compute 0.3.6 → 0.3.8

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 CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [unreleased]
9
9
 
10
+ ## [0.3.8] - 2026-01-07
11
+
12
+ ### Fixed
13
+
14
+ - Correct CI for GitHub packages
15
+
16
+ ## [0.3.7] - 2026-01-07
17
+
18
+ ### Added
19
+
20
+ - Publish using CI
21
+
10
22
  ## [0.3.6] - 2025-10-19
11
23
 
12
24
  ### Added
@@ -60,7 +72,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
60
72
 
61
73
  - Initial public release
62
74
 
63
- [unreleased]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.6...HEAD
75
+ [unreleased]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.8...HEAD
76
+ [0.3.8]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.7...v0.3.8
77
+ [0.3.7]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.6...v0.3.7
64
78
  [0.3.6]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.5...v0.3.6
65
79
  [0.3.5]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.4...v0.3.5
66
80
  [0.3.4]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.3...v0.3.4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastly/hono-fastly-compute",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Helper utilities for using Hono with Fastly Compute",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,37 +0,0 @@
1
- import { Acl } from 'fastly:acl';
2
- import { Backend } from 'fastly:backend';
3
- import { ConfigStore } from 'fastly:config-store';
4
- import { KVStore } from 'fastly:kv-store';
5
- import { Logger } from 'fastly:logger';
6
- import { SecretStore } from 'fastly:secret-store';
7
- import { Context } from "@h7/fastly-compute-js-context";
8
- type Def<T extends string> = T | `${T}:${string}`;
9
- type Defs<T extends string> = T extends string ? Def<T> : never;
10
- declare const BindingStringToContextKeyMapping: {
11
- readonly Acl: "ACLS";
12
- readonly Backend: "BACKENDS";
13
- readonly ConfigStore: "CONFIG_STORES";
14
- readonly env: "ENV";
15
- readonly KVStore: "KV_STORES";
16
- readonly Logger: "LOGGERS";
17
- readonly SecretStore: "SECRET_STORES";
18
- };
19
- export type ResourceType = keyof typeof BindingStringToContextKeyMapping;
20
- export type BindingsString = Defs<ResourceType>;
21
- export type EnvBindingsDefs = Record<string, BindingsString>;
22
- type BindingStringToResourceInstanceTypeMapping = {
23
- Acl: Acl;
24
- Backend: Backend;
25
- ConfigStore: ConfigStore;
26
- env: string;
27
- KVStore: KVStore;
28
- Logger: Logger;
29
- SecretStore: SecretStore;
30
- };
31
- export type ResourceInstance<T> = T extends Def<infer K extends keyof BindingStringToResourceInstanceTypeMapping> ? BindingStringToResourceInstanceTypeMapping[K] : never;
32
- export type BuildBindings<T extends EnvBindingsDefs> = {
33
- [K in keyof T]: ResourceInstance<T[K]>;
34
- };
35
- export declare function buildEnvironment<T extends EnvBindingsDefs>(context: Context, envBindingsDefs: T): BuildBindings<T>;
36
- export {};
37
- //# sourceMappingURL=bindings.d.ts.map
package/build/bindings.js DELETED
@@ -1,53 +0,0 @@
1
- const BindingStringToContextKeyMapping = {
2
- Acl: 'ACLS',
3
- Backend: 'BACKENDS',
4
- ConfigStore: 'CONFIG_STORES',
5
- env: 'ENV',
6
- KVStore: 'KV_STORES',
7
- Logger: 'LOGGERS',
8
- SecretStore: 'SECRET_STORES',
9
- };
10
- function isResourceType(resourceType) {
11
- return resourceType in BindingStringToContextKeyMapping;
12
- }
13
- function getResourceType(typeName) {
14
- const [resourceType,] = typeName.split(':');
15
- if (isResourceType(resourceType)) {
16
- return resourceType;
17
- }
18
- return undefined;
19
- }
20
- function getResourceName(key, typeName) {
21
- const [, seg,] = typeName.split(':');
22
- return seg ?? key;
23
- }
24
- export function buildEnvironment(context, envBindingsDefs) {
25
- const target = {};
26
- const getEntry = (key) => {
27
- if (typeof key !== "string") {
28
- return undefined;
29
- }
30
- console.log('key', key);
31
- const typeName = envBindingsDefs[key];
32
- const resourceType = getResourceType(typeName);
33
- if (resourceType == null) {
34
- return undefined;
35
- }
36
- const resourceName = getResourceName(key, typeName);
37
- const contextKey = BindingStringToContextKeyMapping[resourceType];
38
- const contextEntry = context[contextKey];
39
- if (contextEntry == null) {
40
- return undefined;
41
- }
42
- return contextEntry[resourceName];
43
- };
44
- const handler = {
45
- get(_, key) {
46
- return getEntry(key);
47
- },
48
- has(_, key) {
49
- return getEntry(key) !== undefined;
50
- },
51
- };
52
- return new Proxy(target, handler);
53
- }