@jchat/addon-sdk 1.0.0-alpha.32 → 1.0.0-alpha.34

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @jchat/addon-sdk
2
2
 
3
+ ## 1.0.0-alpha.34
4
+
5
+ ### Patch Changes
6
+
7
+ - Clean up obsolete CSS minification replacement rules
8
+
9
+ - Consolidate manifest compatibility contract to single semver range string
10
+
11
+ - Bumped `@jchat/*` dependencies:
12
+ - [`ui@1.0.0-alpha.30`](https://github.com/jchatcloud/jchat/releases/tag/ui@v1.0.0-alpha.30)
13
+
14
+ ## 1.0.0-alpha.33
15
+
16
+ ### Patch Changes
17
+
18
+ - Remove AddonSettingsLoading in favor of standard Loader component
19
+
20
+ - Configure default query retry for addon queries
21
+
22
+ - Bumped `@jchat/*` dependencies:
23
+ - [`ui@1.0.0-alpha.29`](https://github.com/jchatcloud/jchat/releases/tag/ui@v1.0.0-alpha.29)
24
+
3
25
  ## 1.0.0-alpha.32
4
26
 
5
27
  No changes in this release.
package/README.md CHANGED
@@ -61,10 +61,7 @@ export default defineAddonManifest({
61
61
  description: "Search and insert animated GIFs directly into chat messages.",
62
62
  author: "JChat Ecosystem Team",
63
63
  publisher: { id: "jchat" },
64
- compatibility: {
65
- jchat: ">=1.0.0-alpha.0 <2.0.0",
66
- addonSdk: "^1.0.0"
67
- },
64
+ compatibility: ">=1.0.0-alpha.0 <2.0.0",
68
65
  locales: [
69
66
  "ar",
70
67
  "bg",
@@ -104,13 +104,11 @@ interface AddonManifest {
104
104
  locales?: string[];
105
105
  /** Default fallback language code (e.g. "en") */
106
106
  defaultLocale?: string;
107
- /** Host and SDK versions this directly executed plugin was built and tested against */
108
- compatibility: {
109
- /** Supported JChat versions as a semantic-version range, for example `^1.0.0` */
110
- jchat: string;
111
- /** Supported `@jchat/addon-sdk` versions as a semantic-version range */
112
- addonSdk: string;
113
- };
107
+ /**
108
+ * Supported JChat versions as a semantic-version range, for example `^1.0.0` or `>=1.0.0-alpha.0
109
+ * <2.0.0`
110
+ */
111
+ compatibility: string;
114
112
  /** Identity of the trusted publisher that signed this package. Required when migrations exist */
115
113
  publisher?: {
116
114
  id: string;
@@ -65,4 +65,14 @@ export declare function diagnoseAddonPackage(options: AddonPackageDiagnosticOpti
65
65
  * @returns `true` if at least one check has `status === "error"`, otherwise `false`.
66
66
  */
67
67
  export declare function hasAddonDiagnosticErrors(diagnostics: readonly AddonPackageDiagnostic[]): boolean;
68
+ /**
69
+ * Evaluates semantic version compatibility between a target version and a semver range string.
70
+ *
71
+ * @param id - Diagnostic check identifier.
72
+ * @param label - Diagnostic check label.
73
+ * @param version - Environment component version string.
74
+ * @param range - Expected semver range string from manifest compatibility declarations.
75
+ * @returns An {@link AddonPackageDiagnostic} result object.
76
+ */
77
+ export declare function isVersionCompatible(version: string, range: string): boolean;
68
78
  //#endregion
@@ -39,7 +39,7 @@ function createCompatibleMajorRange(version) {
39
39
  function diagnoseAddonPackage(options) {
40
40
  const { buildDir, manifest } = options;
41
41
  const diagnostics = [];
42
- diagnostics.push(compatibilityDiagnostic("jchat", "JChat compatibility", options.jchatVersion, manifest.compatibility?.jchat), compatibilityDiagnostic("addon-sdk", "Addon SDK compatibility", options.addonSdkVersion, manifest.compatibility?.addonSdk));
42
+ diagnostics.push(compatibilityDiagnostic("jchat", "JChat compatibility", options.jchatVersion, manifest.compatibility));
43
43
  const references = [
44
44
  [
45
45
  "frontend-bundle",
@@ -135,8 +135,20 @@ function hasAddonDiagnosticErrors(diagnostics) {
135
135
  * @param range - Expected semver range string from manifest compatibility declarations.
136
136
  * @returns An {@link AddonPackageDiagnostic} result object.
137
137
  */
138
+ function isVersionCompatible(version, range) {
139
+ if (Bun.semver.satisfies(version, range)) return true;
140
+ if (version.includes("-")) {
141
+ const prereleaseRange = range.replace(/(\d+\.\d+\.\d+)(?![\w.-])/g, (m) => `${m}-0`);
142
+ try {
143
+ return Boolean(Bun.semver.satisfies(version, prereleaseRange));
144
+ } catch {
145
+ return false;
146
+ }
147
+ }
148
+ return false;
149
+ }
138
150
  function compatibilityDiagnostic(id, label, version, range) {
139
- const compatible = Boolean(range && Bun.semver.satisfies(version, range));
151
+ const compatible = Boolean(range && isVersionCompatible(version, range));
140
152
  return {
141
153
  id,
142
154
  label,
@@ -172,4 +184,4 @@ function listRegularFiles(root) {
172
184
  }).filter((entry) => entry.isFile()).map((entry) => path$1.join(entry.parentPath, entry.name));
173
185
  }
174
186
  //#endregion
175
- export { createCompatibleMajorRange, diagnoseAddonPackage, hasAddonDiagnosticErrors };
187
+ export { createCompatibleMajorRange, diagnoseAddonPackage, hasAddonDiagnosticErrors, isVersionCompatible };
package/dist/signing.mjs CHANGED
@@ -101,7 +101,7 @@ function validateAddonManifest(manifest) {
101
101
  if (!manifest.id || manifest.id.length > 40 || !ADDON_ID_PATTERN.test(manifest.id)) throw new Error("Manifest id must contain only lowercase letters, numbers, and hyphens");
102
102
  if (!manifest.name || manifest.name.length > 120) throw new Error("Manifest name is invalid");
103
103
  if (!manifest.version || String(manifest.version).length > 64) throw new Error("Manifest version is invalid");
104
- if (!isCompatibilityRange(manifest.compatibility?.jchat) || !isCompatibilityRange(manifest.compatibility?.addonSdk)) throw new Error("Manifest must declare valid JChat and addon SDK compatibility ranges");
104
+ if (!isCompatibilityRange(manifest.compatibility)) throw new Error("Manifest must declare a valid JChat compatibility range");
105
105
  if (manifest.distribution !== void 0 && manifest.distribution !== "free" && manifest.distribution !== "commercial") throw new Error("Manifest distribution must be either 'free' or 'commercial'");
106
106
  if (!manifest.logo || typeof manifest.logo !== "string" || !manifest.logo.trim()) throw new Error("Manifest logo is required");
107
107
  const cleanLogo = manifest.logo.replace(/^\.\//, "");
package/dist/src.mjs CHANGED
@@ -2,7 +2,7 @@ import "./i18n.mjs";
2
2
  import { AbilityBuilder, createMongoAbility, subject } from "@casl/ability";
3
3
  import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4
4
  //#region package.json
5
- var version = "1.0.0-alpha.32";
5
+ var version = "1.0.0-alpha.34";
6
6
  //#endregion
7
7
  //#region src/permissions.ts
8
8
  /**
@@ -125,6 +125,7 @@ function useAddonQuery(options) {
125
125
  return sdk.api.get(path);
126
126
  });
127
127
  return useQuery({
128
+ retry: 1,
128
129
  ...queryOptions,
129
130
  queryKey: effectiveKey,
130
131
  queryFn: effectiveFn
package/dist/ui.d.mts CHANGED
@@ -39,10 +39,5 @@ export interface AddonCanProps {
39
39
  * @param children Content rendered when access is granted
40
40
  */
41
41
  export declare function AddonCan({ actor, ownerId, ownPermission, anyPermission, permission, fallback, children }: AddonCanProps): React.ReactElement | null;
42
- /** Standard loading spinner for addon settings views. */
43
- export declare function AddonSettingsLoading({ message, className }: {
44
- message?: string;
45
- className?: string;
46
- }): React.ReactElement;
47
42
  //#endregion
48
43
  export { Can, ui_default as default };
package/dist/ui.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { v as hasPermission } from "./src.mjs";
2
- import React from "react";
2
+ import "react";
3
3
  import ui_default from "@jchat/ui";
4
4
  import { Can } from "@casl/react";
5
5
  export * from "@jchat/ui";
@@ -31,9 +31,5 @@ function AddonCan({ actor, ownerId, ownPermission, anyPermission, permission, fa
31
31
  }
32
32
  return children;
33
33
  }
34
- /** Standard loading spinner for addon settings views. */
35
- function AddonSettingsLoading({ message = "Loading configuration...", className }) {
36
- return React.createElement("div", { className: "flex items-center justify-center p-8 text-sm text-muted-foreground" + (className ? ` ${className}` : "") }, React.createElement("span", { className: "me-2 inline-block size-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }), message);
37
- }
38
34
  //#endregion
39
- export { AddonCan, AddonSettingsLoading, Can, ui_default as default };
35
+ export { AddonCan, Can, ui_default as default };
package/dist/vite.mjs CHANGED
@@ -270,9 +270,6 @@ function embedCssIntoBundle(buildDir) {
270
270
  css = css.replace(/@keyframes\s+wave-dots\s*\{[\s\S]*?\n\}/g, "");
271
271
  css = css.replace(/@keyframes\s+gradient-border\s*\{[\s\S]*?\n\}/g, "");
272
272
  css = css.replace(/\.animate-gradient(?:-border|-text)?\s*\{[^}]+\}/g, "");
273
- css = css.replace(/\.me\s*\{[^}]+\}/g, "");
274
- css = css.replace(/\.user-border\s*\{[^}]+\}/g, "");
275
- css = css.replace(/\.scrollbar-hide[^{]*\{[^}]+\}/g, "");
276
273
  css = css.replace(/@layer\s+components(?:\s*\{[^}]*\}|;)/g, "");
277
274
  css = minifyCss(css);
278
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jchat/addon-sdk",
3
- "version": "1.0.0-alpha.32",
3
+ "version": "1.0.0-alpha.34",
4
4
  "private": false,
5
5
  "description": "JChat Addon SDK for building JChat addons.",
6
6
  "keywords": [
@@ -46,10 +46,7 @@ export default defineAddonManifest({
46
46
  version: "1.0.0",
47
47
  description: "Create and vote on live interactive polls in chat rooms.",
48
48
  author: "JChat Ecosystem Team",
49
- compatibility: {
50
- jchat: ">=1.0.0-alpha.0 <2.0.0",
51
- addonSdk: ">=1.0.0-alpha.0 <2.0.0"
52
- },
49
+ compatibility: ">=1.0.0-alpha.0 <2.0.0",
53
50
  locales: [
54
51
  "ar",
55
52
  "bg",