@hackfed/schemas 0.1.0 → 0.3.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/v1/base/resource-definition.d.ts +20 -0
- package/dist/v1/base/resource-definition.js +20 -0
- package/dist/v1/entity/organization.d.ts +4 -2
- package/dist/v1/entity/organization.js +3 -9
- package/dist/v1/index.d.ts +1 -0
- package/dist/v1/index.js +5 -0
- package/dist/v1/service/nebula.d.ts +3 -3
- package/dist/v1/service/nebula.js +1 -2
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ResourceDefinitionSchema: z.ZodObject<{
|
|
3
|
+
$schema: z.ZodOptional<z.ZodURL>;
|
|
4
|
+
apiVersion: z.ZodLiteral<"hackfed/v1">;
|
|
5
|
+
kind: z.ZodLiteral<"Organization">;
|
|
6
|
+
metadata: z.ZodObject<{
|
|
7
|
+
orgId: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
spec: z.ZodObject<{}, z.core.$strip>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type ResourceDefinition = z.infer<typeof ResourceDefinitionSchema>;
|
|
12
|
+
export declare const __schemas: z.ZodObject<{
|
|
13
|
+
$schema: z.ZodOptional<z.ZodURL>;
|
|
14
|
+
apiVersion: z.ZodLiteral<"hackfed/v1">;
|
|
15
|
+
kind: z.ZodLiteral<"Organization">;
|
|
16
|
+
metadata: z.ZodObject<{
|
|
17
|
+
orgId: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
spec: z.ZodObject<{}, z.core.$strip>;
|
|
20
|
+
}, z.core.$strip>[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OrganizationIdSchema } from './organization-id';
|
|
3
|
+
export const ResourceDefinitionSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
$schema: z.url().optional().describe('URL of the schema definition'),
|
|
6
|
+
apiVersion: z.literal('hackfed/v1').describe('API version identifier'),
|
|
7
|
+
kind: z.literal('Organization').describe('Resource type'),
|
|
8
|
+
metadata: z
|
|
9
|
+
.object({
|
|
10
|
+
orgId: OrganizationIdSchema.describe('Identifier of the organization owning this resource'),
|
|
11
|
+
})
|
|
12
|
+
.describe('Metadata about the organization'),
|
|
13
|
+
spec: z.object(),
|
|
14
|
+
})
|
|
15
|
+
.meta({
|
|
16
|
+
description: 'Base schema for Hackfed resource definitions',
|
|
17
|
+
id: 'ResourceDefinition',
|
|
18
|
+
title: 'Resource Definition',
|
|
19
|
+
});
|
|
20
|
+
export const __schemas = [ResourceDefinitionSchema];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const OrganizationSchema: z.ZodObject<{
|
|
3
|
+
$schema: z.ZodOptional<z.ZodURL>;
|
|
3
4
|
apiVersion: z.ZodLiteral<"hackfed/v1">;
|
|
4
5
|
kind: z.ZodLiteral<"Organization">;
|
|
5
6
|
metadata: z.ZodObject<{
|
|
@@ -26,7 +27,7 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
26
27
|
}, z.core.$strict>>;
|
|
27
28
|
nebula: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
28
29
|
address: z.ZodString;
|
|
29
|
-
certificates: z.
|
|
30
|
+
certificates: z.ZodArray<z.ZodString>;
|
|
30
31
|
lighthouse: z.ZodOptional<z.ZodObject<{
|
|
31
32
|
enabled: z.ZodBoolean;
|
|
32
33
|
endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -63,6 +64,7 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
63
64
|
}, z.core.$strip>;
|
|
64
65
|
export type Organization = z.infer<typeof OrganizationSchema>;
|
|
65
66
|
export declare const __schemas: z.ZodObject<{
|
|
67
|
+
$schema: z.ZodOptional<z.ZodURL>;
|
|
66
68
|
apiVersion: z.ZodLiteral<"hackfed/v1">;
|
|
67
69
|
kind: z.ZodLiteral<"Organization">;
|
|
68
70
|
metadata: z.ZodObject<{
|
|
@@ -89,7 +91,7 @@ export declare const __schemas: z.ZodObject<{
|
|
|
89
91
|
}, z.core.$strict>>;
|
|
90
92
|
nebula: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
91
93
|
address: z.ZodString;
|
|
92
|
-
certificates: z.
|
|
94
|
+
certificates: z.ZodArray<z.ZodString>;
|
|
93
95
|
lighthouse: z.ZodOptional<z.ZodObject<{
|
|
94
96
|
enabled: z.ZodBoolean;
|
|
95
97
|
endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OrganizationIdSchema } from '../base/organization-id';
|
|
3
|
+
import { ResourceDefinitionSchema } from '../base/resource-definition';
|
|
3
4
|
import { AboutServiceSchema } from '../service/about';
|
|
4
5
|
import { AccessServiceSchema } from '../service/access';
|
|
5
6
|
import { NebulaServiceSchema } from '../service/nebula';
|
|
6
7
|
import { TelephonyServiceSchema } from '../service/telephony';
|
|
7
|
-
export const OrganizationSchema =
|
|
8
|
-
.
|
|
9
|
-
apiVersion: z.literal('hackfed/v1').describe('API version identifier'),
|
|
10
|
-
kind: z.literal('Organization').describe('Resource type'),
|
|
11
|
-
metadata: z
|
|
12
|
-
.object({
|
|
13
|
-
orgId: OrganizationIdSchema.describe('Identifier of the organization owning this resource'),
|
|
14
|
-
})
|
|
15
|
-
.describe('Metadata about the organization'),
|
|
8
|
+
export const OrganizationSchema = ResourceDefinitionSchema
|
|
9
|
+
.extend({
|
|
16
10
|
spec: z
|
|
17
11
|
.object({
|
|
18
12
|
id: OrganizationIdSchema.describe('Organization ID (must match metadata.orgId)'),
|
package/dist/v1/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { type Inet6Number, Inet6NumberSchema } from './base/inet6-number';
|
|
2
2
|
export { type OrganizationId, OrganizationIdSchema } from './base/organization-id';
|
|
3
|
+
export { type ResourceDefinition, ResourceDefinitionSchema } from './base/resource-definition';
|
|
3
4
|
export { type TelephonyDirectory, TelephonyDirectorySchema } from './directory/telephony';
|
|
4
5
|
export { type Organization, OrganizationSchema } from './entity/organization';
|
|
5
6
|
export { type AboutService, AboutServiceSchema } from './service/about';
|
package/dist/v1/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
// Base
|
|
1
2
|
export { Inet6NumberSchema } from './base/inet6-number';
|
|
2
3
|
export { OrganizationIdSchema } from './base/organization-id';
|
|
4
|
+
export { ResourceDefinitionSchema } from './base/resource-definition';
|
|
5
|
+
// Directories
|
|
3
6
|
export { TelephonyDirectorySchema } from './directory/telephony';
|
|
7
|
+
// Entities
|
|
4
8
|
export { OrganizationSchema } from './entity/organization';
|
|
9
|
+
// Services
|
|
5
10
|
export { AboutServiceSchema } from './service/about';
|
|
6
11
|
export { AccessServiceSchema } from './service/access';
|
|
7
12
|
export { NebulaServiceSchema } from './service/nebula';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const NebulaNodeSchema: z.ZodObject<{
|
|
3
3
|
address: z.ZodString;
|
|
4
|
-
certificates: z.
|
|
4
|
+
certificates: z.ZodArray<z.ZodString>;
|
|
5
5
|
lighthouse: z.ZodOptional<z.ZodObject<{
|
|
6
6
|
enabled: z.ZodBoolean;
|
|
7
7
|
endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -9,7 +9,7 @@ export declare const NebulaNodeSchema: z.ZodObject<{
|
|
|
9
9
|
}, z.core.$strict>;
|
|
10
10
|
export declare const NebulaServiceSchema: z.ZodArray<z.ZodObject<{
|
|
11
11
|
address: z.ZodString;
|
|
12
|
-
certificates: z.
|
|
12
|
+
certificates: z.ZodArray<z.ZodString>;
|
|
13
13
|
lighthouse: z.ZodOptional<z.ZodObject<{
|
|
14
14
|
enabled: z.ZodBoolean;
|
|
15
15
|
endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -19,7 +19,7 @@ export type NebulaService = z.infer<typeof NebulaServiceSchema>;
|
|
|
19
19
|
export type NebulaNode = z.infer<typeof NebulaNodeSchema>;
|
|
20
20
|
export declare const __schemas: z.ZodArray<z.ZodObject<{
|
|
21
21
|
address: z.ZodString;
|
|
22
|
-
certificates: z.
|
|
22
|
+
certificates: z.ZodArray<z.ZodString>;
|
|
23
23
|
lighthouse: z.ZodOptional<z.ZodObject<{
|
|
24
24
|
enabled: z.ZodBoolean;
|
|
25
25
|
endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -9,8 +9,7 @@ export const NebulaNodeSchema = z
|
|
|
9
9
|
.regex(/^[a-f0-9]{64}$/)
|
|
10
10
|
.describe('SHA-256 certificate fingerprint in hexadecimal'))
|
|
11
11
|
.min(1)
|
|
12
|
-
.describe('List of certificate fingerprints for the node')
|
|
13
|
-
.optional(),
|
|
12
|
+
.describe('List of certificate fingerprints for the node'),
|
|
14
13
|
lighthouse: z
|
|
15
14
|
.object({
|
|
16
15
|
enabled: z.boolean().describe('Whether this node acts as a lighthouse'),
|