@hackfed/schemas 0.0.5 → 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.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @fileoverview Stub file to make TypeScript recognize this as a module.
3
+ */
4
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @fileoverview Stub file to make TypeScript recognize this as a module.
3
+ */
4
+ /* eslint-disable-next-line unicorn/no-empty-file -- stub */
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const Inet6NumberSchema: z.ZodString;
3
+ export type Inet6Number = z.infer<typeof Inet6NumberSchema>;
4
+ export declare const __schemas: z.ZodString[];
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export const Inet6NumberSchema = z
3
+ .string()
4
+ .regex(/^(((?:[0-9A-Fa-f]{1,4}))*((?::[0-9A-Fa-f]{1,4}))*::((?:[0-9A-Fa-f]{1,4}))*((?::[0-9A-Fa-f]{1,4}))*|((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4})){7})(\/([1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])){0,1}$/)
5
+ .meta({
6
+ description: 'An IPv6 address in standard notation',
7
+ examples: ['fd79:7636:1f08:883d::008', '2001:db8::1', '::1', 'fe80::1/128'],
8
+ id: 'Inet6Number',
9
+ title: 'IPv6 Address',
10
+ });
11
+ export const __schemas = [Inet6NumberSchema];
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const OrganizationIdSchema: z.ZodString;
3
+ export type OrganizationId = z.infer<typeof OrganizationIdSchema>;
4
+ export declare const __schemas: z.ZodString[];
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export const OrganizationIdSchema = z
3
+ .string()
4
+ .regex(/^[a-z0-9]*$/)
5
+ .min(4)
6
+ .max(16)
7
+ .meta({
8
+ description: 'A unique identifier for an organization in the Hackfed registry',
9
+ examples: ['bksp', 'xkem'],
10
+ id: 'OrganizationId',
11
+ title: 'Organization ID',
12
+ });
13
+ export const __schemas = [OrganizationIdSchema];
@@ -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];
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ export declare const DirectoryExchangeSchema: z.ZodObject<{
3
+ codecs: z.ZodArray<z.ZodEnum<{
4
+ opus: "opus";
5
+ g722: "g722";
6
+ ulaw: "ulaw";
7
+ }>>;
8
+ endpoint: z.ZodString;
9
+ id: z.ZodString;
10
+ prefixes: z.ZodArray<z.ZodE164>;
11
+ protocol: z.ZodEnum<{
12
+ iax2: "iax2";
13
+ }>;
14
+ }, z.core.$strict>;
15
+ export declare const DirectoryOrgSchema: z.ZodObject<{
16
+ exchanges: z.ZodArray<z.ZodObject<{
17
+ codecs: z.ZodArray<z.ZodEnum<{
18
+ opus: "opus";
19
+ g722: "g722";
20
+ ulaw: "ulaw";
21
+ }>>;
22
+ endpoint: z.ZodString;
23
+ id: z.ZodString;
24
+ prefixes: z.ZodArray<z.ZodE164>;
25
+ protocol: z.ZodEnum<{
26
+ iax2: "iax2";
27
+ }>;
28
+ }, z.core.$strict>>;
29
+ name: z.ZodString;
30
+ orgId: z.ZodString;
31
+ }, z.core.$strict>;
32
+ export declare const TelephonyDirectorySchema: z.ZodObject<{
33
+ orgs: z.ZodArray<z.ZodObject<{
34
+ exchanges: z.ZodArray<z.ZodObject<{
35
+ codecs: z.ZodArray<z.ZodEnum<{
36
+ opus: "opus";
37
+ g722: "g722";
38
+ ulaw: "ulaw";
39
+ }>>;
40
+ endpoint: z.ZodString;
41
+ id: z.ZodString;
42
+ prefixes: z.ZodArray<z.ZodE164>;
43
+ protocol: z.ZodEnum<{
44
+ iax2: "iax2";
45
+ }>;
46
+ }, z.core.$strict>>;
47
+ name: z.ZodString;
48
+ orgId: z.ZodString;
49
+ }, z.core.$strict>>;
50
+ }, z.core.$strip>;
51
+ export type TelephonyDirectory = z.infer<typeof TelephonyDirectorySchema>;
52
+ export type DirectoryOrg = z.infer<typeof DirectoryOrgSchema>;
53
+ export type DirectoryExchange = z.infer<typeof DirectoryExchangeSchema>;
54
+ export declare const __schemas: z.ZodObject<{
55
+ orgs: z.ZodArray<z.ZodObject<{
56
+ exchanges: z.ZodArray<z.ZodObject<{
57
+ codecs: z.ZodArray<z.ZodEnum<{
58
+ opus: "opus";
59
+ g722: "g722";
60
+ ulaw: "ulaw";
61
+ }>>;
62
+ endpoint: z.ZodString;
63
+ id: z.ZodString;
64
+ prefixes: z.ZodArray<z.ZodE164>;
65
+ protocol: z.ZodEnum<{
66
+ iax2: "iax2";
67
+ }>;
68
+ }, z.core.$strict>>;
69
+ name: z.ZodString;
70
+ orgId: z.ZodString;
71
+ }, z.core.$strict>>;
72
+ }, z.core.$strip>[];
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ import { OrganizationIdSchema } from '../base/organization-id';
3
+ export const DirectoryExchangeSchema = z
4
+ .object({
5
+ codecs: z
6
+ .array(z.enum(['opus', 'g722', 'ulaw']))
7
+ .min(1)
8
+ .describe('Supported audio codecs'),
9
+ endpoint: z
10
+ .string()
11
+ .describe('Network address and port of the exchange (e.g., [IPv6]:port or IPv4:port)'),
12
+ id: z.string().describe('Unique exchange identifier within the organization'),
13
+ prefixes: z
14
+ .array(z.e164().describe('Telephony number prefix (e.g., country or area code)'))
15
+ .describe('Telephony number prefixes allocated to the organization for this exchange'),
16
+ protocol: z.enum(['iax2']).describe('Telephony protocol used by the exchange'),
17
+ })
18
+ .strict();
19
+ export const DirectoryOrgSchema = z
20
+ .object({
21
+ exchanges: z
22
+ .array(DirectoryExchangeSchema)
23
+ .describe('List of telephony exchanges for the organization'),
24
+ name: z.string().describe('Name of the organization'),
25
+ orgId: OrganizationIdSchema.describe('Unique identifier for the organization'),
26
+ })
27
+ .strict();
28
+ export const TelephonyDirectorySchema = z
29
+ .object({
30
+ orgs: z
31
+ .array(DirectoryOrgSchema)
32
+ .describe('List of organizations participating in Hackfed Telephony Network.'),
33
+ })
34
+ .meta({
35
+ description: 'Aggregated telephony service information for Hackfed network members.',
36
+ id: 'TelephonyDirectory',
37
+ title: 'Hackfed Telephony Directory',
38
+ });
39
+ export const __schemas = [TelephonyDirectorySchema];
@@ -0,0 +1,128 @@
1
+ import { z } from 'zod';
2
+ export declare const OrganizationSchema: 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<{
10
+ id: z.ZodString;
11
+ name: z.ZodString;
12
+ services: z.ZodOptional<z.ZodObject<{
13
+ about: z.ZodOptional<z.ZodObject<{
14
+ contact: z.ZodOptional<z.ZodObject<{
15
+ email: z.ZodOptional<z.ZodEmail>;
16
+ website: z.ZodOptional<z.ZodURL>;
17
+ }, z.core.$strict>>;
18
+ }, z.core.$strict>>;
19
+ access: z.ZodOptional<z.ZodObject<{
20
+ maintainers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ type: z.ZodLiteral<"github">;
22
+ username: z.ZodString;
23
+ }, z.core.$strip>, z.ZodObject<{
24
+ email: z.ZodEmail;
25
+ type: z.ZodLiteral<"email">;
26
+ }, z.core.$strip>], "type">>>;
27
+ }, z.core.$strict>>;
28
+ nebula: z.ZodOptional<z.ZodArray<z.ZodObject<{
29
+ address: z.ZodString;
30
+ certificates: z.ZodOptional<z.ZodArray<z.ZodString>>;
31
+ lighthouse: z.ZodOptional<z.ZodObject<{
32
+ enabled: z.ZodBoolean;
33
+ endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
34
+ }, z.core.$strict>>;
35
+ }, z.core.$strict>>>;
36
+ telephony: z.ZodOptional<z.ZodObject<{
37
+ exchanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
38
+ address: z.ZodString;
39
+ codecs: z.ZodArray<z.ZodEnum<{
40
+ opus: "opus";
41
+ g722: "g722";
42
+ ulaw: "ulaw";
43
+ }>>;
44
+ id: z.ZodString;
45
+ protocol: z.ZodEnum<{
46
+ iax2: "iax2";
47
+ }>;
48
+ }, z.core.$strict>>>;
49
+ phonebook: z.ZodOptional<z.ZodArray<z.ZodObject<{
50
+ format: z.ZodEnum<{
51
+ hackfed: "hackfed";
52
+ }>;
53
+ url: z.ZodURL;
54
+ }, z.core.$strict>>>;
55
+ prefixes: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
+ description: z.ZodOptional<z.ZodString>;
57
+ exchange: z.ZodString;
58
+ id: z.ZodString;
59
+ prefix: z.ZodE164;
60
+ }, z.core.$strict>>>;
61
+ }, z.core.$strict>>;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$strict>;
64
+ }, z.core.$strip>;
65
+ export type Organization = z.infer<typeof OrganizationSchema>;
66
+ export declare const __schemas: z.ZodObject<{
67
+ $schema: z.ZodOptional<z.ZodURL>;
68
+ apiVersion: z.ZodLiteral<"hackfed/v1">;
69
+ kind: z.ZodLiteral<"Organization">;
70
+ metadata: z.ZodObject<{
71
+ orgId: z.ZodString;
72
+ }, z.core.$strip>;
73
+ spec: z.ZodObject<{
74
+ id: z.ZodString;
75
+ name: z.ZodString;
76
+ services: z.ZodOptional<z.ZodObject<{
77
+ about: z.ZodOptional<z.ZodObject<{
78
+ contact: z.ZodOptional<z.ZodObject<{
79
+ email: z.ZodOptional<z.ZodEmail>;
80
+ website: z.ZodOptional<z.ZodURL>;
81
+ }, z.core.$strict>>;
82
+ }, z.core.$strict>>;
83
+ access: z.ZodOptional<z.ZodObject<{
84
+ maintainers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
85
+ type: z.ZodLiteral<"github">;
86
+ username: z.ZodString;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ email: z.ZodEmail;
89
+ type: z.ZodLiteral<"email">;
90
+ }, z.core.$strip>], "type">>>;
91
+ }, z.core.$strict>>;
92
+ nebula: z.ZodOptional<z.ZodArray<z.ZodObject<{
93
+ address: z.ZodString;
94
+ certificates: z.ZodOptional<z.ZodArray<z.ZodString>>;
95
+ lighthouse: z.ZodOptional<z.ZodObject<{
96
+ enabled: z.ZodBoolean;
97
+ endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ }, z.core.$strict>>;
99
+ }, z.core.$strict>>>;
100
+ telephony: z.ZodOptional<z.ZodObject<{
101
+ exchanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
102
+ address: z.ZodString;
103
+ codecs: z.ZodArray<z.ZodEnum<{
104
+ opus: "opus";
105
+ g722: "g722";
106
+ ulaw: "ulaw";
107
+ }>>;
108
+ id: z.ZodString;
109
+ protocol: z.ZodEnum<{
110
+ iax2: "iax2";
111
+ }>;
112
+ }, z.core.$strict>>>;
113
+ phonebook: z.ZodOptional<z.ZodArray<z.ZodObject<{
114
+ format: z.ZodEnum<{
115
+ hackfed: "hackfed";
116
+ }>;
117
+ url: z.ZodURL;
118
+ }, z.core.$strict>>>;
119
+ prefixes: z.ZodOptional<z.ZodArray<z.ZodObject<{
120
+ description: z.ZodOptional<z.ZodString>;
121
+ exchange: z.ZodString;
122
+ id: z.ZodString;
123
+ prefix: z.ZodE164;
124
+ }, z.core.$strict>>>;
125
+ }, z.core.$strict>>;
126
+ }, z.core.$strip>>;
127
+ }, z.core.$strict>;
128
+ }, z.core.$strip>[];
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ import { OrganizationIdSchema } from '../base/organization-id';
3
+ import { ResourceDefinitionSchema } from '../base/resource-definition';
4
+ import { AboutServiceSchema } from '../service/about';
5
+ import { AccessServiceSchema } from '../service/access';
6
+ import { NebulaServiceSchema } from '../service/nebula';
7
+ import { TelephonyServiceSchema } from '../service/telephony';
8
+ export const OrganizationSchema = ResourceDefinitionSchema
9
+ .extend({
10
+ spec: z
11
+ .object({
12
+ id: OrganizationIdSchema.describe('Organization ID (must match metadata.orgId)'),
13
+ name: z
14
+ .string()
15
+ .min(4)
16
+ .max(64)
17
+ .describe('Human-readable organization name'),
18
+ services: z
19
+ .object({
20
+ about: AboutServiceSchema.optional(),
21
+ access: AccessServiceSchema.optional(),
22
+ nebula: NebulaServiceSchema.optional(),
23
+ telephony: TelephonyServiceSchema.optional(),
24
+ })
25
+ .describe('Services provided by the organization')
26
+ .optional(),
27
+ })
28
+ .strict()
29
+ .describe('Organization specification'),
30
+ })
31
+ .meta({
32
+ description: 'Complete organization entity definition for Hackfed registry',
33
+ id: 'Organization',
34
+ title: 'Hackfed Organization',
35
+ });
36
+ export const __schemas = [OrganizationSchema];
@@ -0,0 +1,9 @@
1
+ export { type Inet6Number, Inet6NumberSchema } from './base/inet6-number';
2
+ export { type OrganizationId, OrganizationIdSchema } from './base/organization-id';
3
+ export { type ResourceDefinition, ResourceDefinitionSchema } from './base/resource-definition';
4
+ export { type TelephonyDirectory, TelephonyDirectorySchema } from './directory/telephony';
5
+ export { type Organization, OrganizationSchema } from './entity/organization';
6
+ export { type AboutService, AboutServiceSchema } from './service/about';
7
+ export { type AccessService, AccessServiceSchema } from './service/access';
8
+ export { type NebulaService, NebulaServiceSchema } from './service/nebula';
9
+ export { type TelephonyService, TelephonyServiceSchema } from './service/telephony';
@@ -0,0 +1,13 @@
1
+ // Base
2
+ export { Inet6NumberSchema } from './base/inet6-number';
3
+ export { OrganizationIdSchema } from './base/organization-id';
4
+ export { ResourceDefinitionSchema } from './base/resource-definition';
5
+ // Directories
6
+ export { TelephonyDirectorySchema } from './directory/telephony';
7
+ // Entities
8
+ export { OrganizationSchema } from './entity/organization';
9
+ // Services
10
+ export { AboutServiceSchema } from './service/about';
11
+ export { AccessServiceSchema } from './service/access';
12
+ export { NebulaServiceSchema } from './service/nebula';
13
+ export { TelephonyServiceSchema } from './service/telephony';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export declare const AboutServiceSchema: z.ZodObject<{
3
+ contact: z.ZodOptional<z.ZodObject<{
4
+ email: z.ZodOptional<z.ZodEmail>;
5
+ website: z.ZodOptional<z.ZodURL>;
6
+ }, z.core.$strict>>;
7
+ }, z.core.$strict>;
8
+ export type AboutService = z.infer<typeof AboutServiceSchema>;
9
+ export declare const __schemas: z.ZodObject<{
10
+ contact: z.ZodOptional<z.ZodObject<{
11
+ email: z.ZodOptional<z.ZodEmail>;
12
+ website: z.ZodOptional<z.ZodURL>;
13
+ }, z.core.$strict>>;
14
+ }, z.core.$strict>[];
@@ -1,23 +1,19 @@
1
- import { z } from 'zod'
2
-
1
+ import { z } from 'zod';
3
2
  export const AboutServiceSchema = z
4
- .object({
3
+ .object({
5
4
  contact: z
6
- .object({
5
+ .object({
7
6
  email: z.email().describe("Organization's contact email address").optional(),
8
7
  website: z.url().describe("Organization's website URL").optional(),
9
- })
10
- .strict()
11
- .describe('Contact information for the organization')
12
- .optional(),
13
- })
14
- .strict()
15
- .meta({
8
+ })
9
+ .strict()
10
+ .describe('Contact information for the organization')
11
+ .optional(),
12
+ })
13
+ .strict()
14
+ .meta({
16
15
  description: 'Contact information and general details about an organization',
17
16
  id: 'AboutService',
18
17
  title: 'Organization About Service',
19
- })
20
-
21
- export type AboutService = z.infer<typeof AboutServiceSchema>
22
-
23
- export const __schemas = [AboutServiceSchema]
18
+ });
19
+ export const __schemas = [AboutServiceSchema];
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ export declare const GithubMaintainerSchema: z.ZodObject<{
3
+ type: z.ZodLiteral<"github">;
4
+ username: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export declare const EmailMaintainerSchema: z.ZodObject<{
7
+ email: z.ZodEmail;
8
+ type: z.ZodLiteral<"email">;
9
+ }, z.core.$strip>;
10
+ export declare const MaintainerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ type: z.ZodLiteral<"github">;
12
+ username: z.ZodString;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ email: z.ZodEmail;
15
+ type: z.ZodLiteral<"email">;
16
+ }, z.core.$strip>], "type">;
17
+ export declare const AccessServiceSchema: z.ZodObject<{
18
+ maintainers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
19
+ type: z.ZodLiteral<"github">;
20
+ username: z.ZodString;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ email: z.ZodEmail;
23
+ type: z.ZodLiteral<"email">;
24
+ }, z.core.$strip>], "type">>>;
25
+ }, z.core.$strict>;
26
+ export type AccessService = z.infer<typeof AccessServiceSchema>;
27
+ export type Maintainer = z.infer<typeof MaintainerSchema>;
28
+ export type GithubMaintainer = z.infer<typeof GithubMaintainerSchema>;
29
+ export type EmailMaintainer = z.infer<typeof EmailMaintainerSchema>;
30
+ export declare const __schemas: z.ZodObject<{
31
+ maintainers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
32
+ type: z.ZodLiteral<"github">;
33
+ username: z.ZodString;
34
+ }, z.core.$strip>, z.ZodObject<{
35
+ email: z.ZodEmail;
36
+ type: z.ZodLiteral<"email">;
37
+ }, z.core.$strip>], "type">>>;
38
+ }, z.core.$strict>[];
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ export const GithubMaintainerSchema = z
3
+ .object({
4
+ type: z.literal('github'),
5
+ username: z.string().describe('Username for GitHub type maintainers'),
6
+ })
7
+ .describe('Maintainer identified by GitHub username');
8
+ export const EmailMaintainerSchema = z
9
+ .object({
10
+ email: z.email().describe('Email address for email type maintainers'),
11
+ type: z.literal('email'),
12
+ })
13
+ .describe('Maintainer identified by email address');
14
+ export const MaintainerSchema = z.discriminatedUnion('type', [
15
+ GithubMaintainerSchema,
16
+ EmailMaintainerSchema,
17
+ ]);
18
+ export const AccessServiceSchema = z
19
+ .object({
20
+ maintainers: z
21
+ .array(MaintainerSchema)
22
+ .min(1)
23
+ .describe('List of organization maintainers')
24
+ .optional(),
25
+ })
26
+ .strict()
27
+ .meta({
28
+ description: 'Access control and maintainer information for an organization',
29
+ id: 'AccessService',
30
+ title: 'Organization Access Service',
31
+ });
32
+ export const __schemas = [AccessServiceSchema];
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ export declare const NebulaNodeSchema: z.ZodObject<{
3
+ address: z.ZodString;
4
+ certificates: z.ZodOptional<z.ZodArray<z.ZodString>>;
5
+ lighthouse: z.ZodOptional<z.ZodObject<{
6
+ enabled: z.ZodBoolean;
7
+ endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ }, z.core.$strict>>;
9
+ }, z.core.$strict>;
10
+ export declare const NebulaServiceSchema: z.ZodArray<z.ZodObject<{
11
+ address: z.ZodString;
12
+ certificates: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ lighthouse: z.ZodOptional<z.ZodObject<{
14
+ enabled: z.ZodBoolean;
15
+ endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
+ }, z.core.$strict>>;
17
+ }, z.core.$strict>>;
18
+ export type NebulaService = z.infer<typeof NebulaServiceSchema>;
19
+ export type NebulaNode = z.infer<typeof NebulaNodeSchema>;
20
+ export declare const __schemas: z.ZodArray<z.ZodObject<{
21
+ address: z.ZodString;
22
+ certificates: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
+ lighthouse: z.ZodOptional<z.ZodObject<{
24
+ enabled: z.ZodBoolean;
25
+ endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
+ }, z.core.$strict>>;
27
+ }, z.core.$strict>>[];
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { Inet6NumberSchema } from '../base/inet6-number';
3
+ export const NebulaNodeSchema = z
4
+ .object({
5
+ address: Inet6NumberSchema.describe('IPv6 address of the Nebula node'),
6
+ certificates: z
7
+ .array(z
8
+ .string()
9
+ .regex(/^[a-f0-9]{64}$/)
10
+ .describe('SHA-256 certificate fingerprint in hexadecimal'))
11
+ .min(1)
12
+ .describe('List of certificate fingerprints for the node')
13
+ .optional(),
14
+ lighthouse: z
15
+ .object({
16
+ enabled: z.boolean().describe('Whether this node acts as a lighthouse'),
17
+ endpoints: z
18
+ .array(z.string().describe('Endpoint in format host:port'))
19
+ .min(1)
20
+ .describe('Public endpoints for lighthouse connectivity')
21
+ .optional(),
22
+ })
23
+ .strict()
24
+ .describe('Lighthouse configuration for the node')
25
+ .optional(),
26
+ })
27
+ .strict();
28
+ export const NebulaServiceSchema = z.array(NebulaNodeSchema).meta({
29
+ description: 'Nebula VPN network configuration for the organization',
30
+ id: 'NebulaService',
31
+ title: 'Organization Nebula Service',
32
+ });
33
+ export const __schemas = [NebulaServiceSchema];
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod';
2
+ export declare const ExchangeSchema: z.ZodObject<{
3
+ address: z.ZodString;
4
+ codecs: z.ZodArray<z.ZodEnum<{
5
+ opus: "opus";
6
+ g722: "g722";
7
+ ulaw: "ulaw";
8
+ }>>;
9
+ id: z.ZodString;
10
+ protocol: z.ZodEnum<{
11
+ iax2: "iax2";
12
+ }>;
13
+ }, z.core.$strict>;
14
+ export declare const PrefixSchema: z.ZodObject<{
15
+ description: z.ZodOptional<z.ZodString>;
16
+ exchange: z.ZodString;
17
+ id: z.ZodString;
18
+ prefix: z.ZodE164;
19
+ }, z.core.$strict>;
20
+ export declare const PhonebookSchema: z.ZodObject<{
21
+ format: z.ZodEnum<{
22
+ hackfed: "hackfed";
23
+ }>;
24
+ url: z.ZodURL;
25
+ }, z.core.$strict>;
26
+ export declare const TelephonyServiceSchema: z.ZodObject<{
27
+ exchanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
+ address: z.ZodString;
29
+ codecs: z.ZodArray<z.ZodEnum<{
30
+ opus: "opus";
31
+ g722: "g722";
32
+ ulaw: "ulaw";
33
+ }>>;
34
+ id: z.ZodString;
35
+ protocol: z.ZodEnum<{
36
+ iax2: "iax2";
37
+ }>;
38
+ }, z.core.$strict>>>;
39
+ phonebook: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
+ format: z.ZodEnum<{
41
+ hackfed: "hackfed";
42
+ }>;
43
+ url: z.ZodURL;
44
+ }, z.core.$strict>>>;
45
+ prefixes: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ description: z.ZodOptional<z.ZodString>;
47
+ exchange: z.ZodString;
48
+ id: z.ZodString;
49
+ prefix: z.ZodE164;
50
+ }, z.core.$strict>>>;
51
+ }, z.core.$strict>;
52
+ export type TelephonyService = z.infer<typeof TelephonyServiceSchema>;
53
+ export type Exchange = z.infer<typeof ExchangeSchema>;
54
+ export type Prefix = z.infer<typeof PrefixSchema>;
55
+ export type Phonebook = z.infer<typeof PhonebookSchema>;
56
+ export declare const __schemas: z.ZodObject<{
57
+ exchanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
58
+ address: z.ZodString;
59
+ codecs: z.ZodArray<z.ZodEnum<{
60
+ opus: "opus";
61
+ g722: "g722";
62
+ ulaw: "ulaw";
63
+ }>>;
64
+ id: z.ZodString;
65
+ protocol: z.ZodEnum<{
66
+ iax2: "iax2";
67
+ }>;
68
+ }, z.core.$strict>>>;
69
+ phonebook: z.ZodOptional<z.ZodArray<z.ZodObject<{
70
+ format: z.ZodEnum<{
71
+ hackfed: "hackfed";
72
+ }>;
73
+ url: z.ZodURL;
74
+ }, z.core.$strict>>>;
75
+ prefixes: z.ZodOptional<z.ZodArray<z.ZodObject<{
76
+ description: z.ZodOptional<z.ZodString>;
77
+ exchange: z.ZodString;
78
+ id: z.ZodString;
79
+ prefix: z.ZodE164;
80
+ }, z.core.$strict>>>;
81
+ }, z.core.$strict>[];
@@ -1,54 +1,44 @@
1
- import { z } from 'zod'
2
-
1
+ import { z } from 'zod';
3
2
  export const ExchangeSchema = z
4
- .object({
3
+ .object({
5
4
  address: z
6
- .string()
7
- .describe('Network address and port of the exchange (e.g., [IPv6]:port or IPv4:port)'),
5
+ .string()
6
+ .describe('Network address and port of the exchange (e.g., [IPv6]:port or IPv4:port)'),
8
7
  codecs: z
9
- .array(z.enum(['opus', 'g722', 'ulaw']))
10
- .min(1)
11
- .describe('Supported audio codecs'),
8
+ .array(z.enum(['opus', 'g722', 'ulaw']))
9
+ .min(1)
10
+ .describe('Supported audio codecs'),
12
11
  id: z.string().describe('Unique identifier for the exchange'),
13
12
  protocol: z.enum(['iax2']).describe('Telephony protocol used by the exchange'),
14
- })
15
- .strict()
16
-
13
+ })
14
+ .strict();
17
15
  export const PrefixSchema = z
18
- .object({
16
+ .object({
19
17
  description: z.string().describe('Human-readable description of the prefix').optional(),
20
18
  exchange: z.string().describe('Reference to the exchange ID handling this prefix'),
21
19
  id: z.string().describe('Unique identifier for the prefix'),
22
20
  prefix: z.e164().describe('Numeric prefix for phone numbers'),
23
- })
24
- .strict()
25
-
21
+ })
22
+ .strict();
26
23
  export const PhonebookSchema = z
27
- .object({
24
+ .object({
28
25
  format: z.enum(['hackfed']).describe('Format of the phonebook data'),
29
26
  url: z.url().describe('URL to the phonebook resource'),
30
- })
31
- .strict()
32
-
27
+ })
28
+ .strict();
33
29
  export const TelephonyServiceSchema = z
34
- .object({
30
+ .object({
35
31
  exchanges: z.array(ExchangeSchema).describe('List of telephony exchanges').optional(),
36
32
  phonebook: z.array(PhonebookSchema).describe('Public phonebook URLs').optional(),
37
33
  prefixes: z
38
- .array(PrefixSchema)
39
- .describe('Telephony number prefixes allocated to the organization')
40
- .optional(),
41
- })
42
- .strict()
43
- .meta({
34
+ .array(PrefixSchema)
35
+ .describe('Telephony number prefixes allocated to the organization')
36
+ .optional(),
37
+ })
38
+ .strict()
39
+ .meta({
44
40
  description: 'Telephony configuration including exchanges, prefixes, and phonebook',
45
41
  id: 'TelephonyService',
46
42
  title: 'Organization Telephony Service',
47
- })
48
-
49
- export type TelephonyService = z.infer<typeof TelephonyServiceSchema>
50
- export type Exchange = z.infer<typeof ExchangeSchema>
51
- export type Prefix = z.infer<typeof PrefixSchema>
52
- export type Phonebook = z.infer<typeof PhonebookSchema>
53
-
54
- export const __schemas = [TelephonyServiceSchema]
43
+ });
44
+ export const __schemas = [TelephonyServiceSchema];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackfed/schemas",
3
- "version": "0.0.5",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -8,10 +8,13 @@
8
8
  "url": "git+https://github.com/hackfed/schemas.git"
9
9
  },
10
10
  "exports": {
11
- "./*": "./src/schemas/*"
11
+ "./v1": {
12
+ "import": "./dist/v1/index.js",
13
+ "types": "./dist/v1/index.d.ts"
14
+ }
12
15
  },
13
16
  "files": [
14
- "src/schemas",
17
+ "dist",
15
18
  "LICENSE",
16
19
  "README"
17
20
  ],
@@ -22,6 +25,7 @@
22
25
  "change-case": "^5.4.4",
23
26
  "eslint": "^9.39.2",
24
27
  "glob": "^13.0.0",
28
+ "rimraf": "^6.1.2",
25
29
  "tsx": "^4.21.0",
26
30
  "typescript": "^5.9.3",
27
31
  "zod": "4"
@@ -30,6 +34,8 @@
30
34
  "zod": "4"
31
35
  },
32
36
  "scripts": {
33
- "generate": "tsx src/cmd/generate-json-schemas.ts"
37
+ "generate": "tsx src/cmd/generate-json-schemas.ts",
38
+ "build": "rimraf dist && tsc",
39
+ "lint": "tsc --noEmit && eslint ."
34
40
  }
35
41
  }
@@ -1 +0,0 @@
1
- /* eslint-disable-next-line unicorn/no-empty-file -- this is a stub file. */
@@ -1,17 +0,0 @@
1
- import { z } from 'zod'
2
-
3
- export const Inet6NumberSchema = z
4
- .string()
5
- .regex(
6
- /^(((?:[0-9A-Fa-f]{1,4}))*((?::[0-9A-Fa-f]{1,4}))*::((?:[0-9A-Fa-f]{1,4}))*((?::[0-9A-Fa-f]{1,4}))*|((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4})){7})(\/([1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])){0,1}$/
7
- )
8
- .meta({
9
- description: 'An IPv6 address in standard notation',
10
- examples: ['fd79:7636:1f08:883d::008', '2001:db8::1', '::1', 'fe80::1/128'],
11
- id: 'Inet6Number',
12
- title: 'IPv6 Address',
13
- })
14
-
15
- export type Inet6Number = z.infer<typeof Inet6NumberSchema>
16
-
17
- export const __schemas = [Inet6NumberSchema]
@@ -1,17 +0,0 @@
1
- import { z } from 'zod'
2
-
3
- export const OrganizationIdSchema = z
4
- .string()
5
- .regex(/^[a-z0-9]*$/)
6
- .min(4)
7
- .max(16)
8
- .meta({
9
- description: 'A unique identifier for an organization in the Hackfed registry',
10
- examples: ['bksp', 'xkem'],
11
- id: 'OrganizationId',
12
- title: 'Organization ID',
13
- })
14
-
15
- export type OrganizationId = z.infer<typeof OrganizationIdSchema>
16
-
17
- export const __schemas = [OrganizationIdSchema]
@@ -1,48 +0,0 @@
1
- import { z } from 'zod'
2
-
3
- import { OrganizationIdSchema } from '../base/organization-id'
4
-
5
- export const DirectoryExchangeSchema = z
6
- .object({
7
- codecs: z
8
- .array(z.enum(['opus', 'g722', 'ulaw']))
9
- .min(1)
10
- .describe('Supported audio codecs'),
11
- endpoint: z
12
- .string()
13
- .describe('Network address and port of the exchange (e.g., [IPv6]:port or IPv4:port)'),
14
- id: z.string().describe('Unique exchange identifier within the organization'),
15
- prefixes: z
16
- .array(z.e164().describe('Telephony number prefix (e.g., country or area code)'))
17
- .describe('Telephony number prefixes allocated to the organization for this exchange'),
18
- protocol: z.enum(['iax2']).describe('Telephony protocol used by the exchange'),
19
- })
20
- .strict()
21
-
22
- export const DirectoryOrgSchema = z
23
- .object({
24
- exchanges: z
25
- .array(DirectoryExchangeSchema)
26
- .describe('List of telephony exchanges for the organization'),
27
- name: z.string().describe('Name of the organization'),
28
- orgId: OrganizationIdSchema.describe('Unique identifier for the organization'),
29
- })
30
- .strict()
31
-
32
- export const TelephonyDirectorySchema = z
33
- .object({
34
- orgs: z
35
- .array(DirectoryOrgSchema)
36
- .describe('List of organizations participating in Hackfed Telephony Network.'),
37
- })
38
- .meta({
39
- description: 'Aggregated telephony service information for Hackfed network members.',
40
- id: 'TelephonyDirectory',
41
- title: 'Hackfed Telephony Directory',
42
- })
43
-
44
- export type TelephonyDirectory = z.infer<typeof TelephonyDirectorySchema>
45
- export type DirectoryOrg = z.infer<typeof DirectoryOrgSchema>
46
- export type DirectoryExchange = z.infer<typeof DirectoryExchangeSchema>
47
-
48
- export const __schemas = [TelephonyDirectorySchema]
@@ -1,47 +0,0 @@
1
- import { z } from 'zod'
2
-
3
- import { OrganizationIdSchema } from '../base/organization-id'
4
- import { AboutServiceSchema } from '../service/about'
5
- import { AccessServiceSchema } from '../service/access'
6
- import { NebulaServiceSchema } from '../service/nebula'
7
- import { TelephonyServiceSchema } from '../service/telephony'
8
-
9
- export const OrganizationSchema = z
10
- .object({
11
- apiVersion: z.literal('hackfed/v1').describe('API version identifier'),
12
- kind: z.literal('Organization').describe('Resource type'),
13
- metadata: z
14
- .object({
15
- orgId: OrganizationIdSchema.describe('Identifier of the organization owning this resource'),
16
- })
17
- .describe('Metadata about the organization'),
18
- spec: z
19
- .object({
20
- id: OrganizationIdSchema.describe('Organization ID (must match metadata.orgId)'),
21
- name: z
22
- .string()
23
- .min(4)
24
- .max(64)
25
- .describe('Human-readable organization name'),
26
- services: z
27
- .object({
28
- about: AboutServiceSchema.optional(),
29
- access: AccessServiceSchema.optional(),
30
- nebula: NebulaServiceSchema.optional(),
31
- telephony: TelephonyServiceSchema.optional(),
32
- })
33
- .describe('Services provided by the organization')
34
- .optional(),
35
- })
36
- .strict()
37
- .describe('Organization specification'),
38
- })
39
- .meta({
40
- description: 'Complete organization entity definition for Hackfed registry',
41
- id: 'Organization',
42
- title: 'Hackfed Organization',
43
- })
44
-
45
- export type Organization = z.infer<typeof OrganizationSchema>
46
-
47
- export const __schemas = [OrganizationSchema]
@@ -1,42 +0,0 @@
1
- import { z } from 'zod'
2
-
3
- export const GithubMaintainerSchema = z
4
- .object({
5
- type: z.literal('github'),
6
- username: z.string().describe('Username for GitHub type maintainers'),
7
- })
8
- .describe('Maintainer identified by GitHub username')
9
-
10
- export const EmailMaintainerSchema = z
11
- .object({
12
- email: z.email().describe('Email address for email type maintainers'),
13
- type: z.literal('email'),
14
- })
15
- .describe('Maintainer identified by email address')
16
-
17
- export const MaintainerSchema = z.discriminatedUnion('type', [
18
- GithubMaintainerSchema,
19
- EmailMaintainerSchema,
20
- ])
21
-
22
- export const AccessServiceSchema = z
23
- .object({
24
- maintainers: z
25
- .array(MaintainerSchema)
26
- .min(1)
27
- .describe('List of organization maintainers')
28
- .optional(),
29
- })
30
- .strict()
31
- .meta({
32
- description: 'Access control and maintainer information for an organization',
33
- id: 'AccessService',
34
- title: 'Organization Access Service',
35
- })
36
-
37
- export type AccessService = z.infer<typeof AccessServiceSchema>
38
- export type Maintainer = z.infer<typeof MaintainerSchema>
39
- export type GithubMaintainer = z.infer<typeof GithubMaintainerSchema>
40
- export type EmailMaintainer = z.infer<typeof EmailMaintainerSchema>
41
-
42
- export const __schemas = [AccessServiceSchema]
@@ -1,42 +0,0 @@
1
- import { z } from 'zod'
2
-
3
- import { Inet6NumberSchema } from '../base/inet6-number'
4
-
5
- export const NebulaNodeSchema = z
6
- .object({
7
- address: Inet6NumberSchema.describe('IPv6 address of the Nebula node'),
8
- certificates: z
9
- .array(
10
- z
11
- .string()
12
- .regex(/^[a-f0-9]{64}$/)
13
- .describe('SHA-256 certificate fingerprint in hexadecimal')
14
- )
15
- .min(1)
16
- .describe('List of certificate fingerprints for the node')
17
- .optional(),
18
- lighthouse: z
19
- .object({
20
- enabled: z.boolean().describe('Whether this node acts as a lighthouse'),
21
- endpoints: z
22
- .array(z.string().describe('Endpoint in format host:port'))
23
- .min(1)
24
- .describe('Public endpoints for lighthouse connectivity')
25
- .optional(),
26
- })
27
- .strict()
28
- .describe('Lighthouse configuration for the node')
29
- .optional(),
30
- })
31
- .strict()
32
-
33
- export const NebulaServiceSchema = z.array(NebulaNodeSchema).meta({
34
- description: 'Nebula VPN network configuration for the organization',
35
- id: 'NebulaService',
36
- title: 'Organization Nebula Service',
37
- })
38
-
39
- export type NebulaService = z.infer<typeof NebulaServiceSchema>
40
- export type NebulaNode = z.infer<typeof NebulaNodeSchema>
41
-
42
- export const __schemas = [NebulaServiceSchema]