@homeflare/alchemy 0.56.0 → 0.57.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/dist/unifi/acl-rule-ordering.d.ts +1 -1
- package/dist/unifi/acl-rule.d.ts +1 -1
- package/dist/unifi/dns-policy.d.ts +1 -1
- package/dist/unifi/firewall-policy-create.d.ts +55 -0
- package/dist/unifi/firewall-policy-create.d.ts.map +1 -0
- package/dist/unifi/firewall-policy-form.d.ts +9 -2
- package/dist/unifi/firewall-policy-form.d.ts.map +1 -1
- package/dist/unifi/firewall-policy-ordering.d.ts +1 -1
- package/dist/unifi/firewall-policy.d.ts +45 -12
- package/dist/unifi/firewall-policy.d.ts.map +1 -1
- package/dist/unifi/firewall-zone.d.ts +1 -1
- package/dist/unifi/index.d.ts +1 -1
- package/dist/unifi/index.d.ts.map +1 -1
- package/dist/unifi/index.js +112 -21
- package/dist/unifi/index.js.map +10 -9
- package/dist/unifi/network.d.ts +1 -1
- package/dist/unifi/policy.d.ts +22 -0
- package/dist/unifi/policy.d.ts.map +1 -1
- package/dist/unifi/resource.d.ts +26 -7
- package/dist/unifi/resource.d.ts.map +1 -1
- package/dist/unifi/traffic-matching-list.d.ts +1 -1
- package/dist/unifi/update-reconcile.d.ts +36 -2
- package/dist/unifi/update-reconcile.d.ts.map +1 -1
- package/dist/unifi/wifi-broadcast.d.ts +1 -1
- package/dist/unifi/wire-guard.d.ts +1 -1
- package/dist/unifi/wire-guard.d.ts.map +1 -1
- package/docs/distilled-interim.md +4 -2
- package/package.json +1 -1
- package/src/unifi/firewall-policy-create.ts +94 -0
- package/src/unifi/firewall-policy-form.ts +9 -2
- package/src/unifi/firewall-policy.test.ts +188 -1
- package/src/unifi/firewall-policy.ts +108 -12
- package/src/unifi/index.ts +1 -0
- package/src/unifi/policy.ts +45 -12
- package/src/unifi/resource.test.ts +103 -0
- package/src/unifi/resource.ts +73 -21
- package/src/unifi/update-reconcile.ts +72 -2
- package/src/unifi/wire-guard.test.ts +86 -1
- package/src/unifi/wire-guard.ts +8 -1
- package/src/unifi/write-op-reference.test.ts +21 -7
package/dist/unifi/network.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export declare const handlers: {
|
|
|
80
80
|
session: {
|
|
81
81
|
note: (message: string) => Effect.Effect<void, never, never>;
|
|
82
82
|
};
|
|
83
|
-
}) => Effect.Effect<NetworkAttributes, import("@distilled.cloud/caddy").BadGateway | import("@distilled.cloud/caddy").BadRequest | import("@distilled.cloud/caddy").ConfigError | import("@distilled.cloud/caddy").Conflict | import("@distilled.cloud/caddy").Forbidden | import("@distilled.cloud/caddy").GatewayTimeout | import("effect/http/HttpClientError").HttpClientError | import("@distilled.cloud/caddy").InternalServerError | import("@distilled.cloud/caddy").NotFound | import("@distilled.cloud/caddy").ServiceUnavailable | import("@distilled.cloud/caddy").TooManyRequests | import("@distilled.cloud/caddy").Unauthorized | import("./policy.ts").UnifiFieldNotRemovable | import("./policy.ts").UnifiFieldNotSettable | import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiImmutableFieldChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | import("./policy.ts").UnifiManagementNetworkRefused | import("@distilled.cloud/unifi-network/Errors").UnifiNetworkParseError | import("./policy.ts").UnifiUpdateDidNotConverge | UnifiUpdateWouldBeNoop | import("./policy.ts").UnifiWriteRefused | import("@distilled.cloud/unifi-network/Errors").UnknownUnifiNetworkError | import("@distilled.cloud/caddy").UnprocessableEntity, import("effect/http/HttpClient").HttpClient>;
|
|
83
|
+
}) => Effect.Effect<NetworkAttributes, import("@distilled.cloud/caddy").BadGateway | import("@distilled.cloud/caddy").BadRequest | import("@distilled.cloud/caddy").ConfigError | import("@distilled.cloud/caddy").Conflict | import("@distilled.cloud/caddy").Forbidden | import("@distilled.cloud/caddy").GatewayTimeout | import("effect/http/HttpClientError").HttpClientError | import("@distilled.cloud/caddy").InternalServerError | import("@distilled.cloud/caddy").NotFound | import("@distilled.cloud/caddy").ServiceUnavailable | import("@distilled.cloud/caddy").TooManyRequests | import("@distilled.cloud/caddy").Unauthorized | import("./policy.ts").UnifiCreateDidNotConverge | import("./policy.ts").UnifiFieldNotRemovable | import("./policy.ts").UnifiFieldNotSettable | import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiImmutableFieldChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | import("./policy.ts").UnifiManagementNetworkRefused | import("@distilled.cloud/unifi-network/Errors").UnifiNetworkParseError | import("./policy.ts").UnifiUpdateDidNotConverge | UnifiUpdateWouldBeNoop | import("./policy.ts").UnifiWriteRefused | import("@distilled.cloud/unifi-network/Errors").UnknownUnifiNetworkError | import("@distilled.cloud/caddy").UnprocessableEntity, import("effect/http/HttpClient").HttpClient>;
|
|
84
84
|
delete: (args: {
|
|
85
85
|
olds: NetworkProps;
|
|
86
86
|
}) => Effect.Effect<never, import("./policy.ts").UnifiWriteRefused, import("effect/http/HttpClient").HttpClient>;
|
package/dist/unifi/policy.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import * as Effect from 'effect/Effect';
|
|
2
2
|
export declare const UNIFI_WRITE_POLICY: string;
|
|
3
|
+
/**
|
|
4
|
+
* ⛔ THE ONE GATE THAT DECIDES "hf:" (Tim 2026-10-19, `nas-firewall`'s own naming:
|
|
5
|
+
* `hf: CT100 to NAS https`). The space after the colon is deliberate and checked: `"hf:foo"`
|
|
6
|
+
* (no space) is NOT an hf: name under this policy, so a typo can never silently slip past the
|
|
7
|
+
* create gate by omitting it. Exported so `firewall-policy-create.ts`'s `checkScope` and every
|
|
8
|
+
* test that proves the boundary use this ONE function, never a second regex hand-copied nearby.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isHfPolicyName: (name: string) => boolean;
|
|
3
11
|
/** @deprecated renamed `UNIFI_WRITE_POLICY`; kept so existing consumer imports do not break. */
|
|
4
12
|
export declare const UNIFI_READ_ONLY_POLICY: string;
|
|
5
13
|
/** What kind of write was asked for and refused — for the message only, never acted on. */
|
|
@@ -50,6 +58,20 @@ export declare class UnifiUpdateDidNotConverge extends UnifiUpdateDidNotConverge
|
|
|
50
58
|
}> {
|
|
51
59
|
get message(): string;
|
|
52
60
|
}
|
|
61
|
+
declare const UnifiCreateDidNotConverge_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
62
|
+
readonly _tag: "UnifiCreateDidNotConverge";
|
|
63
|
+
} & Readonly<A>;
|
|
64
|
+
/** The POST answered, a read-back ran, yet the read-back object still differs from the
|
|
65
|
+
* declaration — the hf: create path's own convergence check (`create-reconcile.ts`'s sibling in
|
|
66
|
+
* `update-reconcile.ts`), same shape as `UnifiUpdateDidNotConverge` for the same reason: the
|
|
67
|
+
* object now exists on the console, unrolled-back, so the operator needs to know and re-import. */
|
|
68
|
+
export declare class UnifiCreateDidNotConverge extends UnifiCreateDidNotConverge_base<{
|
|
69
|
+
readonly type: string;
|
|
70
|
+
readonly identity: string;
|
|
71
|
+
readonly fields: ReadonlyArray<string>;
|
|
72
|
+
}> {
|
|
73
|
+
get message(): string;
|
|
74
|
+
}
|
|
53
75
|
declare const UnifiFieldNotRemovable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
54
76
|
readonly _tag: "UnifiFieldNotRemovable";
|
|
55
77
|
} & Readonly<A>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/unifi/policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/unifi/policy.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,kBAAkB,QAOmC,CA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AC;CACxC,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;;;;AAED,+FAA+F;AAC/F,qBAAa,oBAAqB,SAAQ,0BAAyC;IACjF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF"}
|
package/dist/unifi/resource.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Input } from 'alchemy/Input';
|
|
|
2
2
|
import type { UnifiNetworkOpContext } from '@distilled.cloud/unifi-network/Protocol';
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
4
|
import type * as HttpClient from 'effect/http/HttpClient';
|
|
5
|
-
import { type ReconcileArgs, type UnifiUpdate } from './update-reconcile.ts';
|
|
5
|
+
import { type ReconcileArgs, type UnifiCreate, type UnifiUpdate } from './update-reconcile.ts';
|
|
6
6
|
/** What every handler needs from the caller's runtime once `CredentialsFromEnv` is baked in. */
|
|
7
7
|
export type UnifiRequirements = HttpClient.HttpClient;
|
|
8
8
|
/**
|
|
@@ -11,7 +11,7 @@ export type UnifiRequirements = HttpClient.HttpClient;
|
|
|
11
11
|
* union, with `NotFound` already folded away) so the precise per-operation error union flows
|
|
12
12
|
* through instead of being widened by hand here. `E2` is the error union of the optional write.
|
|
13
13
|
*/
|
|
14
|
-
export type UnifiSpec<Props extends object, Live, Attributes extends object, E, E2 = never> = {
|
|
14
|
+
export type UnifiSpec<Props extends object, Live, Attributes extends object, E, E2 = never, E3 = never> = {
|
|
15
15
|
/** The vendor type string, e.g. `Unifi.Network` — for the refusal message only. */
|
|
16
16
|
readonly type: string;
|
|
17
17
|
/** Already folds a genuine not-found to `undefined`; nothing else is folded (see header). */
|
|
@@ -22,8 +22,11 @@ export type UnifiSpec<Props extends object, Live, Attributes extends object, E,
|
|
|
22
22
|
readonly describe: (props: Props) => string;
|
|
23
23
|
/** Present only on a family allowed to write (`Unifi.Network`); see `update-reconcile.ts`. */
|
|
24
24
|
readonly update?: UnifiUpdate<Props, Live, E2>;
|
|
25
|
+
/** Present only on a family allowed to create (`Unifi.FirewallPolicy`, `hf:` rows only); see
|
|
26
|
+
* `update-reconcile.ts`'s `createReconcile`. */
|
|
27
|
+
readonly create?: UnifiCreate<Props, Live, E3>;
|
|
25
28
|
};
|
|
26
|
-
export declare const unifiOperations: <Props extends object, Live, Attributes extends object, E, E2>(spec: UnifiSpec<Props, Live, Attributes, E, E2>) => {
|
|
29
|
+
export declare const unifiOperations: <Props extends object, Live, Attributes extends object, E, E2, E3>(spec: UnifiSpec<Props, Live, Attributes, E, E2, E3>) => {
|
|
27
30
|
read: (props: Props) => Effect.Effect<Attributes | undefined, E, UnifiNetworkOpContext>;
|
|
28
31
|
readHandler: ({ olds, output }: {
|
|
29
32
|
olds: Props;
|
|
@@ -34,8 +37,24 @@ export declare const unifiOperations: <Props extends object, Live, Attributes ex
|
|
|
34
37
|
} | {
|
|
35
38
|
readonly action: 'noop';
|
|
36
39
|
} | undefined, E, UnifiNetworkOpContext>;
|
|
37
|
-
/**
|
|
38
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Pre-state callers (tests, adopt-only probes) pass just `news`: `olds`/`output` unset — the
|
|
42
|
+
* SAME calling convention a plain cold adoption already uses (H6), so the existence GET must
|
|
43
|
+
* run FIRST, for every name, exactly as it always has: a row that already exists is adopted
|
|
44
|
+
* (exact match, zero writes) regardless of its name, and ONLY an absent row ever reaches
|
|
45
|
+
* `create.checkScope`. "A non-hf: create sends nothing" therefore means no WRITE (no
|
|
46
|
+
* POST/PUT/DELETE) — the same guarantee every other refusal in this engine gives, and the one
|
|
47
|
+
* `wire-guard.ts`'s allow list enforces at the wire; the existence GET is not a write.
|
|
48
|
+
*
|
|
49
|
+
* ⛔ THE CREATE BRANCH ONLY RUNS WHEN THERE IS NO PRIOR STATE AT ALL (`olds`/`output` both
|
|
50
|
+
* absent — a genuine first deploy, never a re-declare of an adopted row) AND the family
|
|
51
|
+
* declares `create` AND the live read comes back absent. A row that already exists (someone
|
|
52
|
+
* else's object with a colliding identity, or a retried deploy that already created it)
|
|
53
|
+
* takes the ordinary `updateReconcile` path instead — exact match reports with zero writes,
|
|
54
|
+
* anything else refuses (there is no `olds` to PUT a patch against, so it can never silently
|
|
55
|
+
* fall through to an update of an existing row).
|
|
56
|
+
*/
|
|
57
|
+
reconcile: (news: Props, rest?: Partial<Omit<ReconcileArgs<Props>, 'news'>>) => Effect.Effect<Attributes, E | E2 | E3 | import("./policy.ts").UnifiCreateDidNotConverge | import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | import("./policy.ts").UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused, UnifiNetworkOpContext>;
|
|
39
58
|
destroy: (olds: Props) => Effect.Effect<never, import("./policy.ts").UnifiWriteRefused, never>;
|
|
40
59
|
};
|
|
41
60
|
/**
|
|
@@ -44,7 +63,7 @@ export declare const unifiOperations: <Props extends object, Live, Attributes ex
|
|
|
44
63
|
* ⛔ `list` ANSWERS EMPTY. `GET /v1/sites/{siteId}/networks` answers every network on the site;
|
|
45
64
|
* adoption stays explicit, the same reasoning `Proxmox.User`'s and NetBox's `list` give.
|
|
46
65
|
*/
|
|
47
|
-
export declare const unifiHandlers: <Props extends object, Live, Attributes extends object, E, E2>(spec: UnifiSpec<Props, Live, Attributes, E, E2>) => {
|
|
66
|
+
export declare const unifiHandlers: <Props extends object, Live, Attributes extends object, E, E2, E3>(spec: UnifiSpec<Props, Live, Attributes, E, E2, E3>) => {
|
|
48
67
|
list: () => Effect.Effect<never[], never, never>;
|
|
49
68
|
read: (args: {
|
|
50
69
|
olds: Props;
|
|
@@ -65,7 +84,7 @@ export declare const unifiHandlers: <Props extends object, Live, Attributes exte
|
|
|
65
84
|
session: {
|
|
66
85
|
note: (message: string) => Effect.Effect<void, never, never>;
|
|
67
86
|
};
|
|
68
|
-
}) => Effect.Effect<Attributes, E | E2 | import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | import("./policy.ts").UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused, HttpClient.HttpClient>;
|
|
87
|
+
}) => Effect.Effect<Attributes, E | E2 | E3 | import("./policy.ts").UnifiCreateDidNotConverge | import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | import("./policy.ts").UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused, HttpClient.HttpClient>;
|
|
69
88
|
delete: (args: {
|
|
70
89
|
olds: Props;
|
|
71
90
|
}) => Effect.Effect<never, import("./policy.ts").UnifiWriteRefused, HttpClient.HttpClient>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/unifi/resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/unifi/resource.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EAGjB,MAAM,uBAAuB,CAAC;AAG/B,gGAAgG;AAChG,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,CACnB,KAAK,SAAS,MAAM,EACpB,IAAI,EACJ,UAAU,SAAS,MAAM,EACzB,CAAC,EACD,EAAE,GAAG,KAAK,EACV,EAAE,GAAG,KAAK,IACR;IACF,mFAAmF;I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C;oBAc1D,KAAK;CAExB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,SAAS,MAAM,EAAE,IAAI,EAAE,UAAU,SAAS,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,QACtF,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;IAejD,IAAI;IACJ,IAAI,SAAS;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAA;KAAE;IAE5D,IAAI,SAAS;QAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAA;KAAE;yBAlEtB,QAAQ;;yBAElC,MAAM;;IAmEzB,SAAS,SAAS;QAChB,IAAI,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC;QACxB,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;QAC/B,OAAO,EAAE;YAAE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;SAAE,CAAC;KAC3E;IAqBD,MAAM,SAAS;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE;CAEjC,CAAC"}
|
|
@@ -47,7 +47,7 @@ export declare const handlers: {
|
|
|
47
47
|
session: {
|
|
48
48
|
note: (message: string) => Effect.Effect<void, never, never>;
|
|
49
49
|
};
|
|
50
|
-
}) => Effect.Effect<TrafficMatchingListAttributes, import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | import("./policy.ts").UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused | trafficMatchingLists.UnifiNetworkOpError, import("effect/http/HttpClient").HttpClient>;
|
|
50
|
+
}) => Effect.Effect<TrafficMatchingListAttributes, import("./policy.ts").UnifiCreateDidNotConverge | import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | import("./policy.ts").UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused | trafficMatchingLists.UnifiNetworkOpError, import("effect/http/HttpClient").HttpClient>;
|
|
51
51
|
delete: (args: {
|
|
52
52
|
olds: TrafficMatchingListProps;
|
|
53
53
|
}) => Effect.Effect<never, import("./policy.ts").UnifiWriteRefused, import("effect/http/HttpClient").HttpClient>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UnifiNetworkOpContext } from '@distilled.cloud/unifi-network/Protocol';
|
|
2
2
|
import * as Effect from 'effect/Effect';
|
|
3
3
|
import type { FieldDrift } from './drift.ts';
|
|
4
|
-
import { UnifiIdentityChanged, UnifiLiveDriftedSinceDeploy, UnifiUpdateDidNotConverge } from './policy.ts';
|
|
4
|
+
import { UnifiCreateDidNotConverge, UnifiIdentityChanged, UnifiLiveDriftedSinceDeploy, UnifiUpdateDidNotConverge } from './policy.ts';
|
|
5
5
|
import type { UnifiSpec } from './resource.ts';
|
|
6
6
|
import type { AllowedWrite } from './wire-guard.ts';
|
|
7
7
|
export type Patch<Props> = {
|
|
@@ -27,5 +27,39 @@ export type ReconcileArgs<Props extends object> = {
|
|
|
27
27
|
readonly output: unknown;
|
|
28
28
|
readonly note: (message: string) => Effect.Effect<void>;
|
|
29
29
|
};
|
|
30
|
-
export declare const updateReconcile: <Props extends object, Live, Attributes extends object, E, E2>(spec: UnifiSpec<Props, Live, Attributes, E, E2>, { news, olds, output, note }: ReconcileArgs<Props>) => Effect.Effect<Attributes, E | E2 | UnifiIdentityChanged | UnifiLiveDriftedSinceDeploy | UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused, UnifiNetworkOpContext>;
|
|
30
|
+
export declare const updateReconcile: <Props extends object, Live, Attributes extends object, E, E2, E3>(spec: UnifiSpec<Props, Live, Attributes, E, E2, E3>, { news, olds, output, note }: ReconcileArgs<Props>) => Effect.Effect<Attributes, E | E2 | UnifiIdentityChanged | UnifiLiveDriftedSinceDeploy | UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused, UnifiNetworkOpContext>;
|
|
31
|
+
/**
|
|
32
|
+
* The write half of a CREATE-capable family: today, only `Unifi.FirewallPolicy`, and only for an
|
|
33
|
+
* `hf:`-named row (`policy.ts`'s `isHfPolicyName`). Deliberately NOT a merge-with-live update —
|
|
34
|
+
* there is no live object yet — so there is no `patchKeys`/`checkScope(live, patch, …)` here: a
|
|
35
|
+
* create sends exactly the fields the declaration owns, nothing echoed from elsewhere, nothing to
|
|
36
|
+
* accidentally reset.
|
|
37
|
+
*
|
|
38
|
+
* ⛔ `checkScope` RUNS BEFORE THE POST (same ordering `update.checkScope` already has): a
|
|
39
|
+
* non-`hf:` name is refused here, typed, never reaching the wire at all.
|
|
40
|
+
* ★ `identify` CLOSES THE LOOP FROM THE POST'S RESPONSE TO A FRESH GET. The vendor assigns the id
|
|
41
|
+
* on create; `write`'s response carries it, but a response body is not proof the object is
|
|
42
|
+
* actually readable back (`createReconcile` re-fetches with the id `identify` folds in, rather
|
|
43
|
+
* than trusting the POST's own echo — same reasoning `network-update.ts`'s header gives for
|
|
44
|
+
* never trusting a write's own response over a real read).
|
|
45
|
+
*/
|
|
46
|
+
export type UnifiCreate<Props extends object, Live, E3> = {
|
|
47
|
+
/** The one POST the wire guard may pass for this family (the site's fixed collection route,
|
|
48
|
+
* built from `props` the same way `UnifiUpdate.allowedWrite` reads a row's ids from `props`). */
|
|
49
|
+
readonly allowedWrite: (props: Props) => AllowedWrite;
|
|
50
|
+
/** Refuses (typed, before any note or request) a create outside this family's write scope. */
|
|
51
|
+
readonly checkScope: (props: Props) => Effect.Effect<void, E3>;
|
|
52
|
+
readonly write: (props: Props) => Effect.Effect<Live, E3, UnifiNetworkOpContext>;
|
|
53
|
+
/** `props` plus the vendor id the POST's response assigned, for the read-back `fetchLive`. */
|
|
54
|
+
readonly identify: (props: Props, written: Live) => Props;
|
|
55
|
+
readonly driftOf: (live: Live, props: Props) => ReadonlyArray<FieldDrift>;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* CREATE for a family whose live read came back absent AND which has no prior Alchemy state
|
|
59
|
+
* (`resource.ts`'s `unifiOperations.reconcile` is the only caller, and only under that same
|
|
60
|
+
* condition — see its own header). Refuses (untyped-to-typed, same `refuseWrite` every other
|
|
61
|
+
* refusal uses) when the family declares no `create` at all; `create.checkScope` then refuses
|
|
62
|
+
* again, more specifically, for a declared row the create scope itself does not allow.
|
|
63
|
+
*/
|
|
64
|
+
export declare const createReconcile: <Props extends object, Live, Attributes extends object, E, E2, E3>(spec: UnifiSpec<Props, Live, Attributes, E, E2, E3>, news: Props, note: (message: string) => Effect.Effect<void, never, never>) => Effect.Effect<Attributes, E | E3 | UnifiCreateDidNotConverge | import("./policy.ts").UnifiWriteRefused, UnifiNetworkOpContext>;
|
|
31
65
|
//# sourceMappingURL=update-reconcile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-reconcile.d.ts","sourceRoot":"","sources":["../../src/unifi/update-reconcile.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EAE1B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,MAAM,KAAK,CAAC,KAAK,IAAI;IAAE,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAAC,KAAK,EAAE,aAAa,CAAC,MAAM,KAAK,CA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ACtD,8FAA8F;IAC9F,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC/D,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,qBAAqB,CAAC,CAAC;IACjF,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,KAAK,KAAK,CAAC;IAC1D,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,aAAa,CAAC,UAAU,CAAC,CAAC;CAC3E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,SAAS,MAAM,EAAE,IAAI,EAAE,UAAU,SAAS,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,QACxF,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,QAC7C,KAAK,QACL,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,mIA8B1D,CAAC"}
|
|
@@ -69,7 +69,7 @@ export declare const handlers: {
|
|
|
69
69
|
session: {
|
|
70
70
|
note: (message: string) => Effect.Effect<void, never, never>;
|
|
71
71
|
};
|
|
72
|
-
}) => Effect.Effect<WifiBroadcastAttributes, import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | UnifiPaginationInconsistent | import("./policy.ts").UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused | wifiBroadcasts.UnifiNetworkOpError, import("effect/http/HttpClient").HttpClient>;
|
|
72
|
+
}) => Effect.Effect<WifiBroadcastAttributes, import("./policy.ts").UnifiCreateDidNotConverge | import("./policy.ts").UnifiIdentityChanged | import("./policy.ts").UnifiLiveDriftedSinceDeploy | UnifiPaginationInconsistent | import("./policy.ts").UnifiUpdateDidNotConverge | import("./policy.ts").UnifiWriteRefused | wifiBroadcasts.UnifiNetworkOpError, import("effect/http/HttpClient").HttpClient>;
|
|
73
73
|
delete: (args: {
|
|
74
74
|
olds: WifiBroadcastProps;
|
|
75
75
|
}) => Effect.Effect<never, import("./policy.ts").UnifiWriteRefused, import("effect/http/HttpClient").HttpClient>;
|
|
@@ -5,7 +5,7 @@ import * as HttpClient from 'effect/http/HttpClient';
|
|
|
5
5
|
* `baseUrl + tail` and requires an empty query and fragment (`isAllowed`).
|
|
6
6
|
*/
|
|
7
7
|
export type AllowedWrite = {
|
|
8
|
-
readonly method: 'PUT';
|
|
8
|
+
readonly method: 'PUT' | 'POST';
|
|
9
9
|
readonly tail: string;
|
|
10
10
|
};
|
|
11
11
|
export declare class UnifiRefusedRequest extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-guard.d.ts","sourceRoot":"","sources":["../../src/unifi/wire-guard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wire-guard.d.ts","sourceRoot":"","sources":["../../src/unifi/wire-guard.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAKrD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtF,qBAAa,mBAAoB,SAAQ,KAAK;IAE1C,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM;IAHvB,YACW,MAAM,EAAE,MAAM;IACvB,+DAA+D;IACtD,IAAI,EAAE,MAAM,EACrB,MAAM,SAAiC,EASxC;CACF;AAED,iGAAiG;AACjG,eAAO,MAAM,kBAAkB,4BAAsB,CAAC;AACtD,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AA0FrD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAW,aAAa,CAAC,YAAY,CAAC,YAAY,MAAM,sFASrF,CAAC;AAkBF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,mFAAwB,CAAC"}
|
|
@@ -122,8 +122,10 @@ Two checks, both real, neither skippable:
|
|
|
122
122
|
No special-casing: add a changeset (`bun changeset`, minor — new package),
|
|
123
123
|
push, merge. `scripts/publish.ts` packs with `bun pm pack` (resolves
|
|
124
124
|
`workspace:`/`catalog:` the way `npm pack` cannot) and publishes with `npm
|
|
125
|
-
publish --provenance` from CI. `README.md`/`LICENSE
|
|
126
|
-
|
|
125
|
+
publish --provenance` from CI. `README.md`/`LICENSE` ship in `files`;
|
|
126
|
+
`scripts/smoke.ts` is outside `files` so it never packs — `scripts/pack.ts`
|
|
127
|
+
additionally strips the `scripts`/`devDependencies` manifest fields at pack
|
|
128
|
+
time. Nothing about the release pipeline needs to know this package is
|
|
127
129
|
an interim stand-in.
|
|
128
130
|
|
|
129
131
|
### 5. Alias it in, then cut over later
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homeflare/alchemy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "Custom Alchemy providers for Cloudflare, Proxmox, OpenBao, Forgejo, Talos, launchd and Caddy, and a verifier that proves adoptions are no-ops.",
|
|
5
5
|
"homepage": "https://github.com/taslabs-net/homeflare-kit/tree/main/packages/alchemy#readme",
|
|
6
6
|
"bugs": "https://github.com/taslabs-net/homeflare-kit/issues",
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Unifi.FirewallPolicy`'s CREATE — the one write this family may make, and only for a row whose
|
|
3
|
+
* declared `name` passes `policy.ts`'s `isHfPolicyName` (Tim 2026-10-19 ~16:20Z, "Allow kit to
|
|
4
|
+
* create hf: rules"). THE ONLY FILE UNDER `src/unifi` ALLOWED TO NAME `createFirewallPolicy`
|
|
5
|
+
* (`write-op-reference.test.ts`'s `WRITE_OP_ALLOWLIST` pins that, alongside `network-update.ts`'s
|
|
6
|
+
* own `updateNetwork` entry).
|
|
7
|
+
*
|
|
8
|
+
* ⛔ A CREATE SENDS ONLY THE FIELDS THE DECLARATION OWNS — NEVER A SPREAD OF ANYTHING ELSE. Unlike
|
|
9
|
+
* `network-update.ts`'s whole-object PUT (which must carry the untouched live object forward so
|
|
10
|
+
* an omitted optional block is not read by the controller as "turn it off"), there IS no live
|
|
11
|
+
* object yet: `createBody` builds `CreateFirewallPolicyRequest` field by field from `props`,
|
|
12
|
+
* omitting every optional key `props` itself leaves `undefined` rather than sending it as
|
|
13
|
+
* `null`/`undefined` (UniFi's "missing = off" rule cuts both ways — a key that is actually absent
|
|
14
|
+
* from the JSON body is what "this policy does not restrict on this axis" means here, same as a
|
|
15
|
+
* declaration that never sets `connectionStateFilter` means "match every connection state").
|
|
16
|
+
* ⛔ `checkScope` RUNS BEFORE THE REQUEST, TYPED, NEVER A STRING COMPARISON INLINE AT THE CALL
|
|
17
|
+
* SITE — one function (`policy.ts`'s `isHfPolicyName`) decides "hf:" everywhere this boundary is
|
|
18
|
+
* checked, so a future second caller cannot drift from this one with a slightly different regex.
|
|
19
|
+
*
|
|
20
|
+
* 🔴 `checkScope` ALSO REFUSES A `firewallPolicyId` THAT IS ALREADY SET (Opus red team,
|
|
21
|
+
* 2026-10-19, PRIMARY FINDING). `resource.ts`'s `create` branch runs for EVERY
|
|
22
|
+
* `Unifi.FirewallPolicy` declaration with no prior Alchemy state, not only ones meant to
|
|
23
|
+
* create — including every `firewallPolicy()` import `.pipe(adopt(true))`, and Tim's own live
|
|
24
|
+
* console ALREADY names hand-made rules `hf: <desc>` (this file's sibling `policy.ts` cites
|
|
25
|
+
* `hf: Vpn to MGMT (Magic WAN site-to-site)` as the existing convention). Before this check, an
|
|
26
|
+
* hf:-named IMPORTED row whose `firewallPolicyId` stopped resolving (state lost, the rule
|
|
27
|
+
* hand-deleted and recreated with a new id, a wrong id in a generated declaration) would GET
|
|
28
|
+
* 404, fall into `createReconcile`, pass the name check, and POST A DUPLICATE — silently, with
|
|
29
|
+
* a green plan, where every other family still refuses "declared row absent" outright
|
|
30
|
+
* (`update-reconcile.ts`'s original behavior, unchanged for every family but this one). A
|
|
31
|
+
* declaration carrying a vendor id is BY DEFINITION an existing row, adopted or updated, never
|
|
32
|
+
* a fresh create; `firewallPolicyId !== undefined` is refused here before `isHfPolicyName` is
|
|
33
|
+
* even checked, so this holds regardless of what the name says.
|
|
34
|
+
*/
|
|
35
|
+
import * as firewall from '@distilled.cloud/unifi-network/firewall';
|
|
36
|
+
import * as Effect from 'effect/Effect';
|
|
37
|
+
import { isHfPolicyName, refuseWrite } from './policy.ts';
|
|
38
|
+
import type { FirewallPolicyProps } from './firewall-policy-form.ts';
|
|
39
|
+
import type { AllowedWrite } from './wire-guard.ts';
|
|
40
|
+
|
|
41
|
+
/** The site's fixed firewall-policies COLLECTION route — never a per-row path, since there is no
|
|
42
|
+
* row id before this POST creates one. Takes `props` (not just a bare `siteId`) to match
|
|
43
|
+
* `UnifiUpdate.allowedWrite`'s own shape, so `resource.ts`'s wiring treats both the same way. */
|
|
44
|
+
export const firewallPolicyCreateAllowedWrite = (props: FirewallPolicyProps): AllowedWrite => ({
|
|
45
|
+
method: 'POST',
|
|
46
|
+
tail: `/v1/sites/${props.siteId}/firewall/policies`,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const describeByName = (props: FirewallPolicyProps) =>
|
|
50
|
+
`sites/${props.siteId}/firewall/policies/by-name/${props.name}`;
|
|
51
|
+
|
|
52
|
+
/** Refuses, typed, before any request: the one gate `createReconcile` calls before `write`.
|
|
53
|
+
* Order matters for the message only (both refuse the same way) — the identity check runs
|
|
54
|
+
* first because it is the one that must hold regardless of what the name says (see header). */
|
|
55
|
+
export const checkHfCreateScope = (props: FirewallPolicyProps) => {
|
|
56
|
+
if (props.firewallPolicyId !== undefined) {
|
|
57
|
+
return refuseWrite(
|
|
58
|
+
'Unifi.FirewallPolicy',
|
|
59
|
+
`sites/${props.siteId}/firewall/policies/${props.firewallPolicyId}`,
|
|
60
|
+
'create',
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return isHfPolicyName(props.name)
|
|
64
|
+
? Effect.void
|
|
65
|
+
: refuseWrite('Unifi.FirewallPolicy', describeByName(props), 'create');
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Every field `CreateFirewallPolicyRequest` accepts, straight from the declaration, with an
|
|
69
|
+
* absent optional field left OUT of the body entirely (never sent as `undefined`/`null`) —
|
|
70
|
+
* `JSON.stringify` already drops an `undefined` value, but building the object field-by-field
|
|
71
|
+
* rather than spreading `props` keeps this list the single place that enumerates exactly what a
|
|
72
|
+
* create may send, so a future prop added to `FirewallPolicyProps` for some OTHER purpose cannot
|
|
73
|
+
* silently become a wire field here without this file changing too. */
|
|
74
|
+
export const firewallPolicyCreateBody = (
|
|
75
|
+
props: FirewallPolicyProps,
|
|
76
|
+
): firewall.CreateFirewallPolicyRequest => ({
|
|
77
|
+
siteId: props.siteId,
|
|
78
|
+
action: props.action,
|
|
79
|
+
...(props.connectionStateFilter === undefined
|
|
80
|
+
? {}
|
|
81
|
+
: { connectionStateFilter: props.connectionStateFilter }),
|
|
82
|
+
...(props.description === undefined ? {} : { description: props.description }),
|
|
83
|
+
destination: props.destination,
|
|
84
|
+
enabled: props.enabled,
|
|
85
|
+
ipProtocolScope: props.ipProtocolScope,
|
|
86
|
+
...(props.ipsecFilter === undefined ? {} : { ipsecFilter: props.ipsecFilter }),
|
|
87
|
+
loggingEnabled: props.loggingEnabled,
|
|
88
|
+
name: props.name,
|
|
89
|
+
...(props.schedule === undefined ? {} : { schedule: props.schedule }),
|
|
90
|
+
source: props.source,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export const writeFirewallPolicyCreate = (props: FirewallPolicyProps) =>
|
|
94
|
+
firewall.createFirewallPolicy(firewallPolicyCreateBody(props));
|
|
@@ -55,10 +55,17 @@ export const normalizeConnectionStateFilter = (
|
|
|
55
55
|
): string[] | undefined => (value == null ? undefined : sortedSet(value));
|
|
56
56
|
|
|
57
57
|
/** ⚠️ EVERY OPTIONAL FIELD SPELLS OUT `| undefined` — `exactOptionalPropertyTypes`; see
|
|
58
|
-
* `network-form.ts`'s own header.
|
|
58
|
+
* `network-form.ts`'s own header.
|
|
59
|
+
*
|
|
60
|
+
* ⛔ `firewallPolicyId` IS OPTIONAL SINCE THE 2026-10-19 hf: CREATE LIFT. An adopt-only
|
|
61
|
+
* declaration (`declareFirewallPolicy`, every imported row) always carries the vendor id it was
|
|
62
|
+
* read from. A fresh `hf:` creatable declaration (`declareHfFirewallPolicy` below) does not have
|
|
63
|
+
* one yet — the vendor assigns it on `createFirewallPolicy`'s response — so `spec.fetchLive`
|
|
64
|
+
* (`firewall-policy.ts`) locates by `name` instead of `id` whenever this is absent (netbox's
|
|
65
|
+
* `locateOne` is the precedent for identity-by-natural-key over identity-by-vendor-id). */
|
|
59
66
|
export interface FirewallPolicyProps {
|
|
60
67
|
siteId: string;
|
|
61
|
-
firewallPolicyId
|
|
68
|
+
firewallPolicyId?: string | undefined;
|
|
62
69
|
action: firewall.FirewallPolicyAction;
|
|
63
70
|
/** Connection states this policy matches — compared as a SET, see the header. */
|
|
64
71
|
connectionStateFilter?: string[] | undefined;
|
|
@@ -23,7 +23,13 @@ import * as Effect from 'effect/Effect';
|
|
|
23
23
|
import { fakeFailure, fakeUnifi, fakeUnifiLayer } from './fake-unifi.ts';
|
|
24
24
|
import { attributesOf } from './firewall-policy-form.ts';
|
|
25
25
|
import { driftOf, matches } from './firewall-policy-drift.ts';
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
type FirewallPolicyProps,
|
|
28
|
+
declareFirewallPolicy,
|
|
29
|
+
hfFirewallPolicy,
|
|
30
|
+
spec,
|
|
31
|
+
} from './firewall-policy.ts';
|
|
32
|
+
import { UnifiCreateDidNotConverge, UnifiWriteRefused } from './policy.ts';
|
|
27
33
|
import { pageAll } from './paginate.ts';
|
|
28
34
|
import { unifiOperations } from './resource.ts';
|
|
29
35
|
|
|
@@ -152,6 +158,187 @@ describe('Unifi.FirewallPolicy write paths never reach the vendor API', () => {
|
|
|
152
158
|
});
|
|
153
159
|
});
|
|
154
160
|
|
|
161
|
+
/**
|
|
162
|
+
* The hf: create lift (Tim 2026-10-19 ~16:20Z) -- the one write `Unifi.FirewallPolicy` may now
|
|
163
|
+
* make, and only for a declared `name` starting `hf: `. Mirrors the write-refusal tests above,
|
|
164
|
+
* plus the one path that now DOES reach the vendor API.
|
|
165
|
+
*/
|
|
166
|
+
const POLICIES_PATH = '/proxy/network/integration/v1/sites/site-1/firewall/policies';
|
|
167
|
+
const NEW_ID = 'hf-new-1';
|
|
168
|
+
|
|
169
|
+
const emptyPage = () => Response.json({ count: 0, data: [], limit: 0, offset: 0, totalCount: 0 });
|
|
170
|
+
|
|
171
|
+
/** No `firewallPolicyId`: the shape `hfFirewallPolicy` declares before anything is created. */
|
|
172
|
+
const HF_PROPS: FirewallPolicyProps = {
|
|
173
|
+
siteId: 'site-1',
|
|
174
|
+
action: { type: 'ALLOW', allowReturnTraffic: true },
|
|
175
|
+
destination: { zoneId: 'zone-storage' },
|
|
176
|
+
enabled: true,
|
|
177
|
+
ipProtocolScope: { ipVersion: 'IPV4' },
|
|
178
|
+
loggingEnabled: true,
|
|
179
|
+
name: 'hf: CT100 to NAS https',
|
|
180
|
+
source: { zoneId: 'zone-internal' },
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
describe('Unifi.FirewallPolicy hf: create', () => {
|
|
184
|
+
const ops = unifiOperations(spec);
|
|
185
|
+
|
|
186
|
+
test('an hf:-named create: one locate GET, one POST of only the declared fields, one read-back GET', async () => {
|
|
187
|
+
let createdLive: firewall.FirewallPolicy | undefined;
|
|
188
|
+
const fake = fakeUnifi((method, url) => {
|
|
189
|
+
if (url.pathname === POLICIES_PATH && method === 'GET') return emptyPage();
|
|
190
|
+
if (url.pathname === POLICIES_PATH && method === 'POST') {
|
|
191
|
+
createdLive = {
|
|
192
|
+
...HF_PROPS,
|
|
193
|
+
id: NEW_ID,
|
|
194
|
+
index: 0,
|
|
195
|
+
metadata: { origin: 'USER' },
|
|
196
|
+
} as firewall.FirewallPolicy;
|
|
197
|
+
return Response.json(createdLive);
|
|
198
|
+
}
|
|
199
|
+
if (url.pathname === `${POLICIES_PATH}/${NEW_ID}` && method === 'GET') {
|
|
200
|
+
return Response.json(createdLive);
|
|
201
|
+
}
|
|
202
|
+
return fakeFailure(400, 'unexpected request');
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const attrs = await Effect.runPromise(
|
|
206
|
+
ops.reconcile(HF_PROPS).pipe(Effect.provide(fakeUnifiLayer(fake.fetch))),
|
|
207
|
+
);
|
|
208
|
+
expect(attrs.firewallPolicyId).toBe(NEW_ID);
|
|
209
|
+
expect(attrs.name).toBe('hf: CT100 to NAS https');
|
|
210
|
+
expect(fake.seen.map((s) => `${s.method} ${s.path}`)).toEqual([
|
|
211
|
+
`GET ${POLICIES_PATH}?offset=0`,
|
|
212
|
+
`POST ${POLICIES_PATH}`,
|
|
213
|
+
`GET ${POLICIES_PATH}/${NEW_ID}`,
|
|
214
|
+
]);
|
|
215
|
+
// ⛔ ONLY the declared fields -- no firewallPolicyId (there was none), no stray key.
|
|
216
|
+
// `siteId` is a path label (`T.Http`'s `uri: "/v1/sites/{siteId}/..."`), not a body field.
|
|
217
|
+
expect(fake.seen[1]?.body).toEqual({
|
|
218
|
+
action: { type: 'ALLOW', allowReturnTraffic: true },
|
|
219
|
+
destination: { zoneId: 'zone-storage' },
|
|
220
|
+
enabled: true,
|
|
221
|
+
ipProtocolScope: { ipVersion: 'IPV4' },
|
|
222
|
+
loggingEnabled: true,
|
|
223
|
+
name: 'hf: CT100 to NAS https',
|
|
224
|
+
source: { zoneId: 'zone-internal' },
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
test('a non-hf: name refuses create, typed, sending the existence GET but no write', async () => {
|
|
229
|
+
// ★ The existence GET (does a row this name already matches exist?) runs for every name --
|
|
230
|
+
// the SAME GET a plain cold adoption needs (H6) -- and answers empty here. Only the WRITE
|
|
231
|
+
// is refused: `fake.seen.every(GET)` is this file's own standing idiom for that proof.
|
|
232
|
+
const fake = fakeUnifi((method, url) =>
|
|
233
|
+
method === 'GET' && url.pathname === POLICIES_PATH
|
|
234
|
+
? emptyPage()
|
|
235
|
+
: fakeFailure(400, 'unexpected request'),
|
|
236
|
+
);
|
|
237
|
+
const notHf: FirewallPolicyProps = { ...HF_PROPS, name: 'Not hf-named' };
|
|
238
|
+
const failure = await Effect.runPromise(
|
|
239
|
+
Effect.flip(ops.reconcile(notHf).pipe(Effect.provide(fakeUnifiLayer(fake.fetch)))),
|
|
240
|
+
);
|
|
241
|
+
expect(failure).toBeInstanceOf(UnifiWriteRefused);
|
|
242
|
+
expect((failure as UnifiWriteRefused).action).toBe('create');
|
|
243
|
+
expect(fake.seen.every((s) => s.method === 'GET')).toBe(true);
|
|
244
|
+
expect(fake.seen.length).toBeGreaterThan(0);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
test('"hf:foo" with no space after the colon is NOT an hf: name -- refused, no write', async () => {
|
|
248
|
+
const fake = fakeUnifi((method, url) =>
|
|
249
|
+
method === 'GET' && url.pathname === POLICIES_PATH
|
|
250
|
+
? emptyPage()
|
|
251
|
+
: fakeFailure(400, 'unexpected request'),
|
|
252
|
+
);
|
|
253
|
+
const noSpace: FirewallPolicyProps = { ...HF_PROPS, name: 'hf:no-space' };
|
|
254
|
+
const failure = await Effect.runPromise(
|
|
255
|
+
Effect.flip(ops.reconcile(noSpace).pipe(Effect.provide(fakeUnifiLayer(fake.fetch)))),
|
|
256
|
+
);
|
|
257
|
+
expect(failure).toBeInstanceOf(UnifiWriteRefused);
|
|
258
|
+
expect(fake.seen.every((s) => s.method === 'GET')).toBe(true);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
test('a read-back mismatch after the POST fails typed (UnifiCreateDidNotConverge), not silently', async () => {
|
|
262
|
+
const fake = fakeUnifi((method, url) => {
|
|
263
|
+
if (url.pathname === POLICIES_PATH && method === 'GET') return emptyPage();
|
|
264
|
+
if (url.pathname === POLICIES_PATH && method === 'POST') {
|
|
265
|
+
return Response.json({ ...HF_PROPS, id: NEW_ID, index: 0, metadata: { origin: 'USER' } });
|
|
266
|
+
}
|
|
267
|
+
if (url.pathname === `${POLICIES_PATH}/${NEW_ID}` && method === 'GET') {
|
|
268
|
+
// The read-back disagrees with what was declared (e.g. the console normalized `enabled`).
|
|
269
|
+
return Response.json({
|
|
270
|
+
...HF_PROPS,
|
|
271
|
+
id: NEW_ID,
|
|
272
|
+
index: 0,
|
|
273
|
+
metadata: { origin: 'USER' },
|
|
274
|
+
enabled: false,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
return fakeFailure(400, 'unexpected request');
|
|
278
|
+
});
|
|
279
|
+
const failure = await Effect.runPromise(
|
|
280
|
+
Effect.flip(ops.reconcile(HF_PROPS).pipe(Effect.provide(fakeUnifiLayer(fake.fetch)))),
|
|
281
|
+
);
|
|
282
|
+
expect(failure).toBeInstanceOf(UnifiCreateDidNotConverge);
|
|
283
|
+
expect((failure as UnifiCreateDidNotConverge).fields).toEqual(['enabled']);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
test('an hf:-named row with an id that 404s refuses -- never silently creates a duplicate (Opus red team)', async () => {
|
|
287
|
+
// ★ THE SCENARIO THE RED TEAM FOUND: an hf:-named row that ALREADY has Alchemy state's
|
|
288
|
+
// `firewallPolicyId` but whose live object is gone (state lost and rebuilt with no `olds`/
|
|
289
|
+
// `output`, a hand-deleted-and-recreated rule, a wrong id in a generated declaration) must
|
|
290
|
+
// still refuse "create" -- not fall through and POST a second copy just because the name
|
|
291
|
+
// happens to start `hf: ` (Tim's own hand-made console rules already do).
|
|
292
|
+
const hfWithId: FirewallPolicyProps = { ...HF_PROPS, firewallPolicyId: 'fp-gone' };
|
|
293
|
+
const fake = fakeUnifi((method, url) =>
|
|
294
|
+
method === 'GET' && url.pathname === `${POLICIES_PATH}/fp-gone`
|
|
295
|
+
? fakeFailure(404, 'not found')
|
|
296
|
+
: fakeFailure(400, 'unexpected request'),
|
|
297
|
+
);
|
|
298
|
+
const failure = await Effect.runPromise(
|
|
299
|
+
Effect.flip(ops.reconcile(hfWithId).pipe(Effect.provide(fakeUnifiLayer(fake.fetch)))),
|
|
300
|
+
);
|
|
301
|
+
expect(failure).toBeInstanceOf(UnifiWriteRefused);
|
|
302
|
+
expect((failure as UnifiWriteRefused).action).toBe('create');
|
|
303
|
+
expect(fake.seen.every((s) => s.method === 'GET')).toBe(true);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
test('hfFirewallPolicy throws immediately when props already carries a firewallPolicyId', () => {
|
|
307
|
+
const withId = { ...HF_PROPS, firewallPolicyId: 'fp-1' };
|
|
308
|
+
expect(() => hfFirewallPolicy('bad', withId)).toThrow(/already carries a firewallPolicyId/);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
test('update (drift) of an existing hf: row still refuses -- the lift is create only', async () => {
|
|
312
|
+
const hfWithId: FirewallPolicyProps = { ...HF_PROPS, firewallPolicyId: 'fp-hf-1' };
|
|
313
|
+
const fake = fakeUnifi((method, url) =>
|
|
314
|
+
method === 'GET' && url.pathname === `${POLICIES_PATH}/fp-hf-1`
|
|
315
|
+
? Response.json({
|
|
316
|
+
...HF_PROPS,
|
|
317
|
+
id: 'fp-hf-1',
|
|
318
|
+
index: 0,
|
|
319
|
+
metadata: { origin: 'USER' },
|
|
320
|
+
enabled: false,
|
|
321
|
+
})
|
|
322
|
+
: fakeFailure(400, 'unexpected request'),
|
|
323
|
+
);
|
|
324
|
+
const exit = await Effect.runPromiseExit(
|
|
325
|
+
ops.reconcile(hfWithId).pipe(Effect.provide(fakeUnifiLayer(fake.fetch))),
|
|
326
|
+
);
|
|
327
|
+
expect(exit._tag).toBe('Failure');
|
|
328
|
+
expect(fake.seen.every((s) => s.method === 'GET')).toBe(true);
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
test('delete of an hf: row still refuses -- no DELETE is ever sent', async () => {
|
|
332
|
+
const hfWithId: FirewallPolicyProps = { ...HF_PROPS, firewallPolicyId: 'fp-hf-1' };
|
|
333
|
+
const exit = await Effect.runPromiseExit(ops.destroy(hfWithId));
|
|
334
|
+
expect(exit._tag).toBe('Failure');
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
test('hfFirewallPolicy throws immediately for a name that is not hf:-prefixed', () => {
|
|
338
|
+
expect(() => hfFirewallPolicy('bad', { ...HF_PROPS, name: 'Not hf-named' })).toThrow(/hf: /);
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
|
|
155
342
|
describe("T9/B0b -- pageAll walks this family's own page shape (decode proof)", () => {
|
|
156
343
|
test('every row across several pages of getFirewallPolicies decodes, in order', async () => {
|
|
157
344
|
const rows = Array.from({ length: 7 }, (_, i) =>
|