@homeflare/distilled-opnsense 0.2.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.
Files changed (78) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +95 -0
  3. package/dist/credentials.d.ts +39 -0
  4. package/dist/credentials.d.ts.map +1 -0
  5. package/dist/credentials.js +78 -0
  6. package/dist/credentials.js.map +1 -0
  7. package/dist/errors.d.ts +110 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +63 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/index.d.ts +29 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +29 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/protocol.d.ts +13 -0
  16. package/dist/protocol.d.ts.map +1 -0
  17. package/dist/protocol.js +115 -0
  18. package/dist/protocol.js.map +1 -0
  19. package/dist/retry.d.ts +56 -0
  20. package/dist/retry.d.ts.map +1 -0
  21. package/dist/retry.js +49 -0
  22. package/dist/retry.js.map +1 -0
  23. package/dist/services/firewall_alias.d.ts +243 -0
  24. package/dist/services/firewall_alias.d.ts.map +1 -0
  25. package/dist/services/firewall_alias.js +222 -0
  26. package/dist/services/firewall_alias.js.map +1 -0
  27. package/dist/services/firewall_category.d.ts +122 -0
  28. package/dist/services/firewall_category.d.ts.map +1 -0
  29. package/dist/services/firewall_category.js +161 -0
  30. package/dist/services/firewall_category.js.map +1 -0
  31. package/dist/services/firewall_filter.d.ts +289 -0
  32. package/dist/services/firewall_filter.d.ts.map +1 -0
  33. package/dist/services/firewall_filter.js +225 -0
  34. package/dist/services/firewall_filter.js.map +1 -0
  35. package/dist/services/firewall_group.d.ts +122 -0
  36. package/dist/services/firewall_group.d.ts.map +1 -0
  37. package/dist/services/firewall_group.js +154 -0
  38. package/dist/services/firewall_group.js.map +1 -0
  39. package/dist/services/index.d.ts +9 -0
  40. package/dist/services/index.d.ts.map +1 -0
  41. package/dist/services/index.js +10 -0
  42. package/dist/services/index.js.map +1 -0
  43. package/dist/services/quagga_bgp.d.ts +1135 -0
  44. package/dist/services/quagga_bgp.d.ts.map +1 -0
  45. package/dist/services/quagga_bgp.js +1263 -0
  46. package/dist/services/quagga_bgp.js.map +1 -0
  47. package/dist/services/quagga_general.d.ts +55 -0
  48. package/dist/services/quagga_general.d.ts.map +1 -0
  49. package/dist/services/quagga_general.js +48 -0
  50. package/dist/services/quagga_general.js.map +1 -0
  51. package/dist/services/quagga_service.d.ts +60 -0
  52. package/dist/services/quagga_service.d.ts.map +1 -0
  53. package/dist/services/quagga_service.js +77 -0
  54. package/dist/services/quagga_service.js.map +1 -0
  55. package/dist/services/routing_settings.d.ts +192 -0
  56. package/dist/services/routing_settings.d.ts.map +1 -0
  57. package/dist/services/routing_settings.js +169 -0
  58. package/dist/services/routing_settings.js.map +1 -0
  59. package/dist/traits.d.ts +11 -0
  60. package/dist/traits.d.ts.map +1 -0
  61. package/dist/traits.js +11 -0
  62. package/dist/traits.js.map +1 -0
  63. package/package.json +75 -0
  64. package/src/credentials.ts +111 -0
  65. package/src/errors.ts +115 -0
  66. package/src/index.ts +32 -0
  67. package/src/protocol.ts +177 -0
  68. package/src/retry.ts +80 -0
  69. package/src/services/firewall_alias.ts +572 -0
  70. package/src/services/firewall_category.ts +359 -0
  71. package/src/services/firewall_filter.ts +671 -0
  72. package/src/services/firewall_group.ts +350 -0
  73. package/src/services/index.ts +9 -0
  74. package/src/services/quagga_bgp.ts +2955 -0
  75. package/src/services/quagga_general.ts +132 -0
  76. package/src/services/quagga_service.ts +182 -0
  77. package/src/services/routing_settings.ts +419 -0
  78. package/src/traits.ts +36 -0
@@ -0,0 +1,350 @@
1
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-opnsense). Do not edit.
2
+ import * as S from "@distilled.cloud/core/schema";
3
+ import * as API from "@distilled.cloud/core/api";
4
+ import * as T from "../traits.ts";
5
+ import {
6
+ OpnsenseProtocol,
7
+ type OpnsenseOpError,
8
+ type OpnsenseOpContext,
9
+ } from "../protocol.ts";
10
+ import * as Retry from "../retry.ts";
11
+
12
+ export type { OpnsenseOpError, OpnsenseOpContext };
13
+
14
+ export interface GroupItem {
15
+ /** Item id, assigned by OPNsense on creation. */
16
+ uuid?: string;
17
+ /** OPNsense FieldType: .\GroupNameField */
18
+ ifname: string;
19
+ /** OPNsense FieldType: .\InterfaceField; multi-select: wire value is a single comma-joined string, not a JSON array */
20
+ members: string;
21
+ /** OPNsense FieldType: BooleanField */
22
+ nogroup?: string;
23
+ /** OPNsense FieldType: IntegerField; range 0..9999 (as text) */
24
+ sequence: string;
25
+ /** OPNsense FieldType: DescriptionField */
26
+ descr?: string;
27
+ }
28
+ export const GroupItem = /*@__PURE__*/ S.suspend(() =>
29
+ S.Struct({
30
+ uuid: S.optional(S.String),
31
+ ifname: S.String,
32
+ members: S.String,
33
+ nogroup: S.optional(S.String),
34
+ sequence: S.String,
35
+ descr: S.optional(S.String),
36
+ }),
37
+ ).annotate({ identifier: "GroupItem" }) as any as S.Schema<GroupItem>;
38
+
39
+ export interface AddGroupRequest {
40
+ group?: GroupItem;
41
+ }
42
+ export const AddGroupRequest = /*@__PURE__*/ S.suspend(() =>
43
+ S.Struct({
44
+ group: S.optional(GroupItem),
45
+ }).pipe(
46
+ T.Http({ method: "POST", uri: "/api/firewall/group/addItem", code: 200 }),
47
+ ),
48
+ ).annotate({
49
+ identifier: "AddGroupRequest",
50
+ }) as any as S.Schema<AddGroupRequest>;
51
+
52
+ export type AddGroupResult = "saved";
53
+ export const AddGroupResult = S.String;
54
+
55
+ export interface AddGroupResponse {
56
+ result?: AddGroupResult;
57
+ /** The new item's uuid. */
58
+ uuid?: string;
59
+ }
60
+ export const AddGroupResponse = /*@__PURE__*/ S.suspend(() =>
61
+ S.Struct({
62
+ result: S.optional(AddGroupResult),
63
+ uuid: S.optional(S.String),
64
+ }),
65
+ ).annotate({
66
+ identifier: "AddGroupResponse",
67
+ }) as any as S.Schema<AddGroupResponse>;
68
+
69
+ export interface DelGroupRequest {
70
+ uuid: string;
71
+ }
72
+ export const DelGroupRequest = /*@__PURE__*/ S.suspend(() =>
73
+ S.Struct({
74
+ uuid: S.String.pipe(T.Label()),
75
+ }).pipe(
76
+ T.Http({
77
+ method: "POST",
78
+ uri: "/api/firewall/group/delItem/{uuid}",
79
+ code: 200,
80
+ }),
81
+ ),
82
+ ).annotate({
83
+ identifier: "DelGroupRequest",
84
+ }) as any as S.Schema<DelGroupRequest>;
85
+
86
+ export type DelGroupResult = "deleted" | "not found";
87
+ export const DelGroupResult = S.String;
88
+
89
+ export interface DelGroupResponse {
90
+ result?: DelGroupResult;
91
+ }
92
+ export const DelGroupResponse = /*@__PURE__*/ S.suspend(() =>
93
+ S.Struct({
94
+ result: S.optional(DelGroupResult),
95
+ }),
96
+ ).annotate({
97
+ identifier: "DelGroupResponse",
98
+ }) as any as S.Schema<DelGroupResponse>;
99
+
100
+ export interface GetRequest {}
101
+ export const GetRequest = /*@__PURE__*/ S.suspend(() =>
102
+ S.Struct({}).pipe(
103
+ T.Http({ method: "GET", uri: "/api/firewall/group/get", code: 200 }),
104
+ ),
105
+ ).annotate({ identifier: "GetRequest" }) as any as S.Schema<GetRequest>;
106
+
107
+ export type ModelIfgroupentryItem = GroupItem;
108
+ export const ModelIfgroupentryItem = GroupItem;
109
+
110
+ export type ModelIfgroupentryItemMap = { [key: string]: GroupItem | undefined };
111
+ export const ModelIfgroupentryItemMap = /*@__PURE__*/ S.Record(
112
+ S.String,
113
+ GroupItem,
114
+ ) as any as S.Schema<ModelIfgroupentryItemMap>;
115
+
116
+ export interface Model {
117
+ ifgroupentry?: ModelIfgroupentryItemMap;
118
+ }
119
+ export const Model = /*@__PURE__*/ S.suspend(() =>
120
+ S.Struct({
121
+ ifgroupentry: S.optional(ModelIfgroupentryItemMap),
122
+ }),
123
+ ).annotate({ identifier: "Model" }) as any as S.Schema<Model>;
124
+
125
+ export interface GetResponse {
126
+ group?: Model;
127
+ }
128
+ export const GetResponse = /*@__PURE__*/ S.suspend(() =>
129
+ S.Struct({
130
+ group: S.optional(Model),
131
+ }),
132
+ ).annotate({ identifier: "GetResponse" }) as any as S.Schema<GetResponse>;
133
+
134
+ export interface GetGroupRequest {}
135
+ export const GetGroupRequest = /*@__PURE__*/ S.suspend(() =>
136
+ S.Struct({}).pipe(
137
+ T.Http({ method: "GET", uri: "/api/firewall/group/getItem", code: 200 }),
138
+ ),
139
+ ).annotate({
140
+ identifier: "GetGroupRequest",
141
+ }) as any as S.Schema<GetGroupRequest>;
142
+
143
+ export interface GetGroupResponse {
144
+ group?: GroupItem;
145
+ }
146
+ export const GetGroupResponse = /*@__PURE__*/ S.suspend(() =>
147
+ S.Struct({
148
+ group: S.optional(GroupItem),
149
+ }),
150
+ ).annotate({
151
+ identifier: "GetGroupResponse",
152
+ }) as any as S.Schema<GetGroupResponse>;
153
+
154
+ export interface SearchGroupRequest {}
155
+ export const SearchGroupRequest = /*@__PURE__*/ S.suspend(() =>
156
+ S.Struct({}).pipe(
157
+ T.Http({
158
+ method: "POST",
159
+ uri: "/api/firewall/group/searchItem",
160
+ code: 200,
161
+ }),
162
+ ),
163
+ ).annotate({
164
+ identifier: "SearchGroupRequest",
165
+ }) as any as S.Schema<SearchGroupRequest>;
166
+
167
+ export type GroupList = Array<GroupItem>;
168
+ export const GroupList = /*@__PURE__*/ S.Array(
169
+ GroupItem,
170
+ ) as any as S.Schema<GroupList>;
171
+
172
+ export interface SearchGroupResponse {
173
+ /** Total matching items before pagination. */
174
+ total?: number;
175
+ rowCount?: number;
176
+ /** Current page number. */
177
+ current?: number;
178
+ rows?: GroupList;
179
+ }
180
+ export const SearchGroupResponse = /*@__PURE__*/ S.suspend(() =>
181
+ S.Struct({
182
+ total: S.optional(S.Number),
183
+ rowCount: S.optional(S.Number),
184
+ current: S.optional(S.Number),
185
+ rows: S.optional(GroupList),
186
+ }),
187
+ ).annotate({
188
+ identifier: "SearchGroupResponse",
189
+ }) as any as S.Schema<SearchGroupResponse>;
190
+
191
+ export interface SetRequest {
192
+ group?: Model;
193
+ }
194
+ export const SetRequest = /*@__PURE__*/ S.suspend(() =>
195
+ S.Struct({
196
+ group: S.optional(Model),
197
+ }).pipe(
198
+ T.Http({ method: "POST", uri: "/api/firewall/group/set", code: 200 }),
199
+ ),
200
+ ).annotate({ identifier: "SetRequest" }) as any as S.Schema<SetRequest>;
201
+
202
+ export type SetResult = "saved";
203
+ export const SetResult = S.String;
204
+
205
+ export interface SetResponse {
206
+ result?: SetResult;
207
+ }
208
+ export const SetResponse = /*@__PURE__*/ S.suspend(() =>
209
+ S.Struct({
210
+ result: S.optional(SetResult),
211
+ }),
212
+ ).annotate({ identifier: "SetResponse" }) as any as S.Schema<SetResponse>;
213
+
214
+ export interface SetGroupRequest {
215
+ uuid: string;
216
+ group?: GroupItem;
217
+ }
218
+ export const SetGroupRequest = /*@__PURE__*/ S.suspend(() =>
219
+ S.Struct({
220
+ uuid: S.String.pipe(T.Label()),
221
+ group: S.optional(GroupItem),
222
+ }).pipe(
223
+ T.Http({
224
+ method: "POST",
225
+ uri: "/api/firewall/group/setItem/{uuid}",
226
+ code: 200,
227
+ }),
228
+ ),
229
+ ).annotate({
230
+ identifier: "SetGroupRequest",
231
+ }) as any as S.Schema<SetGroupRequest>;
232
+
233
+ export type SetGroupResult = "saved";
234
+ export const SetGroupResult = S.String;
235
+
236
+ export interface SetGroupResponse {
237
+ result?: SetGroupResult;
238
+ }
239
+ export const SetGroupResponse = /*@__PURE__*/ S.suspend(() =>
240
+ S.Struct({
241
+ result: S.optional(SetGroupResult),
242
+ }),
243
+ ).annotate({
244
+ identifier: "SetGroupResponse",
245
+ }) as any as S.Schema<SetGroupResponse>;
246
+
247
+ export type AddGroupError = OpnsenseOpError;
248
+ /** Add a new ifgroupentry item. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
249
+ export const addGroup: API.OperationMethod<
250
+ AddGroupRequest,
251
+ AddGroupResponse,
252
+ AddGroupError,
253
+ OpnsenseOpContext
254
+ > = /*@__PURE__*/ API.make(() => ({
255
+ input: AddGroupRequest,
256
+ output: AddGroupResponse,
257
+ errors: [],
258
+ protocol: OpnsenseProtocol,
259
+ retry: Retry.Retry,
260
+ }));
261
+
262
+ export type DelGroupError = OpnsenseOpError;
263
+ /** Delete a ifgroupentry item by uuid. */
264
+ export const delGroup: API.OperationMethod<
265
+ DelGroupRequest,
266
+ DelGroupResponse,
267
+ DelGroupError,
268
+ OpnsenseOpContext
269
+ > = /*@__PURE__*/ API.make(() => ({
270
+ input: DelGroupRequest,
271
+ output: DelGroupResponse,
272
+ errors: [],
273
+ protocol: OpnsenseProtocol,
274
+ retry: Retry.Retry,
275
+ }));
276
+
277
+ export type GetError = OpnsenseOpError;
278
+ /** Fetch the entire model tree (every section and array collection). */
279
+ export const get: API.OperationMethod<
280
+ GetRequest,
281
+ GetResponse,
282
+ GetError,
283
+ OpnsenseOpContext
284
+ > = /*@__PURE__*/ API.make(() => ({
285
+ input: GetRequest,
286
+ output: GetResponse,
287
+ errors: [],
288
+ protocol: OpnsenseProtocol,
289
+ retry: Retry.Retry,
290
+ }));
291
+
292
+ export type GetGroupError = OpnsenseOpError;
293
+ /** Fetch one ifgroupentry item by uuid. */
294
+ export const getGroup: API.OperationMethod<
295
+ GetGroupRequest,
296
+ GetGroupResponse,
297
+ GetGroupError,
298
+ OpnsenseOpContext
299
+ > = /*@__PURE__*/ API.make(() => ({
300
+ input: GetGroupRequest,
301
+ output: GetGroupResponse,
302
+ errors: [],
303
+ protocol: OpnsenseProtocol,
304
+ retry: Retry.Retry,
305
+ }));
306
+
307
+ export type SearchGroupError = OpnsenseOpError;
308
+ /** Search ifgroupentry items (paginated). */
309
+ export const searchGroup: API.OperationMethod<
310
+ SearchGroupRequest,
311
+ SearchGroupResponse,
312
+ SearchGroupError,
313
+ OpnsenseOpContext
314
+ > = /*@__PURE__*/ API.make(() => ({
315
+ input: SearchGroupRequest,
316
+ output: SearchGroupResponse,
317
+ errors: [],
318
+ protocol: OpnsenseProtocol,
319
+ retry: Retry.Retry,
320
+ }));
321
+
322
+ export type SetError = OpnsenseOpError;
323
+ /** Replace the entire model tree in one call. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
324
+ export const set: API.OperationMethod<
325
+ SetRequest,
326
+ SetResponse,
327
+ SetError,
328
+ OpnsenseOpContext
329
+ > = /*@__PURE__*/ API.make(() => ({
330
+ input: SetRequest,
331
+ output: SetResponse,
332
+ errors: [],
333
+ protocol: OpnsenseProtocol,
334
+ retry: Retry.Retry,
335
+ }));
336
+
337
+ export type SetGroupError = OpnsenseOpError;
338
+ /** Update an existing ifgroupentry item. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
339
+ export const setGroup: API.OperationMethod<
340
+ SetGroupRequest,
341
+ SetGroupResponse,
342
+ SetGroupError,
343
+ OpnsenseOpContext
344
+ > = /*@__PURE__*/ API.make(() => ({
345
+ input: SetGroupRequest,
346
+ output: SetGroupResponse,
347
+ errors: [],
348
+ protocol: OpnsenseProtocol,
349
+ retry: Retry.Retry,
350
+ }));
@@ -0,0 +1,9 @@
1
+ // AUTO-GENERATED by scripts/generate.ts. Do not edit.
2
+ export * as firewall_alias from "./firewall_alias.ts";
3
+ export * as firewall_category from "./firewall_category.ts";
4
+ export * as firewall_filter from "./firewall_filter.ts";
5
+ export * as firewall_group from "./firewall_group.ts";
6
+ export * as quagga_bgp from "./quagga_bgp.ts";
7
+ export * as quagga_general from "./quagga_general.ts";
8
+ export * as quagga_service from "./quagga_service.ts";
9
+ export * as routing_settings from "./routing_settings.ts";