@brunosouzas/stackledger 0.0.0-stage → 0.5.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/LICENSE +202 -0
- package/README.md +261 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +97 -0
- package/dist/cli.js.map +1 -0
- package/dist/control.d.ts +2 -0
- package/dist/control.js +22 -0
- package/dist/control.js.map +1 -0
- package/dist/discover-command.d.ts +7 -0
- package/dist/discover-command.js +60 -0
- package/dist/discover-command.js.map +1 -0
- package/dist/discovery/annotations.d.ts +24 -0
- package/dist/discovery/annotations.js +37 -0
- package/dist/discovery/annotations.js.map +1 -0
- package/dist/discovery/host.d.ts +47 -0
- package/dist/discovery/host.js +56 -0
- package/dist/discovery/host.js.map +1 -0
- package/dist/discovery/index.d.ts +15 -0
- package/dist/discovery/index.js +30 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/machine.d.ts +14 -0
- package/dist/discovery/machine.js +17 -0
- package/dist/discovery/machine.js.map +1 -0
- package/dist/discovery/run.d.ts +39 -0
- package/dist/discovery/run.js +130 -0
- package/dist/discovery/run.js.map +1 -0
- package/dist/discovery/snapshot.d.ts +60 -0
- package/dist/discovery/snapshot.js +161 -0
- package/dist/discovery/snapshot.js.map +1 -0
- package/dist/discovery/sources/apps.d.ts +3 -0
- package/dist/discovery/sources/apps.js +136 -0
- package/dist/discovery/sources/apps.js.map +1 -0
- package/dist/discovery/sources/brew.d.ts +15 -0
- package/dist/discovery/sources/brew.js +69 -0
- package/dist/discovery/sources/brew.js.map +1 -0
- package/dist/discovery/sources/common.d.ts +39 -0
- package/dist/discovery/sources/common.js +70 -0
- package/dist/discovery/sources/common.js.map +1 -0
- package/dist/discovery/sources/index.d.ts +8 -0
- package/dist/discovery/sources/index.js +12 -0
- package/dist/discovery/sources/index.js.map +1 -0
- package/dist/discovery/sources/launchd.d.ts +3 -0
- package/dist/discovery/sources/launchd.js +65 -0
- package/dist/discovery/sources/launchd.js.map +1 -0
- package/dist/discovery/sources/mas.d.ts +9 -0
- package/dist/discovery/sources/mas.js +25 -0
- package/dist/discovery/sources/mas.js.map +1 -0
- package/dist/discovery/sources/mise.d.ts +5 -0
- package/dist/discovery/sources/mise.js +64 -0
- package/dist/discovery/sources/mise.js.map +1 -0
- package/dist/discovery/sources/npm.d.ts +12 -0
- package/dist/discovery/sources/npm.js +34 -0
- package/dist/discovery/sources/npm.js.map +1 -0
- package/dist/discovery/sources/pipx.d.ts +4 -0
- package/dist/discovery/sources/pipx.js +82 -0
- package/dist/discovery/sources/pipx.js.map +1 -0
- package/dist/discovery/types.d.ts +73 -0
- package/dist/discovery/types.js +10 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/discovery/write.d.ts +50 -0
- package/dist/discovery/write.js +196 -0
- package/dist/discovery/write.js.map +1 -0
- package/dist/drift-command.d.ts +62 -0
- package/dist/drift-command.js +375 -0
- package/dist/drift-command.js.map +1 -0
- package/dist/drift-formats.d.ts +3 -0
- package/dist/drift-formats.js +54 -0
- package/dist/drift-formats.js.map +1 -0
- package/dist/drift.d.ts +95 -0
- package/dist/drift.js +206 -0
- package/dist/drift.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +26 -0
- package/dist/errors.js.map +1 -0
- package/dist/graph.d.ts +103 -0
- package/dist/graph.js +181 -0
- package/dist/graph.js.map +1 -0
- package/dist/ics.d.ts +18 -0
- package/dist/ics.js +103 -0
- package/dist/ics.js.map +1 -0
- package/dist/identity.d.ts +18 -0
- package/dist/identity.js +36 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/map/badges.d.ts +20 -0
- package/dist/map/badges.js +95 -0
- package/dist/map/badges.js.map +1 -0
- package/dist/map/command.d.ts +8 -0
- package/dist/map/command.js +86 -0
- package/dist/map/command.js.map +1 -0
- package/dist/map/heap.d.ts +15 -0
- package/dist/map/heap.js +57 -0
- package/dist/map/heap.js.map +1 -0
- package/dist/map/ink.d.ts +11 -0
- package/dist/map/ink.js +10 -0
- package/dist/map/ink.js.map +1 -0
- package/dist/map/labels.d.ts +43 -0
- package/dist/map/labels.js +172 -0
- package/dist/map/labels.js.map +1 -0
- package/dist/map/layout.d.ts +64 -0
- package/dist/map/layout.js +228 -0
- package/dist/map/layout.js.map +1 -0
- package/dist/map/model.d.ts +46 -0
- package/dist/map/model.js +84 -0
- package/dist/map/model.js.map +1 -0
- package/dist/map/neighbourhood.d.ts +18 -0
- package/dist/map/neighbourhood.js +137 -0
- package/dist/map/neighbourhood.js.map +1 -0
- package/dist/map/parallel.d.ts +35 -0
- package/dist/map/parallel.js +261 -0
- package/dist/map/parallel.js.map +1 -0
- package/dist/map/pieces.d.ts +12 -0
- package/dist/map/pieces.js +15 -0
- package/dist/map/pieces.js.map +1 -0
- package/dist/map/relations.d.ts +39 -0
- package/dist/map/relations.js +122 -0
- package/dist/map/relations.js.map +1 -0
- package/dist/map/route.d.ts +25 -0
- package/dist/map/route.js +165 -0
- package/dist/map/route.js.map +1 -0
- package/dist/map/strip.d.ts +29 -0
- package/dist/map/strip.js +120 -0
- package/dist/map/strip.js.map +1 -0
- package/dist/map/suggest.d.ts +21 -0
- package/dist/map/suggest.js +97 -0
- package/dist/map/suggest.js.map +1 -0
- package/dist/map/svg.d.ts +29 -0
- package/dist/map/svg.js +203 -0
- package/dist/map/svg.js.map +1 -0
- package/dist/map/themes.d.ts +64 -0
- package/dist/map/themes.js +94 -0
- package/dist/map/themes.js.map +1 -0
- package/dist/map/xml.d.ts +6 -0
- package/dist/map/xml.js +57 -0
- package/dist/map/xml.js.map +1 -0
- package/dist/map/zones.d.ts +19 -0
- package/dist/map/zones.js +46 -0
- package/dist/map/zones.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +145 -0
- package/dist/mcp.js.map +1 -0
- package/dist/money.d.ts +32 -0
- package/dist/money.js +91 -0
- package/dist/money.js.map +1 -0
- package/dist/report-command.d.ts +3 -0
- package/dist/report-command.js +85 -0
- package/dist/report-command.js.map +1 -0
- package/dist/report-formats.d.ts +11 -0
- package/dist/report-formats.js +157 -0
- package/dist/report-formats.js.map +1 -0
- package/dist/reports.d.ts +105 -0
- package/dist/reports.js +247 -0
- package/dist/reports.js.map +1 -0
- package/dist/scaffold.d.ts +30 -0
- package/dist/scaffold.js +140 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schema.d.ts +345 -0
- package/dist/schema.js +120 -0
- package/dist/schema.js.map +1 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.js +68 -0
- package/dist/secrets.js.map +1 -0
- package/dist/site/build.d.ts +22 -0
- package/dist/site/build.js +198 -0
- package/dist/site/build.js.map +1 -0
- package/dist/site/command.d.ts +2 -0
- package/dist/site/command.js +221 -0
- package/dist/site/command.js.map +1 -0
- package/dist/site/data.d.ts +225 -0
- package/dist/site/data.js +243 -0
- package/dist/site/data.js.map +1 -0
- package/dist/site/fs-ops.d.ts +35 -0
- package/dist/site/fs-ops.js +26 -0
- package/dist/site/fs-ops.js.map +1 -0
- package/dist/site/owners.d.ts +5 -0
- package/dist/site/owners.js +50 -0
- package/dist/site/owners.js.map +1 -0
- package/dist/site/paths.d.ts +34 -0
- package/dist/site/paths.js +48 -0
- package/dist/site/paths.js.map +1 -0
- package/dist/site/policy.d.ts +17 -0
- package/dist/site/policy.js +26 -0
- package/dist/site/policy.js.map +1 -0
- package/dist/site/publish.d.ts +14 -0
- package/dist/site/publish.js +90 -0
- package/dist/site/publish.js.map +1 -0
- package/dist/site/relative.d.ts +14 -0
- package/dist/site/relative.js +265 -0
- package/dist/site/relative.js.map +1 -0
- package/dist/site/skills-build.d.ts +22 -0
- package/dist/site/skills-build.js +126 -0
- package/dist/site/skills-build.js.map +1 -0
- package/dist/site/skills-data.d.ts +89 -0
- package/dist/site/skills-data.js +94 -0
- package/dist/site/skills-data.js.map +1 -0
- package/dist/site/staging.d.ts +19 -0
- package/dist/site/staging.js +76 -0
- package/dist/site/staging.js.map +1 -0
- package/dist/site/ui-icons.d.ts +4 -0
- package/dist/site/ui-icons.js +19 -0
- package/dist/site/ui-icons.js.map +1 -0
- package/dist/skills/command.d.ts +8 -0
- package/dist/skills/command.js +64 -0
- package/dist/skills/command.js.map +1 -0
- package/dist/skills/frontmatter.d.ts +37 -0
- package/dist/skills/frontmatter.js +219 -0
- package/dist/skills/frontmatter.js.map +1 -0
- package/dist/skills/graph.d.ts +39 -0
- package/dist/skills/graph.js +100 -0
- package/dist/skills/graph.js.map +1 -0
- package/dist/skills/ignore.d.ts +34 -0
- package/dist/skills/ignore.js +138 -0
- package/dist/skills/ignore.js.map +1 -0
- package/dist/skills/lines.d.ts +53 -0
- package/dist/skills/lines.js +221 -0
- package/dist/skills/lines.js.map +1 -0
- package/dist/skills/map-command.d.ts +28 -0
- package/dist/skills/map-command.js +533 -0
- package/dist/skills/map-command.js.map +1 -0
- package/dist/skills/mermaid.d.ts +29 -0
- package/dist/skills/mermaid.js +261 -0
- package/dist/skills/mermaid.js.map +1 -0
- package/dist/skills/metro.d.ts +8 -0
- package/dist/skills/metro.js +93 -0
- package/dist/skills/metro.js.map +1 -0
- package/dist/skills/read.d.ts +17 -0
- package/dist/skills/read.js +54 -0
- package/dist/skills/read.js.map +1 -0
- package/dist/skills/rules.d.ts +28 -0
- package/dist/skills/rules.js +57 -0
- package/dist/skills/rules.js.map +1 -0
- package/dist/skills/source.d.ts +66 -0
- package/dist/skills/source.js +281 -0
- package/dist/skills/source.js.map +1 -0
- package/dist/skills/walk.d.ts +64 -0
- package/dist/skills/walk.js +281 -0
- package/dist/skills/walk.js.map +1 -0
- package/dist/source.d.ts +40 -0
- package/dist/source.js +199 -0
- package/dist/source.js.map +1 -0
- package/dist/stdout.d.ts +2 -0
- package/dist/stdout.js +24 -0
- package/dist/stdout.js.map +1 -0
- package/dist/validate.d.ts +45 -0
- package/dist/validate.js +321 -0
- package/dist/validate.js.map +1 -0
- package/dist/views.d.ts +25 -0
- package/dist/views.js +58 -0
- package/dist/views.js.map +1 -0
- package/examples/catalogue-repository/.github/workflows/stackledger.yml +122 -0
- package/examples/catalogue-repository/README.md +96 -0
- package/examples/catalogue-repository/catalog/catalog-info.yaml +12 -0
- package/examples/hosting/Caddyfile +69 -0
- package/examples/northwind/catalog-info.yaml +680 -0
- package/examples/northwind/stackledger.yaml +16 -0
- package/examples/northwind-machine/snapshot.json +309 -0
- package/examples/northwind-skills/agents/builder.md +10 -0
- package/examples/northwind-skills/agents/reviewer.md +10 -0
- package/examples/northwind-skills/designer/SKILL.md +8 -0
- package/examples/northwind-skills/editor/SKILL.md +8 -0
- package/examples/northwind-skills/engineering/SKILL.md +12 -0
- package/examples/northwind-skills/linter/SKILL.md +8 -0
- package/examples/northwind-skills/linter/rules.md +5 -0
- package/examples/northwind-skills/publishing/SKILL.md +12 -0
- package/examples/northwind-skills/publishing/rules.md +5 -0
- package/examples/northwind-skills/spec-writer/SKILL.md +8 -0
- package/examples/northwind-skills/stackledger-skills.yaml +51 -0
- package/examples/northwind-skills/tester/SKILL.md +10 -0
- package/examples/northwind-skills/writer/SKILL.md +8 -0
- package/examples/northwind-skills/writer/rules.md +6 -0
- package/npm-shrinkwrap.json +5016 -0
- package/package.json +52 -4
- package/site/LICENSE-astroplate +21 -0
- package/site/README.md +18 -0
- package/site/package.json +6 -0
- package/site/public/brand-mark-dark.svg +7 -0
- package/site/public/favicon.svg +6 -0
- package/site/public/home-banner.svg +93 -0
- package/site/public/link-icons/email-dark.svg +7 -0
- package/site/public/link-icons/email-light.svg +6 -0
- package/site/public/link-icons/github-dark.svg +8 -0
- package/site/public/link-icons/github-light.svg +7 -0
- package/site/public/link-icons/linkedin-dark.svg +8 -0
- package/site/public/link-icons/linkedin-light.svg +7 -0
- package/site/public/link-icons/website-dark.svg +8 -0
- package/site/public/link-icons/website-light.svg +7 -0
- package/site/src/components/Footer.astro +25 -0
- package/site/src/components/Header.astro +35 -0
- package/site/src/components/Impact.astro +55 -0
- package/site/src/components/LinkOrText.astro +12 -0
- package/site/src/components/SkillItem.astro +141 -0
- package/site/src/components/SubNav.astro +40 -0
- package/site/src/components/ThemeSwitch.astro +13 -0
- package/site/src/components/Themed.astro +15 -0
- package/site/src/layouts/Base.astro +52 -0
- package/site/src/lib/site.ts +25 -0
- package/site/src/pages/[reports].astro +222 -0
- package/site/src/pages/agents/[file].astro +14 -0
- package/site/src/pages/index.astro +72 -0
- package/site/src/pages/journeys/[name].astro +50 -0
- package/site/src/pages/journeys/index.astro +37 -0
- package/site/src/pages/licences/[name].astro +56 -0
- package/site/src/pages/map/index.astro +78 -0
- package/site/src/pages/playbooks/[file].astro +14 -0
- package/site/src/pages/rules/[...rules].astro +61 -0
- package/site/src/pages/skill-map/[...map].astro +101 -0
- package/site/src/pages/skills/[...list].astro +75 -0
- package/site/src/pages/skills/[file].astro +14 -0
- package/site/src/pages/software/[name].astro +155 -0
- package/site/src/pages/software/index.astro +71 -0
- package/site/src/scripts/diagram.ts +8 -0
- package/site/src/scripts/links.ts +31 -0
- package/site/src/scripts/map.ts +133 -0
- package/site/src/scripts/software.ts +32 -0
- package/site/src/scripts/theme.ts +52 -0
- package/site/src/styles/base.css +481 -0
- package/site/src/styles/fonts.css +60 -0
- package/site/src/styles/override.css +1 -0
- package/site/src/styles/pages.css +315 -0
- package/site/src/styles/tokens.css +87 -0
- package/skills/stackledger/SKILL.md +155 -0
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/** Runtime schemas and inferred catalogue types. Imported by validator; run npm run build.
|
|
2
|
+
* Backstage extensions survive, but drawing kinds and licence details reject typos.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const name: z.ZodString;
|
|
6
|
+
export declare const licenceDetails: z.ZodObject<{
|
|
7
|
+
vendor: z.ZodString;
|
|
8
|
+
status: z.ZodEnum<{
|
|
9
|
+
active: "active";
|
|
10
|
+
"to-confirm": "to-confirm";
|
|
11
|
+
"to-buy": "to-buy";
|
|
12
|
+
cancelled: "cancelled";
|
|
13
|
+
expired: "expired";
|
|
14
|
+
}>;
|
|
15
|
+
cycle: z.ZodEnum<{
|
|
16
|
+
unknown: "unknown";
|
|
17
|
+
monthly: "monthly";
|
|
18
|
+
yearly: "yearly";
|
|
19
|
+
"one-off": "one-off";
|
|
20
|
+
none: "none";
|
|
21
|
+
}>;
|
|
22
|
+
cost: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unknown">]>;
|
|
23
|
+
currency: z.ZodString;
|
|
24
|
+
renewsOn: z.ZodString;
|
|
25
|
+
seats: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
paidBy: z.ZodOptional<z.ZodString>;
|
|
27
|
+
vaultItem: z.ZodOptional<z.ZodString>;
|
|
28
|
+
note: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export declare const componentSchema: z.ZodObject<{
|
|
31
|
+
apiVersion: z.ZodLiteral<"backstage.io/v1alpha1">;
|
|
32
|
+
kind: z.ZodLiteral<"Component">;
|
|
33
|
+
metadata: z.ZodObject<{
|
|
34
|
+
title: z.ZodOptional<z.ZodString>;
|
|
35
|
+
description: z.ZodOptional<z.ZodString>;
|
|
36
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
37
|
+
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
38
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$loose>;
|
|
42
|
+
spec: z.ZodObject<{
|
|
43
|
+
type: z.ZodString;
|
|
44
|
+
lifecycle: z.ZodString;
|
|
45
|
+
owner: z.ZodString;
|
|
46
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
47
|
+
}, z.core.$loose>;
|
|
48
|
+
}, z.core.$loose>;
|
|
49
|
+
export declare const licenceSchema: z.ZodObject<{
|
|
50
|
+
apiVersion: z.ZodLiteral<"backstage.io/v1alpha1">;
|
|
51
|
+
kind: z.ZodLiteral<"Resource">;
|
|
52
|
+
metadata: z.ZodObject<{
|
|
53
|
+
title: z.ZodOptional<z.ZodString>;
|
|
54
|
+
description: z.ZodOptional<z.ZodString>;
|
|
55
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
|
+
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
57
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$loose>;
|
|
61
|
+
spec: z.ZodObject<{
|
|
62
|
+
type: z.ZodLiteral<"licence">;
|
|
63
|
+
owner: z.ZodString;
|
|
64
|
+
licence: z.ZodObject<{
|
|
65
|
+
vendor: z.ZodString;
|
|
66
|
+
status: z.ZodEnum<{
|
|
67
|
+
active: "active";
|
|
68
|
+
"to-confirm": "to-confirm";
|
|
69
|
+
"to-buy": "to-buy";
|
|
70
|
+
cancelled: "cancelled";
|
|
71
|
+
expired: "expired";
|
|
72
|
+
}>;
|
|
73
|
+
cycle: z.ZodEnum<{
|
|
74
|
+
unknown: "unknown";
|
|
75
|
+
monthly: "monthly";
|
|
76
|
+
yearly: "yearly";
|
|
77
|
+
"one-off": "one-off";
|
|
78
|
+
none: "none";
|
|
79
|
+
}>;
|
|
80
|
+
cost: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unknown">]>;
|
|
81
|
+
currency: z.ZodString;
|
|
82
|
+
renewsOn: z.ZodString;
|
|
83
|
+
seats: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
paidBy: z.ZodOptional<z.ZodString>;
|
|
85
|
+
vaultItem: z.ZodOptional<z.ZodString>;
|
|
86
|
+
note: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
}, z.core.$loose>;
|
|
89
|
+
}, z.core.$loose>;
|
|
90
|
+
export declare const lineSchema: z.ZodObject<{
|
|
91
|
+
apiVersion: z.ZodLiteral<"stackledger/v1alpha1">;
|
|
92
|
+
kind: z.ZodLiteral<"Line">;
|
|
93
|
+
metadata: z.ZodObject<{
|
|
94
|
+
title: z.ZodOptional<z.ZodString>;
|
|
95
|
+
name: z.ZodString;
|
|
96
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strict>;
|
|
98
|
+
spec: z.ZodObject<{
|
|
99
|
+
color: z.ZodString;
|
|
100
|
+
code: z.ZodOptional<z.ZodString>;
|
|
101
|
+
stops: z.ZodArray<z.ZodString>;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
}, z.core.$strict>;
|
|
104
|
+
export declare const layoutSchema: z.ZodObject<{
|
|
105
|
+
apiVersion: z.ZodLiteral<"stackledger/v1alpha1">;
|
|
106
|
+
kind: z.ZodLiteral<"MapLayout">;
|
|
107
|
+
metadata: z.ZodObject<{
|
|
108
|
+
name: z.ZodString;
|
|
109
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
spec: z.ZodObject<{
|
|
112
|
+
stations: z.ZodRecord<z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
113
|
+
zones: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
title: z.ZodString;
|
|
116
|
+
color: z.ZodString;
|
|
117
|
+
}, z.core.$strict>>>;
|
|
118
|
+
}, z.core.$strict>;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
/** Licence fields a Settings document may hide from the staff view, in catalogue order. */
|
|
121
|
+
export declare const licenceFields: readonly ["vendor", "status", "cycle", "cost", "currency", "renewsOn", "seats", "paidBy", "vaultItem", "note"];
|
|
122
|
+
export type LicenceField = typeof licenceFields[number];
|
|
123
|
+
/** Site tokens spec.site.colors may replace in the light theme; each maps to a --color-<name> variable. */
|
|
124
|
+
export declare const siteColorNames: readonly ["primary", "accent", "body", "text"];
|
|
125
|
+
export type SiteColorName = typeof siteColorNames[number];
|
|
126
|
+
/** Icons a home link may show (catalogue, Home settings): the link icon names of @brunosouzas/design-system.
|
|
127
|
+
* A copy, so validate does not load the design system; test/unit/site-brand.test.ts keeps it equal. */
|
|
128
|
+
export declare const HOME_LINK_ICONS: readonly ["github", "website", "linkedin", "email"];
|
|
129
|
+
/** Sites stackledger build writes: [full] is the personal mode, [full, staff] (the default) the corporate one. */
|
|
130
|
+
export declare const siteNames: readonly ["full", "staff"];
|
|
131
|
+
export type SiteName = typeof siteNames[number];
|
|
132
|
+
/** Most skills folders a Settings may list (catalogue spec, Skills settings). */
|
|
133
|
+
export declare const MAX_SKILLS_FOLDERS = 20;
|
|
134
|
+
export declare const settingsSchema: z.ZodObject<{
|
|
135
|
+
apiVersion: z.ZodLiteral<"stackledger/v1alpha1">;
|
|
136
|
+
kind: z.ZodLiteral<"Settings">;
|
|
137
|
+
metadata: z.ZodObject<{
|
|
138
|
+
title: z.ZodOptional<z.ZodString>;
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, z.core.$strict>;
|
|
142
|
+
spec: z.ZodObject<{
|
|
143
|
+
views: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
staff: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
hide: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
146
|
+
vendor: "vendor";
|
|
147
|
+
status: "status";
|
|
148
|
+
cycle: "cycle";
|
|
149
|
+
cost: "cost";
|
|
150
|
+
currency: "currency";
|
|
151
|
+
renewsOn: "renewsOn";
|
|
152
|
+
seats: "seats";
|
|
153
|
+
paidBy: "paidBy";
|
|
154
|
+
vaultItem: "vaultItem";
|
|
155
|
+
note: "note";
|
|
156
|
+
}>>>;
|
|
157
|
+
}, z.core.$strict>>;
|
|
158
|
+
}, z.core.$strict>>;
|
|
159
|
+
site: z.ZodOptional<z.ZodObject<{
|
|
160
|
+
title: z.ZodOptional<z.ZodString>;
|
|
161
|
+
home: z.ZodOptional<z.ZodObject<{
|
|
162
|
+
text: z.ZodOptional<z.ZodString>;
|
|
163
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
164
|
+
title: z.ZodString;
|
|
165
|
+
url: z.ZodString;
|
|
166
|
+
description: z.ZodOptional<z.ZodString>;
|
|
167
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
168
|
+
github: "github";
|
|
169
|
+
website: "website";
|
|
170
|
+
linkedin: "linkedin";
|
|
171
|
+
email: "email";
|
|
172
|
+
}>>;
|
|
173
|
+
}, z.core.$strict>>>;
|
|
174
|
+
}, z.core.$strict>>;
|
|
175
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
176
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
177
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
178
|
+
body: z.ZodOptional<z.ZodString>;
|
|
179
|
+
text: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, z.core.$strict>>;
|
|
181
|
+
}, z.core.$strict>>;
|
|
182
|
+
sites: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
183
|
+
full: "full";
|
|
184
|
+
staff: "staff";
|
|
185
|
+
}>>>;
|
|
186
|
+
skills: z.ZodOptional<z.ZodObject<{
|
|
187
|
+
folders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
}, z.core.$strict>;
|
|
191
|
+
export declare const schemas: {
|
|
192
|
+
Component: z.ZodObject<{
|
|
193
|
+
apiVersion: z.ZodLiteral<"backstage.io/v1alpha1">;
|
|
194
|
+
kind: z.ZodLiteral<"Component">;
|
|
195
|
+
metadata: z.ZodObject<{
|
|
196
|
+
title: z.ZodOptional<z.ZodString>;
|
|
197
|
+
description: z.ZodOptional<z.ZodString>;
|
|
198
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
199
|
+
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
200
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
201
|
+
name: z.ZodString;
|
|
202
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$loose>;
|
|
204
|
+
spec: z.ZodObject<{
|
|
205
|
+
type: z.ZodString;
|
|
206
|
+
lifecycle: z.ZodString;
|
|
207
|
+
owner: z.ZodString;
|
|
208
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
209
|
+
}, z.core.$loose>;
|
|
210
|
+
}, z.core.$loose>;
|
|
211
|
+
Resource: z.ZodObject<{
|
|
212
|
+
apiVersion: z.ZodLiteral<"backstage.io/v1alpha1">;
|
|
213
|
+
kind: z.ZodLiteral<"Resource">;
|
|
214
|
+
metadata: z.ZodObject<{
|
|
215
|
+
title: z.ZodOptional<z.ZodString>;
|
|
216
|
+
description: z.ZodOptional<z.ZodString>;
|
|
217
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
218
|
+
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
219
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
220
|
+
name: z.ZodString;
|
|
221
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
222
|
+
}, z.core.$loose>;
|
|
223
|
+
spec: z.ZodObject<{
|
|
224
|
+
type: z.ZodLiteral<"licence">;
|
|
225
|
+
owner: z.ZodString;
|
|
226
|
+
licence: z.ZodObject<{
|
|
227
|
+
vendor: z.ZodString;
|
|
228
|
+
status: z.ZodEnum<{
|
|
229
|
+
active: "active";
|
|
230
|
+
"to-confirm": "to-confirm";
|
|
231
|
+
"to-buy": "to-buy";
|
|
232
|
+
cancelled: "cancelled";
|
|
233
|
+
expired: "expired";
|
|
234
|
+
}>;
|
|
235
|
+
cycle: z.ZodEnum<{
|
|
236
|
+
unknown: "unknown";
|
|
237
|
+
monthly: "monthly";
|
|
238
|
+
yearly: "yearly";
|
|
239
|
+
"one-off": "one-off";
|
|
240
|
+
none: "none";
|
|
241
|
+
}>;
|
|
242
|
+
cost: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unknown">]>;
|
|
243
|
+
currency: z.ZodString;
|
|
244
|
+
renewsOn: z.ZodString;
|
|
245
|
+
seats: z.ZodOptional<z.ZodNumber>;
|
|
246
|
+
paidBy: z.ZodOptional<z.ZodString>;
|
|
247
|
+
vaultItem: z.ZodOptional<z.ZodString>;
|
|
248
|
+
note: z.ZodOptional<z.ZodString>;
|
|
249
|
+
}, z.core.$strict>;
|
|
250
|
+
}, z.core.$loose>;
|
|
251
|
+
}, z.core.$loose>;
|
|
252
|
+
Line: z.ZodObject<{
|
|
253
|
+
apiVersion: z.ZodLiteral<"stackledger/v1alpha1">;
|
|
254
|
+
kind: z.ZodLiteral<"Line">;
|
|
255
|
+
metadata: z.ZodObject<{
|
|
256
|
+
title: z.ZodOptional<z.ZodString>;
|
|
257
|
+
name: z.ZodString;
|
|
258
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
259
|
+
}, z.core.$strict>;
|
|
260
|
+
spec: z.ZodObject<{
|
|
261
|
+
color: z.ZodString;
|
|
262
|
+
code: z.ZodOptional<z.ZodString>;
|
|
263
|
+
stops: z.ZodArray<z.ZodString>;
|
|
264
|
+
}, z.core.$strict>;
|
|
265
|
+
}, z.core.$strict>;
|
|
266
|
+
MapLayout: z.ZodObject<{
|
|
267
|
+
apiVersion: z.ZodLiteral<"stackledger/v1alpha1">;
|
|
268
|
+
kind: z.ZodLiteral<"MapLayout">;
|
|
269
|
+
metadata: z.ZodObject<{
|
|
270
|
+
name: z.ZodString;
|
|
271
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
272
|
+
}, z.core.$strict>;
|
|
273
|
+
spec: z.ZodObject<{
|
|
274
|
+
stations: z.ZodRecord<z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
275
|
+
zones: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
276
|
+
name: z.ZodString;
|
|
277
|
+
title: z.ZodString;
|
|
278
|
+
color: z.ZodString;
|
|
279
|
+
}, z.core.$strict>>>;
|
|
280
|
+
}, z.core.$strict>;
|
|
281
|
+
}, z.core.$strict>;
|
|
282
|
+
Settings: z.ZodObject<{
|
|
283
|
+
apiVersion: z.ZodLiteral<"stackledger/v1alpha1">;
|
|
284
|
+
kind: z.ZodLiteral<"Settings">;
|
|
285
|
+
metadata: z.ZodObject<{
|
|
286
|
+
title: z.ZodOptional<z.ZodString>;
|
|
287
|
+
name: z.ZodString;
|
|
288
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
289
|
+
}, z.core.$strict>;
|
|
290
|
+
spec: z.ZodObject<{
|
|
291
|
+
views: z.ZodOptional<z.ZodObject<{
|
|
292
|
+
staff: z.ZodOptional<z.ZodObject<{
|
|
293
|
+
hide: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
294
|
+
vendor: "vendor";
|
|
295
|
+
status: "status";
|
|
296
|
+
cycle: "cycle";
|
|
297
|
+
cost: "cost";
|
|
298
|
+
currency: "currency";
|
|
299
|
+
renewsOn: "renewsOn";
|
|
300
|
+
seats: "seats";
|
|
301
|
+
paidBy: "paidBy";
|
|
302
|
+
vaultItem: "vaultItem";
|
|
303
|
+
note: "note";
|
|
304
|
+
}>>>;
|
|
305
|
+
}, z.core.$strict>>;
|
|
306
|
+
}, z.core.$strict>>;
|
|
307
|
+
site: z.ZodOptional<z.ZodObject<{
|
|
308
|
+
title: z.ZodOptional<z.ZodString>;
|
|
309
|
+
home: z.ZodOptional<z.ZodObject<{
|
|
310
|
+
text: z.ZodOptional<z.ZodString>;
|
|
311
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
312
|
+
title: z.ZodString;
|
|
313
|
+
url: z.ZodString;
|
|
314
|
+
description: z.ZodOptional<z.ZodString>;
|
|
315
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
316
|
+
github: "github";
|
|
317
|
+
website: "website";
|
|
318
|
+
linkedin: "linkedin";
|
|
319
|
+
email: "email";
|
|
320
|
+
}>>;
|
|
321
|
+
}, z.core.$strict>>>;
|
|
322
|
+
}, z.core.$strict>>;
|
|
323
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
324
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
325
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
326
|
+
body: z.ZodOptional<z.ZodString>;
|
|
327
|
+
text: z.ZodOptional<z.ZodString>;
|
|
328
|
+
}, z.core.$strict>>;
|
|
329
|
+
}, z.core.$strict>>;
|
|
330
|
+
sites: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
331
|
+
full: "full";
|
|
332
|
+
staff: "staff";
|
|
333
|
+
}>>>;
|
|
334
|
+
skills: z.ZodOptional<z.ZodObject<{
|
|
335
|
+
folders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
336
|
+
}, z.core.$strict>>;
|
|
337
|
+
}, z.core.$strict>;
|
|
338
|
+
}, z.core.$strict>;
|
|
339
|
+
};
|
|
340
|
+
export type Component = z.infer<typeof componentSchema>;
|
|
341
|
+
export type Licence = z.infer<typeof licenceSchema>;
|
|
342
|
+
export type Line = z.infer<typeof lineSchema>;
|
|
343
|
+
export type MapLayout = z.infer<typeof layoutSchema>;
|
|
344
|
+
export type Settings = z.infer<typeof settingsSchema>;
|
|
345
|
+
export type Entity = Component | Licence | Line | MapLayout | Settings;
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/** Runtime schemas and inferred catalogue types. Imported by validator; run npm run build.
|
|
2
|
+
* Backstage extensions survive, but drawing kinds and licence details reject typos.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export const name = z.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/, 'Name must be 1–63 ASCII letters, digits, dots, underscores or hyphens, with alphanumeric ends');
|
|
6
|
+
const text = z.string().min(1, 'Must be a non-empty string');
|
|
7
|
+
const color = z.string().regex(/^#[0-9a-fA-F]{6}$/, 'Must be # followed by six hexadecimal digits');
|
|
8
|
+
const identity = { name, namespace: z.string().optional() };
|
|
9
|
+
const metadata = z.looseObject({ ...identity, title: text.optional(), description: text.optional(),
|
|
10
|
+
labels: z.record(z.string(), z.string()).optional(), annotations: z.record(z.string(), z.string()).optional(), tags: z.array(z.string()).optional() });
|
|
11
|
+
const date = z.string().refine(value => {
|
|
12
|
+
if (['unknown', 'not-applicable'].includes(value))
|
|
13
|
+
return true;
|
|
14
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
15
|
+
return false;
|
|
16
|
+
const parsed = new Date(`${value}T00:00:00.000Z`);
|
|
17
|
+
return Number.isFinite(parsed.getTime()) && parsed.toISOString().slice(0, 10) === value;
|
|
18
|
+
}, 'Must be a real YYYY-MM-DD date, not-applicable or unknown');
|
|
19
|
+
export const licenceDetails = z.strictObject({
|
|
20
|
+
vendor: text, status: z.enum(['active', 'to-confirm', 'to-buy', 'cancelled', 'expired']),
|
|
21
|
+
cycle: z.enum(['monthly', 'yearly', 'one-off', 'none', 'unknown']),
|
|
22
|
+
cost: z.union([z.number().nonnegative(), z.literal('unknown')]),
|
|
23
|
+
currency: z.string().regex(/^(?:[A-Z]{3}|unknown)$/, 'Must be three capital ASCII letters or unknown'),
|
|
24
|
+
renewsOn: date, seats: z.number().int().min(1).optional(), paidBy: text.optional(), vaultItem: text.optional(), note: text.optional(),
|
|
25
|
+
});
|
|
26
|
+
export const componentSchema = z.looseObject({
|
|
27
|
+
apiVersion: z.literal('backstage.io/v1alpha1'), kind: z.literal('Component'), metadata,
|
|
28
|
+
spec: z.looseObject({ type: text, lifecycle: text, owner: text, dependsOn: z.array(text).optional() }),
|
|
29
|
+
});
|
|
30
|
+
export const licenceSchema = z.looseObject({
|
|
31
|
+
apiVersion: z.literal('backstage.io/v1alpha1'), kind: z.literal('Resource'), metadata,
|
|
32
|
+
spec: z.looseObject({ type: z.literal('licence'), owner: text, licence: licenceDetails }),
|
|
33
|
+
});
|
|
34
|
+
export const lineSchema = z.strictObject({
|
|
35
|
+
apiVersion: z.literal('stackledger/v1alpha1'), kind: z.literal('Line'),
|
|
36
|
+
metadata: z.strictObject({ ...identity, title: text.optional() }),
|
|
37
|
+
spec: z.strictObject({ color, code: z.string().regex(/^[A-Za-z0-9]{1,3}$/, 'Must be one to three ASCII letters or digits').optional(), stops: z.array(text).min(2) }),
|
|
38
|
+
});
|
|
39
|
+
export const layoutSchema = z.strictObject({
|
|
40
|
+
apiVersion: z.literal('stackledger/v1alpha1'), kind: z.literal('MapLayout'),
|
|
41
|
+
metadata: z.strictObject(identity),
|
|
42
|
+
spec: z.strictObject({ stations: z.record(z.string(), z.tuple([z.number().int().nonnegative(), z.number().int().nonnegative()])),
|
|
43
|
+
zones: z.array(z.strictObject({ name: text, title: text, color })).optional() }),
|
|
44
|
+
});
|
|
45
|
+
/** Licence fields a Settings document may hide from the staff view, in catalogue order. */
|
|
46
|
+
export const licenceFields = ['vendor', 'status', 'cycle', 'cost', 'currency', 'renewsOn', 'seats', 'paidBy', 'vaultItem', 'note'];
|
|
47
|
+
const hide = z.array(z.enum(licenceFields)).superRefine((list, context) => list.forEach((value, index) => {
|
|
48
|
+
if (list.indexOf(value) < index)
|
|
49
|
+
context.addIssue({ code: 'custom', message: 'Field name is already listed', path: [index] });
|
|
50
|
+
}));
|
|
51
|
+
/** Site tokens spec.site.colors may replace in the light theme; each maps to a --color-<name> variable. */
|
|
52
|
+
export const siteColorNames = ['primary', 'accent', 'body', 'text'];
|
|
53
|
+
/** A home link's URL (catalogue, Home settings): http(s) with a host and no user name or password,
|
|
54
|
+
* so it can be an anchor's href without running code or carrying a credential (site-security). */
|
|
55
|
+
const homeUrl = z.string().max(2048, 'Must have maximum 2048 characters').superRefine((value, context) => {
|
|
56
|
+
let url;
|
|
57
|
+
try {
|
|
58
|
+
url = new URL(value);
|
|
59
|
+
}
|
|
60
|
+
catch { /* reported below */ }
|
|
61
|
+
if (!url || !/^https?:$/.test(url.protocol) || !/^https?:\/\//i.test(value))
|
|
62
|
+
context.addIssue({ code: 'custom', message: 'Must be an http:// or https:// URL' });
|
|
63
|
+
else if (!url.hostname)
|
|
64
|
+
context.addIssue({ code: 'custom', message: 'Must have a host' });
|
|
65
|
+
else if (url.username || url.password || /@/.test(value.slice(value.indexOf('//') + 2).split(/[/?#]/)[0]))
|
|
66
|
+
context.addIssue({ code: 'custom', message: 'Must not hold a user name or password' });
|
|
67
|
+
else if (/[\s\p{Cc}]/u.test(value))
|
|
68
|
+
context.addIssue({ code: 'custom', message: 'Must not hold a space or control character' });
|
|
69
|
+
// HTML-significant characters: Astro writes < and > raw inside an attribute, and the build's scan
|
|
70
|
+
// must read the page tag by tag; a real URL percent-encodes them anyway.
|
|
71
|
+
else if (/[<>"'`]/.test(value))
|
|
72
|
+
context.addIssue({ code: 'custom', message: 'Must not hold <, >, quotes or backticks (percent-encode them)' });
|
|
73
|
+
});
|
|
74
|
+
/** Icons a home link may show (catalogue, Home settings): the link icon names of @brunosouzas/design-system.
|
|
75
|
+
* A copy, so validate does not load the design system; test/unit/site-brand.test.ts keeps it equal. */
|
|
76
|
+
export const HOME_LINK_ICONS = ['github', 'website', 'linkedin', 'email'];
|
|
77
|
+
const home = z.strictObject({
|
|
78
|
+
text: text.max(200, 'Must have maximum 200 characters').optional(),
|
|
79
|
+
links: z.array(z.strictObject({
|
|
80
|
+
title: text.max(60, 'Must have maximum 60 characters'),
|
|
81
|
+
url: homeUrl,
|
|
82
|
+
description: text.max(200, 'Must have maximum 200 characters').optional(),
|
|
83
|
+
icon: z.enum(HOME_LINK_ICONS).optional(),
|
|
84
|
+
})).min(1, 'Must list at least one link').max(20, 'Must list at most 20 links').optional(),
|
|
85
|
+
});
|
|
86
|
+
const site = z.strictObject({
|
|
87
|
+
title: text.max(60, 'Must have maximum 60 characters').optional(),
|
|
88
|
+
home: home.optional(),
|
|
89
|
+
colors: z.strictObject(Object.fromEntries(siteColorNames.map(key => [key, color.optional()]))).optional(),
|
|
90
|
+
});
|
|
91
|
+
/** Sites stackledger build writes: [full] is the personal mode, [full, staff] (the default) the corporate one. */
|
|
92
|
+
export const siteNames = ['full', 'staff'];
|
|
93
|
+
const sites = z.array(z.enum(siteNames)).superRefine((list, context) => {
|
|
94
|
+
list.forEach((value, index) => {
|
|
95
|
+
if (list.indexOf(value) < index)
|
|
96
|
+
context.addIssue({ code: 'custom', message: 'Site is already listed', path: [index] });
|
|
97
|
+
});
|
|
98
|
+
if (!list.includes('full'))
|
|
99
|
+
context.addIssue({ code: 'custom', message: 'Must include full: use [full] or [full, staff]' });
|
|
100
|
+
});
|
|
101
|
+
/** Most skills folders a Settings may list (catalogue spec, Skills settings). */
|
|
102
|
+
export const MAX_SKILLS_FOLDERS = 20;
|
|
103
|
+
// A configured skills folder is resolved from the catalogue folder (build-command, Skill folders), so it
|
|
104
|
+
// must be relative: an absolute path, `~` (no shell expands it) or a drive would tie the catalogue to one machine.
|
|
105
|
+
const relativeFolder = text.refine(value => !/^[/\\~]/.test(value) && !/^[A-Za-z]:/.test(value), 'Path must be relative to the catalogue folder: no leading /, \\, ~ or drive letter');
|
|
106
|
+
const skillsSettings = z.strictObject({
|
|
107
|
+
folders: z.array(relativeFolder).min(1, 'Must list at least one folder').max(MAX_SKILLS_FOLDERS, `Must list at most ${MAX_SKILLS_FOLDERS} folders`)
|
|
108
|
+
.superRefine((list, context) => list.forEach((value, index) => {
|
|
109
|
+
if (list.indexOf(value) < index)
|
|
110
|
+
context.addIssue({ code: 'custom', message: 'Folder is already listed', path: [index] });
|
|
111
|
+
})).optional(),
|
|
112
|
+
});
|
|
113
|
+
export const settingsSchema = z.strictObject({
|
|
114
|
+
apiVersion: z.literal('stackledger/v1alpha1'), kind: z.literal('Settings'),
|
|
115
|
+
metadata: z.strictObject({ ...identity, title: text.optional() }),
|
|
116
|
+
spec: z.strictObject({ views: z.strictObject({ staff: z.strictObject({ hide: hide.optional() }).optional() }).optional(), site: site.optional(), sites: sites.optional(),
|
|
117
|
+
skills: skillsSettings.optional() }),
|
|
118
|
+
});
|
|
119
|
+
export const schemas = { Component: componentSchema, Resource: licenceSchema, Line: lineSchema, MapLayout: layoutSchema, Settings: settingsSchema };
|
|
120
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mDAAmD,EAAE,+FAA+F,CAAC,CAAC;AAC3L,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC;AAC7D,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,8CAA8C,CAAC,CAAC;AACpG,MAAM,QAAQ,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC5D,MAAM,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE;IAChG,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAA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E,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC1E,QAAQ,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;IACjE,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;QACtK,MAAM,EAAE,cAAc,CAAC,QAAQ,EAAE,EAAE,CAAC;CACvC,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Source, type Problem } from './source.js';
|
|
2
|
+
export declare const PRIVATE_KEY_RULE = "Private key material is not allowed";
|
|
3
|
+
export declare const CARD_NUMBER_RULE = "Payment-card number is not allowed";
|
|
4
|
+
/** The secret rules a text breaks: private-key material and a payment-card number (13–19 digits,
|
|
5
|
+
* optionally separated by single spaces or hyphens, passing the Luhn check). Empty when none. */
|
|
6
|
+
export declare function secretRules(text: string): string[];
|
|
7
|
+
export declare function scanSecrets(source: Source): Problem[];
|
package/dist/secrets.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Guard against accidental credentials and personal addresses. Used after schema checks, and by
|
|
2
|
+
* the discovery snapshot (src/discovery/snapshot.ts) through secretRules, so both apply one rule.
|
|
3
|
+
* Messages are constants: neither a detected value nor parser excerpts reach output.
|
|
4
|
+
*/
|
|
5
|
+
import { isScalar } from 'yaml';
|
|
6
|
+
import { problem, sourceNode, resolveNode } from './source.js';
|
|
7
|
+
function luhn(digits) {
|
|
8
|
+
let sum = 0;
|
|
9
|
+
for (let i = digits.length - 1, double = false; i >= 0; i--, double = !double) {
|
|
10
|
+
let digit = Number(digits[i]);
|
|
11
|
+
if (double) {
|
|
12
|
+
digit *= 2;
|
|
13
|
+
if (digit > 9)
|
|
14
|
+
digit -= 9;
|
|
15
|
+
}
|
|
16
|
+
sum += digit;
|
|
17
|
+
}
|
|
18
|
+
return sum % 10 === 0;
|
|
19
|
+
}
|
|
20
|
+
export const PRIVATE_KEY_RULE = 'Private key material is not allowed';
|
|
21
|
+
export const CARD_NUMBER_RULE = 'Payment-card number is not allowed';
|
|
22
|
+
/** The secret rules a text breaks: private-key material and a payment-card number (13–19 digits,
|
|
23
|
+
* optionally separated by single spaces or hyphens, passing the Luhn check). Empty when none. */
|
|
24
|
+
export function secretRules(text) {
|
|
25
|
+
const rules = [];
|
|
26
|
+
if (/-----BEGIN[^\r\n]*PRIVATE KEY-----/.test(text))
|
|
27
|
+
rules.push(PRIVATE_KEY_RULE);
|
|
28
|
+
// Match the entire run before checking length, avoiding a valid substring of a longer number.
|
|
29
|
+
const runs = text.match(/\d(?:[ -]?\d)*/g) ?? [];
|
|
30
|
+
if (runs.some(run => { const digits = run.replace(/[ -]/g, ''); return digits.length >= 13 && digits.length <= 19 && luhn(digits); }))
|
|
31
|
+
rules.push(CARD_NUMBER_RULE);
|
|
32
|
+
return rules;
|
|
33
|
+
}
|
|
34
|
+
export function scanSecrets(source) {
|
|
35
|
+
const problems = [];
|
|
36
|
+
const ancestors = new Set();
|
|
37
|
+
function visit(value, path) {
|
|
38
|
+
if (value !== null && typeof value === 'object') {
|
|
39
|
+
// YAML aliases may be recursive. Traverse aliases at each path, but never a cycle.
|
|
40
|
+
if (ancestors.has(value))
|
|
41
|
+
return;
|
|
42
|
+
ancestors.add(value);
|
|
43
|
+
for (const [key, child] of Object.entries(value)) {
|
|
44
|
+
const childPath = [...path, Array.isArray(value) ? Number(key) : key];
|
|
45
|
+
if (!Array.isArray(value) && /^(password|secret|token|apikey|privatekey)$/.test(key.split('/').at(-1).replace(/[-_]/g, '').toLowerCase())) {
|
|
46
|
+
problems.push(problem(source, childPath, 'Secret key is not allowed', 'error', true));
|
|
47
|
+
}
|
|
48
|
+
visit(child, childPath);
|
|
49
|
+
}
|
|
50
|
+
ancestors.delete(value);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'bigint')
|
|
54
|
+
return;
|
|
55
|
+
const node = resolveNode(source, sourceNode(source, path));
|
|
56
|
+
// IEEE-754 conversion loses digits of long unquoted integers; inspect the original scalar.
|
|
57
|
+
const text = typeof value === 'number' && isScalar(node) && node.source !== undefined ? node.source : String(value);
|
|
58
|
+
for (const rule of secretRules(text))
|
|
59
|
+
problems.push(problem(source, path, rule));
|
|
60
|
+
// The domain must end in a label of letters, so Homebrew names such as python@3.12 are not addresses.
|
|
61
|
+
if (/[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}(?![A-Za-z0-9-])/.test(text)) {
|
|
62
|
+
problems.push(problem(source, path, 'E-mail address found; check whether it should be public', 'warning'));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
visit(source.value, []);
|
|
66
|
+
return problems;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,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KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO;QAChG,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,2FAA2F;QAC3F,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpH,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACjF,sGAAsG;QACtG,IAAI,kGAAkG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAClH,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,yDAAyD,EAAE,SAAS,CAAC,CAAC,CAAC;QAC7G,CAAC;IACH,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAAC,OAAO,QAAQ,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Loaded } from '../source.js';
|
|
2
|
+
import { type Catalogue } from '../validate.js';
|
|
3
|
+
import { type SiteData } from './data.js';
|
|
4
|
+
import type { SkillSet } from '../skills/source.js';
|
|
5
|
+
export interface BuiltSite {
|
|
6
|
+
dir: string;
|
|
7
|
+
pages: number;
|
|
8
|
+
}
|
|
9
|
+
/** `notes` are the map's diagnostic lines for the full view, as `stackledger map` writes them;
|
|
10
|
+
* `staff` is absent in the personal mode. */
|
|
11
|
+
export interface PreparedBuild {
|
|
12
|
+
catalogue: Catalogue;
|
|
13
|
+
staff?: BuiltSite;
|
|
14
|
+
full: BuiltSite;
|
|
15
|
+
root: string;
|
|
16
|
+
notes: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function packageVersion(): string;
|
|
19
|
+
/** The light-theme overrides from spec.site.colors; only #RRGGBB values reach the stylesheet. */
|
|
20
|
+
export declare function overrideCss(colors: SiteData['colors']): string;
|
|
21
|
+
/** Build both sites and the root files into `staging`, which must exist and be empty. */
|
|
22
|
+
export declare function prepareBuild(folder: string | Loaded, stagingPath: string, date: string, version?: string, skillSet?: SkillSet): Promise<PreparedBuild>;
|