@magidoc/plugin-starter-variables 2.2.1 → 2.4.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/build/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import templates from './variables/templates';
2
2
  import magidoc from './variables/magidoc';
3
3
  import { toVariablesFile, UnsupportedVariablesError } from './env/envFileContent';
4
4
  import type { Variable } from './variables/variable';
5
- import type { Page } from './variables/templates';
5
+ import type { Page, ExternalLink } from './variables/templates';
6
+ export type { Variable, Page, ExternalLink };
6
7
  export { templates };
7
8
  export { magidoc };
8
- export type { Variable, Page };
9
9
  export { toVariablesFile, UnsupportedVariablesError };
@@ -2,6 +2,12 @@ export declare type Page = {
2
2
  title: string;
3
3
  content: string | Page[];
4
4
  };
5
+ export declare type ExternalLink = {
6
+ label: string;
7
+ href: string;
8
+ kind?: string;
9
+ group?: string;
10
+ };
5
11
  declare const _default: {
6
12
  APP_LOGO: import("./variable").Variable<string>;
7
13
  APP_TITLE: import("./variable").Variable<string>;
@@ -10,5 +16,6 @@ declare const _default: {
10
16
  SITE_META: import("./variable").Variable<Record<string, string | undefined>>;
11
17
  QUERY_GENERATION_FACTORIES: import("./variable").Variable<Record<string, string | number | boolean | Record<string, unknown> | null | undefined>>;
12
18
  PAGES: import("./variable").Variable<(Page | undefined)[]>;
19
+ EXTERNAL_LINKS: import("./variable").Variable<(ExternalLink | undefined)[]>;
13
20
  };
14
21
  export default _default;
@@ -18,11 +18,19 @@ var templates = {
18
18
  ]))),
19
19
  PAGES: createVariable('PAGES', arrayConverter((zod) => {
20
20
  const type = zod.lazy(() => zod.object({
21
- title: zod.string().nonempty(),
22
- content: zod.union([zod.array(type), zod.string().nonempty()]),
21
+ title: zod.string().min(1),
22
+ content: zod.union([zod.array(type), zod.string().min(1)]),
23
23
  }));
24
24
  return type;
25
25
  })),
26
+ EXTERNAL_LINKS: createVariable('EXTERNAL_LINKS', arrayConverter((zod) => {
27
+ return zod.object({
28
+ label: zod.string().min(1),
29
+ href: zod.string().min(1),
30
+ kind: zod.string().min(1).optional(),
31
+ group: zod.string().min(1).optional(),
32
+ });
33
+ })),
26
34
  };
27
35
 
28
36
  export { templates as default };
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sources":["../../../src/variables/templates.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AASA,gBAAe;AACb,IAAA,QAAQ,EAAE,cAAc,CAAS,UAAU,EAAE,eAAe,EAAE,CAAC;AAC/D,IAAA,SAAS,EAAE,cAAc,CAAS,WAAW,EAAE,eAAe,EAAE,CAAC;AACjE,IAAA,WAAW,EAAE,cAAc,CAAS,aAAa,EAAE,eAAe,EAAE,CAAC;AACrE,IAAA,SAAS,EAAE,cAAc,CAAS,WAAW,EAAE,eAAe,EAAE,CAAC;AACjE,IAAA,SAAS,EAAE,cAAc,CACvB,WAAW,EACX,eAAe,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC,CACvC;AACD,IAAA,0BAA0B,EAAE,cAAc,CAMxC,4BAA4B,EAC5B,eAAe,CAAC,CAAC,GAAG,KAClB,GAAG,CAAC,KAAK,CAAC;QACR,GAAG,CAAC,MAAM,EAAE;QACZ,GAAG,CAAC,OAAO,EAAE;QACb,GAAG,CAAC,MAAM,EAAE;QACZ,GAAG,CAAC,IAAI,EAAE;AACV,QAAA,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;AAC1B,KAAA,CAAC,CACH,CACF;IACD,KAAK,EAAE,cAAc,CACnB,OAAO,EACP,cAAc,CAAC,CAAC,GAAG,KAAI;AACrB,QAAA,MAAM,IAAI,GAAkB,GAAG,CAAC,IAAI,CAAC,MACnC,GAAG,CAAC,MAAM,CAAC;AACT,YAAA,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC9B,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,I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AAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,SAAA,CAAC,CACH,CAAA;AACD,QAAA,OAAO,IAAI,CAAA;AACb,KAAC,CAAC,CACH;IACD,cAAc,EAAE,cAAc,CAC5B,gBAAgB,EAChB,cAAc,CAAC,CAAC,GAAG,KAAI;QACrB,OAAO,GAAG,CAAC,MAAM,CAAC;YAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACzB,YAAA,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;AACpC,YAAA,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;AACtC,SAAA,CAAC,CAAA;AACJ,KAAC,CAAC,CACH;CACF;;;;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@magidoc/plugin-starter-variables",
3
3
  "description": "A shared library that contains common Magidoc starter environment variables keys.",
4
4
  "private": false,
5
- "version": "2.2.1",
5
+ "version": "2.4.0",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "./build/index.js",
package/src/index.ts CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  UnsupportedVariablesError,
6
6
  } from './env/envFileContent'
7
7
  import type { Variable } from './variables/variable'
8
- import type { Page } from './variables/templates'
8
+ import type { Page, ExternalLink } from './variables/templates'
9
9
 
10
+ export type { Variable, Page, ExternalLink }
10
11
  export { templates }
11
12
  export { magidoc }
12
- export type { Variable, Page }
13
13
  export { toVariablesFile, UnsupportedVariablesError }
@@ -7,6 +7,13 @@ export type Page = {
7
7
  content: string | Page[]
8
8
  }
9
9
 
10
+ export type ExternalLink = {
11
+ label: string
12
+ href: string
13
+ kind?: string
14
+ group?: string
15
+ }
16
+
10
17
  export default {
11
18
  APP_LOGO: createVariable<string>('APP_LOGO', stringConverter()),
12
19
  APP_TITLE: createVariable<string>('APP_TITLE', stringConverter()),
@@ -38,11 +45,22 @@ export default {
38
45
  arrayConverter((zod) => {
39
46
  const type: ZodType<Page> = zod.lazy(() =>
40
47
  zod.object({
41
- title: zod.string().nonempty(),
42
- content: zod.union([zod.array(type), zod.string().nonempty()]),
48
+ title: zod.string().min(1),
49
+ content: zod.union([zod.array(type), zod.string().min(1)]),
43
50
  }),
44
51
  )
45
52
  return type
46
53
  }),
47
54
  ),
55
+ EXTERNAL_LINKS: createVariable<Array<ExternalLink | undefined>>(
56
+ 'EXTERNAL_LINKS',
57
+ arrayConverter((zod) => {
58
+ return zod.object({
59
+ label: zod.string().min(1),
60
+ href: zod.string().min(1),
61
+ kind: zod.string().min(1).optional(),
62
+ group: zod.string().min(1).optional(),
63
+ })
64
+ }),
65
+ ),
48
66
  }
@@ -24,6 +24,7 @@ describe('variables', () => {
24
24
  'SITE_META',
25
25
  'QUERY_GENERATION_FACTORIES',
26
26
  'PAGES',
27
+ 'EXTERNAL_LINKS',
27
28
  ])
28
29
  })
29
30
 
@@ -101,6 +102,23 @@ describe('variables', () => {
101
102
  z.array(pagesType).optional(),
102
103
  )
103
104
  })
105
+
106
+ test('external links', () => {
107
+ testArrayVariable(
108
+ variables.templates.EXTERNAL_LINKS,
109
+ 'EXTERNAL_LINKS',
110
+ z
111
+ .array(
112
+ z.object({
113
+ label: z.string().min(1),
114
+ href: z.string().min(1),
115
+ kind: z.string().min(1).optional(),
116
+ group: z.string().min(1).optional(),
117
+ }),
118
+ )
119
+ .optional(),
120
+ )
121
+ })
104
122
  })
105
123
 
106
124
  describe('magidoc variables', () => {