@glasshome/widget-sdk 0.2.5 → 0.3.3

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/schemas.d.ts CHANGED
@@ -25,7 +25,23 @@ export declare const WidgetManifestSchema: z.ZodObject<{
25
25
  icon: z.ZodOptional<z.ZodString>;
26
26
  schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
27
  defaultConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
28
- }, z.core.$strip>;
28
+ version: z.ZodOptional<z.ZodString>;
29
+ displayName: z.ZodOptional<z.ZodString>;
30
+ scope: z.ZodOptional<z.ZodString>;
31
+ author: z.ZodOptional<z.ZodString>;
32
+ license: z.ZodOptional<z.ZodString>;
33
+ homepage: z.ZodOptional<z.ZodString>;
34
+ source: z.ZodOptional<z.ZodString>;
35
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
36
+ isOfficial: z.ZodOptional<z.ZodBoolean>;
37
+ sha256Hash: z.ZodOptional<z.ZodString>;
38
+ bundleUrl: z.ZodOptional<z.ZodString>;
39
+ _registry: z.ZodOptional<z.ZodEnum<{
40
+ local: "local";
41
+ hub: "hub";
42
+ }>>;
43
+ releaseNotes: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$loose>;
29
45
  export declare const PublishRequestSchema: z.ZodObject<{
30
46
  action: z.ZodLiteral<"request">;
31
47
  scope: z.ZodString;
package/dist/schemas.js CHANGED
@@ -2,7 +2,7 @@ import { z as n } from "zod";
2
2
  const t = n.object({
3
3
  w: n.number().int().min(1),
4
4
  h: n.number().int().min(1)
5
- }), u = n.object({
5
+ }), p = n.object({
6
6
  name: n.string().min(1),
7
7
  description: n.string().optional(),
8
8
  minSize: t,
@@ -10,10 +10,26 @@ const t = n.object({
10
10
  sdkVersion: n.string().min(1),
11
11
  icon: n.string().optional(),
12
12
  schema: n.record(n.string(), n.unknown()).optional(),
13
- defaultConfig: n.record(n.string(), n.unknown()).optional()
14
- }), o = /^[a-z0-9][a-z0-9-]*$/, a = n.object({
13
+ defaultConfig: n.record(n.string(), n.unknown()).optional(),
14
+ // Round-trip fields set by the Hub / widget browser when installing. These
15
+ // must validate so real manifests stringified from WidgetRegistryEntry
16
+ // pass through the canonical schema without being stripped.
17
+ version: n.string().optional(),
18
+ displayName: n.string().optional(),
19
+ scope: n.string().optional(),
20
+ author: n.string().optional(),
21
+ license: n.string().optional(),
22
+ homepage: n.string().url().optional(),
23
+ source: n.string().url().optional(),
24
+ permissions: n.array(n.string()).optional(),
25
+ isOfficial: n.boolean().optional(),
26
+ sha256Hash: n.string().optional(),
27
+ bundleUrl: n.string().optional(),
28
+ _registry: n.enum(["hub", "local"]).optional(),
29
+ releaseNotes: n.string().optional()
30
+ }).passthrough(), r = /^[a-z0-9][a-z0-9-]*$/, a = n.object({
15
31
  action: n.literal("request"),
16
- scope: n.string().regex(o, "Must be lowercase alphanumeric with hyphens"),
32
+ scope: n.string().regex(r, "Must be lowercase alphanumeric with hyphens"),
17
33
  name: n.string().min(1),
18
34
  displayName: n.string().min(1),
19
35
  description: n.string().optional(),
@@ -28,36 +44,36 @@ const t = n.object({
28
44
  }), c = n.object({
29
45
  action: n.literal("confirm"),
30
46
  versionId: n.string().min(1)
31
- }), p = n.discriminatedUnion("action", [
47
+ }), m = n.discriminatedUnion("action", [
32
48
  a,
33
49
  c
34
50
  ]);
35
- function h(i) {
51
+ function g(i) {
36
52
  return JSON.stringify(i);
37
53
  }
38
- function l(i, e = { w: 1, h: 1 }) {
54
+ function u(i, o = { w: 1, h: 1 }) {
39
55
  if (i != null && typeof i == "object") {
40
56
  const s = t.safeParse(i);
41
57
  if (s.success) return s.data;
42
58
  }
43
59
  if (typeof i == "string")
44
60
  try {
45
- const s = JSON.parse(i), r = t.safeParse(s);
46
- if (r.success) return r.data;
61
+ const s = JSON.parse(i), e = t.safeParse(s);
62
+ if (e.success) return e.data;
47
63
  } catch {
48
64
  }
49
- return e;
65
+ return o;
50
66
  }
51
- function g(i) {
52
- return i.issues.map((e) => `${e.path.length > 0 ? e.path.join(".") : "(root)"}: ${e.message}`).join("; ");
67
+ function h(i) {
68
+ return i.issues.map((o) => `${o.path.length > 0 ? o.path.join(".") : "(root)"}: ${o.message}`).join("; ");
53
69
  }
54
70
  export {
55
71
  t as GridSizeSchema,
56
- p as PublishBodySchema,
72
+ m as PublishBodySchema,
57
73
  c as PublishConfirmSchema,
58
74
  a as PublishRequestSchema,
59
- u as WidgetManifestSchema,
60
- g as formatSchemaError,
61
- l as parseGridSize,
62
- h as serializeGridSize
75
+ p as WidgetManifestSchema,
76
+ h as formatSchemaError,
77
+ u as parseGridSize,
78
+ g as serializeGridSize
63
79
  };
package/dist/version.d.ts CHANGED
@@ -1,5 +1 @@
1
- /**
2
- * SDK version constant for runtime version compatibility checking.
3
- * The host can compare this against widget manifest sdkVersion fields.
4
- */
5
- export declare const SDK_VERSION = "0.2.0";
1
+ export declare const SDK_VERSION: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/widget-sdk",
3
- "version": "0.2.5",
3
+ "version": "0.3.3",
4
4
  "description": "SDK for building GlassHome dashboard widgets with SolidJS",
5
5
  "keywords": [
6
6
  "glasshome",