@hanzo/ui 8.0.8 → 8.0.11

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/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var chunkHSPMQQVJ_cjs = require('./chunk-HSPMQQVJ.cjs');
4
+ var chunkM2ILMK44_cjs = require('./chunk-M2ILMK44.cjs');
5
5
  var chunkYBXVUV7P_cjs = require('./chunk-YBXVUV7P.cjs');
6
6
  var data = require('@hanzo/data');
7
7
 
@@ -9,259 +9,267 @@ var data = require('@hanzo/data');
9
9
 
10
10
  Object.defineProperty(exports, "AppHeader", {
11
11
  enumerable: true,
12
- get: function () { return chunkHSPMQQVJ_cjs.AppHeader; }
12
+ get: function () { return chunkM2ILMK44_cjs.AppHeader; }
13
13
  });
14
14
  Object.defineProperty(exports, "BarChart", {
15
15
  enumerable: true,
16
- get: function () { return chunkHSPMQQVJ_cjs.BarChart; }
16
+ get: function () { return chunkM2ILMK44_cjs.BarChart; }
17
17
  });
18
18
  Object.defineProperty(exports, "BarRows", {
19
19
  enumerable: true,
20
- get: function () { return chunkHSPMQQVJ_cjs.BarRows; }
20
+ get: function () { return chunkM2ILMK44_cjs.BarRows; }
21
21
  });
22
22
  Object.defineProperty(exports, "BrandMark", {
23
23
  enumerable: true,
24
- get: function () { return chunkHSPMQQVJ_cjs.BrandMark; }
24
+ get: function () { return chunkM2ILMK44_cjs.BrandMark; }
25
25
  });
26
26
  Object.defineProperty(exports, "CHART_OTHER", {
27
27
  enumerable: true,
28
- get: function () { return chunkHSPMQQVJ_cjs.CHART_OTHER; }
28
+ get: function () { return chunkM2ILMK44_cjs.CHART_OTHER; }
29
29
  });
30
30
  Object.defineProperty(exports, "CHART_PALETTE", {
31
31
  enumerable: true,
32
- get: function () { return chunkHSPMQQVJ_cjs.CHART_PALETTE; }
32
+ get: function () { return chunkM2ILMK44_cjs.CHART_PALETTE; }
33
33
  });
34
34
  Object.defineProperty(exports, "ComboBox", {
35
35
  enumerable: true,
36
- get: function () { return chunkHSPMQQVJ_cjs.ComboBox; }
36
+ get: function () { return chunkM2ILMK44_cjs.ComboBox; }
37
37
  });
38
38
  Object.defineProperty(exports, "ContextMenu", {
39
39
  enumerable: true,
40
- get: function () { return chunkHSPMQQVJ_cjs.ContextMenu; }
40
+ get: function () { return chunkM2ILMK44_cjs.ContextMenu; }
41
41
  });
42
42
  Object.defineProperty(exports, "CustomModelMark", {
43
43
  enumerable: true,
44
- get: function () { return chunkHSPMQQVJ_cjs.Boxes; }
44
+ get: function () { return chunkM2ILMK44_cjs.Boxes; }
45
45
  });
46
46
  Object.defineProperty(exports, "DataTable", {
47
47
  enumerable: true,
48
- get: function () { return chunkHSPMQQVJ_cjs.DataTable; }
48
+ get: function () { return chunkM2ILMK44_cjs.DataTable; }
49
49
  });
50
50
  Object.defineProperty(exports, "Donut", {
51
51
  enumerable: true,
52
- get: function () { return chunkHSPMQQVJ_cjs.Donut; }
52
+ get: function () { return chunkM2ILMK44_cjs.Donut; }
53
53
  });
54
54
  Object.defineProperty(exports, "DonutRing", {
55
55
  enumerable: true,
56
- get: function () { return chunkHSPMQQVJ_cjs.Donut2; }
56
+ get: function () { return chunkM2ILMK44_cjs.Donut2; }
57
57
  });
58
58
  Object.defineProperty(exports, "DropdownMenu", {
59
59
  enumerable: true,
60
- get: function () { return chunkHSPMQQVJ_cjs.DropdownMenu; }
60
+ get: function () { return chunkM2ILMK44_cjs.DropdownMenu; }
61
61
  });
62
62
  Object.defineProperty(exports, "EmptyState", {
63
63
  enumerable: true,
64
- get: function () { return chunkHSPMQQVJ_cjs.EmptyState; }
64
+ get: function () { return chunkM2ILMK44_cjs.EmptyState; }
65
65
  });
66
66
  Object.defineProperty(exports, "FadeIn", {
67
67
  enumerable: true,
68
- get: function () { return chunkHSPMQQVJ_cjs.FadeIn; }
68
+ get: function () { return chunkM2ILMK44_cjs.FadeIn; }
69
69
  });
70
70
  Object.defineProperty(exports, "FieldRow", {
71
71
  enumerable: true,
72
- get: function () { return chunkHSPMQQVJ_cjs.FieldRow; }
72
+ get: function () { return chunkM2ILMK44_cjs.FieldRow; }
73
73
  });
74
74
  Object.defineProperty(exports, "FieldSelect", {
75
75
  enumerable: true,
76
- get: function () { return chunkHSPMQQVJ_cjs.FieldSelect; }
76
+ get: function () { return chunkM2ILMK44_cjs.FieldSelect; }
77
77
  });
78
78
  Object.defineProperty(exports, "FieldSlider", {
79
79
  enumerable: true,
80
- get: function () { return chunkHSPMQQVJ_cjs.FieldSlider; }
80
+ get: function () { return chunkM2ILMK44_cjs.FieldSlider; }
81
81
  });
82
82
  Object.defineProperty(exports, "FieldSwitch", {
83
83
  enumerable: true,
84
- get: function () { return chunkHSPMQQVJ_cjs.FieldSwitch; }
84
+ get: function () { return chunkM2ILMK44_cjs.FieldSwitch; }
85
85
  });
86
86
  Object.defineProperty(exports, "FieldText", {
87
87
  enumerable: true,
88
- get: function () { return chunkHSPMQQVJ_cjs.FieldText; }
88
+ get: function () { return chunkM2ILMK44_cjs.FieldText; }
89
89
  });
90
90
  Object.defineProperty(exports, "FieldTextArea", {
91
91
  enumerable: true,
92
- get: function () { return chunkHSPMQQVJ_cjs.FieldTextArea; }
92
+ get: function () { return chunkM2ILMK44_cjs.FieldTextArea; }
93
93
  });
94
94
  Object.defineProperty(exports, "FloatingMenu", {
95
95
  enumerable: true,
96
- get: function () { return chunkHSPMQQVJ_cjs.FloatingMenu; }
96
+ get: function () { return chunkM2ILMK44_cjs.FloatingMenu; }
97
97
  });
98
98
  Object.defineProperty(exports, "GenericLogo", {
99
99
  enumerable: true,
100
- get: function () { return chunkHSPMQQVJ_cjs.GenericLogo; }
100
+ get: function () { return chunkM2ILMK44_cjs.GenericLogo; }
101
101
  });
102
102
  Object.defineProperty(exports, "HanzoMark", {
103
103
  enumerable: true,
104
- get: function () { return chunkHSPMQQVJ_cjs.HanzoMark; }
104
+ get: function () { return chunkM2ILMK44_cjs.HanzoMark; }
105
105
  });
106
106
  Object.defineProperty(exports, "HintButton", {
107
107
  enumerable: true,
108
- get: function () { return chunkHSPMQQVJ_cjs.HintButton; }
108
+ get: function () { return chunkM2ILMK44_cjs.HintButton; }
109
109
  });
110
110
  Object.defineProperty(exports, "LegendDot", {
111
111
  enumerable: true,
112
- get: function () { return chunkHSPMQQVJ_cjs.LegendDot; }
112
+ get: function () { return chunkM2ILMK44_cjs.LegendDot; }
113
113
  });
114
114
  Object.defineProperty(exports, "LineChart", {
115
115
  enumerable: true,
116
- get: function () { return chunkHSPMQQVJ_cjs.LineChart; }
116
+ get: function () { return chunkM2ILMK44_cjs.LineChart; }
117
117
  });
118
118
  Object.defineProperty(exports, "MenuItemView", {
119
119
  enumerable: true,
120
- get: function () { return chunkHSPMQQVJ_cjs.MenuItemView; }
120
+ get: function () { return chunkM2ILMK44_cjs.MenuItemView; }
121
121
  });
122
122
  Object.defineProperty(exports, "MenuLabelView", {
123
123
  enumerable: true,
124
- get: function () { return chunkHSPMQQVJ_cjs.MenuLabelView; }
124
+ get: function () { return chunkM2ILMK44_cjs.MenuLabelView; }
125
125
  });
126
126
  Object.defineProperty(exports, "MenuPanel", {
127
127
  enumerable: true,
128
- get: function () { return chunkHSPMQQVJ_cjs.MenuPanel; }
128
+ get: function () { return chunkM2ILMK44_cjs.MenuPanel; }
129
129
  });
130
130
  Object.defineProperty(exports, "MenuSeparatorView", {
131
131
  enumerable: true,
132
- get: function () { return chunkHSPMQQVJ_cjs.MenuSeparatorView; }
132
+ get: function () { return chunkM2ILMK44_cjs.MenuSeparatorView; }
133
133
  });
134
134
  Object.defineProperty(exports, "MetricCard", {
135
135
  enumerable: true,
136
- get: function () { return chunkHSPMQQVJ_cjs.MetricCard; }
136
+ get: function () { return chunkM2ILMK44_cjs.MetricCard; }
137
137
  });
138
138
  Object.defineProperty(exports, "MetricSparkline", {
139
139
  enumerable: true,
140
- get: function () { return chunkHSPMQQVJ_cjs.Sparkline2; }
140
+ get: function () { return chunkM2ILMK44_cjs.Sparkline2; }
141
141
  });
142
142
  Object.defineProperty(exports, "MiniBars", {
143
143
  enumerable: true,
144
- get: function () { return chunkHSPMQQVJ_cjs.MiniBars; }
144
+ get: function () { return chunkM2ILMK44_cjs.MiniBars; }
145
+ });
146
+ Object.defineProperty(exports, "OrgMark", {
147
+ enumerable: true,
148
+ get: function () { return chunkM2ILMK44_cjs.OrgMark; }
145
149
  });
146
150
  Object.defineProperty(exports, "OrgSwitcher", {
147
151
  enumerable: true,
148
- get: function () { return chunkHSPMQQVJ_cjs.OrgSwitcher; }
152
+ get: function () { return chunkM2ILMK44_cjs.OrgSwitcher; }
149
153
  });
150
154
  Object.defineProperty(exports, "PageHeader", {
151
155
  enumerable: true,
152
- get: function () { return chunkHSPMQQVJ_cjs.PageHeader; }
156
+ get: function () { return chunkM2ILMK44_cjs.PageHeader; }
153
157
  });
154
158
  Object.defineProperty(exports, "Panel", {
155
159
  enumerable: true,
156
- get: function () { return chunkHSPMQQVJ_cjs.Panel; }
160
+ get: function () { return chunkM2ILMK44_cjs.Panel; }
157
161
  });
158
162
  Object.defineProperty(exports, "PortalTheme", {
159
163
  enumerable: true,
160
- get: function () { return chunkHSPMQQVJ_cjs.PortalTheme; }
164
+ get: function () { return chunkM2ILMK44_cjs.PortalTheme; }
161
165
  });
162
166
  Object.defineProperty(exports, "PrimaryButton", {
163
167
  enumerable: true,
164
- get: function () { return chunkHSPMQQVJ_cjs.PrimaryButton; }
168
+ get: function () { return chunkM2ILMK44_cjs.PrimaryButton; }
165
169
  });
166
170
  Object.defineProperty(exports, "ProductIcon", {
167
171
  enumerable: true,
168
- get: function () { return chunkHSPMQQVJ_cjs.ProductIcon; }
172
+ get: function () { return chunkM2ILMK44_cjs.ProductIcon; }
169
173
  });
170
174
  Object.defineProperty(exports, "ProviderLogo", {
171
175
  enumerable: true,
172
- get: function () { return chunkHSPMQQVJ_cjs.ProviderLogo; }
176
+ get: function () { return chunkM2ILMK44_cjs.ProviderLogo; }
173
177
  });
174
178
  Object.defineProperty(exports, "Reorder", {
175
179
  enumerable: true,
176
- get: function () { return chunkHSPMQQVJ_cjs.Reorder; }
180
+ get: function () { return chunkM2ILMK44_cjs.Reorder; }
177
181
  });
178
182
  Object.defineProperty(exports, "SERIES", {
179
183
  enumerable: true,
180
- get: function () { return chunkHSPMQQVJ_cjs.SERIES; }
184
+ get: function () { return chunkM2ILMK44_cjs.SERIES; }
181
185
  });
182
186
  Object.defineProperty(exports, "SLIDEOVER_LG", {
183
187
  enumerable: true,
184
- get: function () { return chunkHSPMQQVJ_cjs.LG; }
188
+ get: function () { return chunkM2ILMK44_cjs.LG; }
185
189
  });
186
190
  Object.defineProperty(exports, "SURFACES", {
187
191
  enumerable: true,
188
- get: function () { return chunkHSPMQQVJ_cjs.SURFACES; }
192
+ get: function () { return chunkM2ILMK44_cjs.SURFACES; }
189
193
  });
190
194
  Object.defineProperty(exports, "SelectMenu", {
191
195
  enumerable: true,
192
- get: function () { return chunkHSPMQQVJ_cjs.SelectMenu; }
196
+ get: function () { return chunkM2ILMK44_cjs.SelectMenu; }
193
197
  });
194
198
  Object.defineProperty(exports, "SlideOver", {
195
199
  enumerable: true,
196
- get: function () { return chunkHSPMQQVJ_cjs.SlideOver; }
200
+ get: function () { return chunkM2ILMK44_cjs.SlideOver; }
197
201
  });
198
202
  Object.defineProperty(exports, "Sparkline", {
199
203
  enumerable: true,
200
- get: function () { return chunkHSPMQQVJ_cjs.Sparkline; }
204
+ get: function () { return chunkM2ILMK44_cjs.Sparkline; }
201
205
  });
202
206
  Object.defineProperty(exports, "StatusTag", {
203
207
  enumerable: true,
204
- get: function () { return chunkHSPMQQVJ_cjs.StatusTag; }
208
+ get: function () { return chunkM2ILMK44_cjs.StatusTag; }
205
209
  });
206
210
  Object.defineProperty(exports, "ToastProvider", {
207
211
  enumerable: true,
208
- get: function () { return chunkHSPMQQVJ_cjs.ToastProvider; }
212
+ get: function () { return chunkM2ILMK44_cjs.ToastProvider; }
209
213
  });
210
214
  Object.defineProperty(exports, "UtilBar", {
211
215
  enumerable: true,
212
- get: function () { return chunkHSPMQQVJ_cjs.UtilBar; }
216
+ get: function () { return chunkM2ILMK44_cjs.UtilBar; }
213
217
  });
214
218
  Object.defineProperty(exports, "asColor", {
215
219
  enumerable: true,
216
- get: function () { return chunkHSPMQQVJ_cjs.asColor; }
220
+ get: function () { return chunkM2ILMK44_cjs.asColor; }
217
221
  });
218
222
  Object.defineProperty(exports, "colorForIndex", {
219
223
  enumerable: true,
220
- get: function () { return chunkHSPMQQVJ_cjs.colorForIndex; }
224
+ get: function () { return chunkM2ILMK44_cjs.colorForIndex; }
221
225
  });
222
226
  Object.defineProperty(exports, "filterOptions", {
223
227
  enumerable: true,
224
- get: function () { return chunkHSPMQQVJ_cjs.filterOptions; }
228
+ get: function () { return chunkM2ILMK44_cjs.filterOptions; }
225
229
  });
226
230
  Object.defineProperty(exports, "filterOrgs", {
227
231
  enumerable: true,
228
- get: function () { return chunkHSPMQQVJ_cjs.filterOrgs; }
232
+ get: function () { return chunkM2ILMK44_cjs.filterOrgs; }
229
233
  });
230
234
  Object.defineProperty(exports, "isKnownOption", {
231
235
  enumerable: true,
232
- get: function () { return chunkHSPMQQVJ_cjs.isKnownOption; }
236
+ get: function () { return chunkM2ILMK44_cjs.isKnownOption; }
237
+ });
238
+ Object.defineProperty(exports, "monogram", {
239
+ enumerable: true,
240
+ get: function () { return chunkM2ILMK44_cjs.monogram; }
233
241
  });
234
242
  Object.defineProperty(exports, "orgScope", {
235
243
  enumerable: true,
236
- get: function () { return chunkHSPMQQVJ_cjs.orgScope; }
244
+ get: function () { return chunkM2ILMK44_cjs.orgScope; }
237
245
  });
238
246
  Object.defineProperty(exports, "otherSurfaces", {
239
247
  enumerable: true,
240
- get: function () { return chunkHSPMQQVJ_cjs.otherSurfaces; }
248
+ get: function () { return chunkM2ILMK44_cjs.otherSurfaces; }
241
249
  });
242
250
  Object.defineProperty(exports, "providerInitials", {
243
251
  enumerable: true,
244
- get: function () { return chunkHSPMQQVJ_cjs.providerInitials; }
252
+ get: function () { return chunkM2ILMK44_cjs.providerInitials; }
245
253
  });
246
254
  Object.defineProperty(exports, "renderMenuItems", {
247
255
  enumerable: true,
248
- get: function () { return chunkHSPMQQVJ_cjs.renderMenuItems; }
256
+ get: function () { return chunkM2ILMK44_cjs.renderMenuItems; }
249
257
  });
250
258
  Object.defineProperty(exports, "rowShift", {
251
259
  enumerable: true,
252
- get: function () { return chunkHSPMQQVJ_cjs.rowShift; }
260
+ get: function () { return chunkM2ILMK44_cjs.rowShift; }
253
261
  });
254
262
  Object.defineProperty(exports, "targetIndex", {
255
263
  enumerable: true,
256
- get: function () { return chunkHSPMQQVJ_cjs.targetIndex; }
264
+ get: function () { return chunkM2ILMK44_cjs.targetIndex; }
257
265
  });
258
266
  Object.defineProperty(exports, "useToast", {
259
267
  enumerable: true,
260
- get: function () { return chunkHSPMQQVJ_cjs.useToast; }
268
+ get: function () { return chunkM2ILMK44_cjs.useToast; }
261
269
  });
262
270
  Object.defineProperty(exports, "utilColor", {
263
271
  enumerable: true,
264
- get: function () { return chunkHSPMQQVJ_cjs.utilColor; }
272
+ get: function () { return chunkM2ILMK44_cjs.utilColor; }
265
273
  });
266
274
  Object.defineProperty(exports, "AgnosticThemeToggle", {
267
275
  enumerable: true,
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- export { AppHeader, BarChart, BarRows, BrandMark, CHART_OTHER, CHART_PALETTE, ComboBox, ContextMenu, Boxes as CustomModelMark, DataTable, Donut, Donut2 as DonutRing, DropdownMenu, EmptyState, FadeIn, FieldRow, FieldSelect, FieldSlider, FieldSwitch, FieldText, FieldTextArea, FloatingMenu, GenericLogo, HanzoMark, HintButton, LegendDot, LineChart, MenuItemView, MenuLabelView, MenuPanel, MenuSeparatorView, MetricCard, Sparkline2 as MetricSparkline, MiniBars, OrgSwitcher, PageHeader, Panel, PortalTheme, PrimaryButton, ProductIcon, ProviderLogo, Reorder, SERIES, LG as SLIDEOVER_LG, SURFACES, SelectMenu, SlideOver, Sparkline, StatusTag, ToastProvider, UtilBar, asColor, colorForIndex, filterOptions, filterOrgs, isKnownOption, orgScope, otherSurfaces, providerInitials, renderMenuItems, rowShift, targetIndex, useToast, utilColor } from './chunk-GDGVXU7W.js';
2
+ export { AppHeader, BarChart, BarRows, BrandMark, CHART_OTHER, CHART_PALETTE, ComboBox, ContextMenu, Boxes as CustomModelMark, DataTable, Donut, Donut2 as DonutRing, DropdownMenu, EmptyState, FadeIn, FieldRow, FieldSelect, FieldSlider, FieldSwitch, FieldText, FieldTextArea, FloatingMenu, GenericLogo, HanzoMark, HintButton, LegendDot, LineChart, MenuItemView, MenuLabelView, MenuPanel, MenuSeparatorView, MetricCard, Sparkline2 as MetricSparkline, MiniBars, OrgMark, OrgSwitcher, PageHeader, Panel, PortalTheme, PrimaryButton, ProductIcon, ProviderLogo, Reorder, SERIES, LG as SLIDEOVER_LG, SURFACES, SelectMenu, SlideOver, Sparkline, StatusTag, ToastProvider, UtilBar, asColor, colorForIndex, filterOptions, filterOrgs, isKnownOption, monogram, orgScope, otherSurfaces, providerInitials, renderMenuItems, rowShift, targetIndex, useToast, utilColor } from './chunk-YSURJUOA.js';
3
3
  export { AgnosticThemeToggle, ThemeToggle, ThemeToggleNext } from './chunk-42CU5GSF.js';
4
4
  export { TAG_TONES, tagTone, tokens } from '@hanzo/data';
5
5
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * What an OSS blueprint actually provisions, read from its own `docker-compose.yml`.
3
+ *
4
+ * This is the one implementation. It was written twice before it lived here — once in
5
+ * TypeScript for the console's App Store and once in vanilla JS for oss.hanzo.ai — and
6
+ * two readers of the same file format drift, which means two surfaces can disagree
7
+ * about what a deploy will start.
8
+ *
9
+ * Deliberately a SMALL structural reader, not a YAML implementation: it walks the
10
+ * `services:` block by indentation and pulls only the keys a detail view shows.
11
+ * Anything it cannot read is absent, never guessed, so a surface degrades to "no
12
+ * blueprint detail" instead of asserting something false about what will run.
13
+ *
14
+ * Pure and total — it never throws on malformed or hostile input — so it is safe to
15
+ * run on untrusted CDN content and testable without a DOM or a network.
16
+ */
17
+ /**
18
+ * One service a blueprint provisions. `image` is absent for a service built from
19
+ * source (`build:` rather than `image:`).
20
+ */
21
+ export type Service = {
22
+ name: string;
23
+ image?: string;
24
+ ports: string[];
25
+ };
26
+ /** What a blueprint provisions: the containers it starts and the config it expects. */
27
+ export type Blueprint = {
28
+ services: Service[];
29
+ env: string[];
30
+ };
31
+ /**
32
+ * Parse the load-bearing facts out of a `docker-compose.yml`: the services it starts
33
+ * (with image + published ports) and the environment keys it expects.
34
+ *
35
+ * Environment KEYS only — never the values, which are routinely secrets.
36
+ */
37
+ export declare function parseBlueprint(yaml: string): Blueprint;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The OSS App Store catalog — the shared client for the 1000+-app one-click
3
+ * open-source catalog served as a flat JSON array at `<base>/meta.json`, with per-app
4
+ * blueprint assets under `<base>/blueprints/<id>/`.
5
+ *
6
+ * One catalog, several surfaces: the console App Store, platform.hanzo.ai, and the
7
+ * public gallery at oss.hanzo.ai. They previously each carried their own copy of the
8
+ * shape, the normalizer and the URL builders, which is how three surfaces come to
9
+ * disagree about the same catalog row. This is the one implementation.
10
+ *
11
+ * The catalog is a PUBLIC CDN with open CORS, so a browser fetches it DIRECTLY — no
12
+ * BFF, no `/v1` proxy — which is why this works in the go:embed console where the
13
+ * Next reverse-proxies are pruned. The base URL is INJECTED by the caller, so this
14
+ * module holds no config import and its normalizers + URL builders stay pure.
15
+ */
16
+ /** One open-source app in the catalog (the meta.json entry, load-bearing fields only). */
17
+ export type OssApp = {
18
+ /** Stable catalog id + blueprint path segment, e.g. `2fauth`, `n8n`, `postgres`. */
19
+ id: string;
20
+ /** Display name, e.g. "2FAuth". */
21
+ name: string;
22
+ /** One-line description. */
23
+ description: string;
24
+ /** Version label — often the literal string `"latest"`, rendered raw. */
25
+ version: string;
26
+ /** Bare logo filename (e.g. `logo.svg`), resolved against the blueprint path. */
27
+ logo: string;
28
+ /** Category/provenance tags (e.g. `productivity`, `self-hosted`, `caprover`). */
29
+ tags: string[];
30
+ /** External links; only github/website/docs are surfaced. */
31
+ links: {
32
+ github?: string;
33
+ website?: string;
34
+ docs?: string;
35
+ };
36
+ };
37
+ /** Normalize one catalog record to an `OssApp` (drops a record with no id + name). */
38
+ export declare function normalizeOssApp(raw: unknown): OssApp | null;
39
+ /** Normalize the catalog payload to the app list (bare array OR a `{data|apps|…}` wrap). */
40
+ export declare function normalizeOssApps(payload: unknown): OssApp[];
41
+ /** The per-app blueprint asset base: `<base>/blueprints/<id>`. */
42
+ export declare function blueprintBase(base: string, id: string): string;
43
+ /**
44
+ * The app's logo URL, or null when the entry carries no logo filename — a surface then
45
+ * renders its monogram fallback rather than a broken image.
46
+ */
47
+ export declare function logoUrl(base: string, app: OssApp): string | null;
48
+ /**
49
+ * Derive `owner/repo` from a GitHub URL — the maker identity, since the catalog
50
+ * carries no author field. Returns null for a non-GitHub / malformed URL.
51
+ */
52
+ export declare function ownerRepo(githubUrl?: string): string | null;
53
+ /** An app is one-click deployable when it carries a buildable source (its repo). */
54
+ export declare function hasDeploySource(app: OssApp): boolean;
55
+ /**
56
+ * Fetch + normalize the catalog from `<base>/meta.json`. Cross-origin and
57
+ * unauthenticated (public CDN); throws on a non-2xx or parse failure so the caller can
58
+ * show an honest error state. Cached on success; `force` bypasses for a manual refresh.
59
+ */
60
+ export declare function fetchOssApps(base: string, force?: boolean): Promise<OssApp[]>;
61
+ /**
62
+ * Fetch one app's `docker-compose.yml` as raw text, or null when the entry publishes
63
+ * none. A 404 is a NORMAL answer for a large community catalog — not every blueprint
64
+ * ships compose — so this never throws: a detail view treats an absent blueprint as
65
+ * "nothing to show", and an optional asset must not fail a whole page.
66
+ */
67
+ export declare function fetchCompose(base: string, id: string): Promise<string | null>;
package/dist/oss.cjs ADDED
@@ -0,0 +1,190 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ // src/oss/catalog.ts
5
+ var str = (v) => typeof v === "string" ? v : "";
6
+ var strTrim = (v) => {
7
+ const s = str(v).trim();
8
+ return s ? s : void 0;
9
+ };
10
+ var strList = (v) => Array.isArray(v) ? v.map((x) => typeof x === "string" ? x.trim() : "").filter((x) => x !== "") : [];
11
+ var asRecord = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
12
+ function normalizeOssApp(raw) {
13
+ const r = asRecord(raw);
14
+ const id = str(r.id).trim();
15
+ const name = str(r.name).trim() || id;
16
+ if (!id || !name) return null;
17
+ const links = asRecord(r.links);
18
+ return {
19
+ id,
20
+ name,
21
+ description: str(r.description).trim(),
22
+ version: str(r.version).trim() || "latest",
23
+ logo: str(r.logo).trim(),
24
+ tags: strList(r.tags),
25
+ links: {
26
+ github: strTrim(links.github),
27
+ website: strTrim(links.website),
28
+ docs: strTrim(links.docs)
29
+ }
30
+ };
31
+ }
32
+ function normalizeOssApps(payload) {
33
+ let arr = [];
34
+ if (Array.isArray(payload)) arr = payload;
35
+ else if (payload && typeof payload === "object") {
36
+ for (const k of ["data", "apps", "templates", "items", "rows"]) {
37
+ const v = payload[k];
38
+ if (Array.isArray(v)) {
39
+ arr = v;
40
+ break;
41
+ }
42
+ }
43
+ }
44
+ const out = [];
45
+ const seen = /* @__PURE__ */ new Set();
46
+ for (const raw of arr) {
47
+ const app = normalizeOssApp(raw);
48
+ if (app && !seen.has(app.id)) {
49
+ seen.add(app.id);
50
+ out.push(app);
51
+ }
52
+ }
53
+ return out;
54
+ }
55
+ function blueprintBase(base, id) {
56
+ return `${base.replace(/\/+$/, "")}/blueprints/${encodeURIComponent(id)}`;
57
+ }
58
+ function logoUrl(base, app) {
59
+ if (!app.logo) return null;
60
+ return `${blueprintBase(base, app.id)}/${app.logo}`;
61
+ }
62
+ function ownerRepo(githubUrl) {
63
+ if (!githubUrl) return null;
64
+ const m = githubUrl.match(/github\.com\/([^/\s]+)\/([^/\s#?]+)/i);
65
+ if (!m) return null;
66
+ const owner = m[1];
67
+ const repo = m[2].replace(/\.git$/i, "");
68
+ if (!owner || !repo) return null;
69
+ return `${owner}/${repo}`;
70
+ }
71
+ function hasDeploySource(app) {
72
+ return Boolean(app.links.github);
73
+ }
74
+ var cache = /* @__PURE__ */ new Map();
75
+ var inflight = /* @__PURE__ */ new Map();
76
+ async function fetchOssApps(base, force = false) {
77
+ const key = base.replace(/\/+$/, "");
78
+ if (!force) {
79
+ const hit = cache.get(key);
80
+ if (hit) return hit;
81
+ const pending = inflight.get(key);
82
+ if (pending) return pending;
83
+ }
84
+ const run = (async () => {
85
+ const res = await fetch(`${key}/meta.json`, {
86
+ headers: { Accept: "application/json" },
87
+ // Public catalog — no credentials, so a session cookie never leaks cross-origin.
88
+ credentials: "omit"
89
+ });
90
+ if (!res.ok) throw new Error(`Catalog unavailable (HTTP ${res.status})`);
91
+ const apps = normalizeOssApps(await res.json());
92
+ cache.set(key, apps);
93
+ return apps;
94
+ })();
95
+ inflight.set(key, run);
96
+ try {
97
+ return await run;
98
+ } finally {
99
+ inflight.delete(key);
100
+ }
101
+ }
102
+ async function fetchCompose(base, id) {
103
+ try {
104
+ const res = await fetch(`${blueprintBase(base, id)}/docker-compose.yml`, {
105
+ headers: { Accept: "text/plain" },
106
+ credentials: "omit"
107
+ });
108
+ if (!res.ok) return null;
109
+ const text = await res.text();
110
+ return text.trim() ? text : null;
111
+ } catch {
112
+ return null;
113
+ }
114
+ }
115
+
116
+ // src/oss/blueprint.ts
117
+ var indent = (line) => line.length - line.trimStart().length;
118
+ function parseBlueprint(yaml) {
119
+ const lines = String(yaml ?? "").split(/\r?\n/);
120
+ const services = [];
121
+ const env = /* @__PURE__ */ new Set();
122
+ let servicesAt = -1;
123
+ let current = null;
124
+ let currentAt = -1;
125
+ let listKey = null;
126
+ let listAt = -1;
127
+ for (const raw of lines) {
128
+ const line = raw.replace(/\t/g, " ");
129
+ const trimmed = line.trim();
130
+ if (!trimmed || trimmed.startsWith("#")) continue;
131
+ const col = indent(line);
132
+ if (servicesAt < 0) {
133
+ if (/^services\s*:/.test(trimmed)) servicesAt = col;
134
+ continue;
135
+ }
136
+ if (col <= servicesAt) {
137
+ if (!/^services\s*:/.test(trimmed)) break;
138
+ continue;
139
+ }
140
+ if (current === null || col <= currentAt) {
141
+ const m = trimmed.match(/^([A-Za-z0-9._-]+)\s*:\s*$/);
142
+ if (m) {
143
+ current = { name: m[1], ports: [] };
144
+ currentAt = col;
145
+ services.push(current);
146
+ listKey = null;
147
+ continue;
148
+ }
149
+ }
150
+ if (!current) continue;
151
+ if (listKey && col > listAt && trimmed.startsWith("-")) {
152
+ const item = trimmed.replace(/^-\s*/, "").replace(/^["']|["']$/g, "");
153
+ if (listKey === "ports") current.ports.push(item);
154
+ else {
155
+ const key = item.split(/[=:]/)[0]?.trim();
156
+ if (key) env.add(key);
157
+ }
158
+ continue;
159
+ }
160
+ listKey = null;
161
+ const img = trimmed.match(/^image\s*:\s*(.+)$/);
162
+ if (img) {
163
+ current.image = img[1].trim().replace(/^["']|["']$/g, "");
164
+ continue;
165
+ }
166
+ if (/^ports\s*:/.test(trimmed)) {
167
+ listKey = "ports";
168
+ listAt = col;
169
+ continue;
170
+ }
171
+ if (/^environment\s*:/.test(trimmed)) {
172
+ listKey = "environment";
173
+ listAt = col;
174
+ continue;
175
+ }
176
+ }
177
+ return { services, env: [...env].sort((a, b) => a.localeCompare(b)) };
178
+ }
179
+
180
+ exports.blueprintBase = blueprintBase;
181
+ exports.fetchCompose = fetchCompose;
182
+ exports.fetchOssApps = fetchOssApps;
183
+ exports.hasDeploySource = hasDeploySource;
184
+ exports.logoUrl = logoUrl;
185
+ exports.normalizeOssApp = normalizeOssApp;
186
+ exports.normalizeOssApps = normalizeOssApps;
187
+ exports.ownerRepo = ownerRepo;
188
+ exports.parseBlueprint = parseBlueprint;
189
+ //# sourceMappingURL=oss.cjs.map
190
+ //# sourceMappingURL=oss.cjs.map