@ggui-ai/registry-core 0.1.0-rc.1

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.
Files changed (60) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +76 -0
  3. package/dist/impls/memory-bundle-storage.d.ts +12 -0
  4. package/dist/impls/memory-bundle-storage.d.ts.map +1 -0
  5. package/dist/impls/memory-bundle-storage.js +40 -0
  6. package/dist/impls/memory-registry-storage.d.ts +3 -0
  7. package/dist/impls/memory-registry-storage.d.ts.map +1 -0
  8. package/dist/impls/memory-registry-storage.js +154 -0
  9. package/dist/index.d.ts +26 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +26 -0
  12. package/dist/interfaces/authn.d.ts +51 -0
  13. package/dist/interfaces/authn.d.ts.map +1 -0
  14. package/dist/interfaces/authn.js +1 -0
  15. package/dist/interfaces/bundle-storage.d.ts +79 -0
  16. package/dist/interfaces/bundle-storage.d.ts.map +1 -0
  17. package/dist/interfaces/bundle-storage.js +1 -0
  18. package/dist/interfaces/registry-storage.d.ts +204 -0
  19. package/dist/interfaces/registry-storage.d.ts.map +1 -0
  20. package/dist/interfaces/registry-storage.js +19 -0
  21. package/dist/ops/compile.d.ts +48 -0
  22. package/dist/ops/compile.d.ts.map +1 -0
  23. package/dist/ops/compile.js +163 -0
  24. package/dist/ops/conformance.d.ts +154 -0
  25. package/dist/ops/conformance.d.ts.map +1 -0
  26. package/dist/ops/conformance.js +487 -0
  27. package/dist/ops/list-versions.d.ts +58 -0
  28. package/dist/ops/list-versions.d.ts.map +1 -0
  29. package/dist/ops/list-versions.js +60 -0
  30. package/dist/ops/publish.d.ts +70 -0
  31. package/dist/ops/publish.d.ts.map +1 -0
  32. package/dist/ops/publish.js +417 -0
  33. package/dist/ops/read.d.ts +52 -0
  34. package/dist/ops/read.d.ts.map +1 -0
  35. package/dist/ops/read.js +60 -0
  36. package/dist/ops/register-author-key.d.ts +22 -0
  37. package/dist/ops/register-author-key.d.ts.map +1 -0
  38. package/dist/ops/register-author-key.js +171 -0
  39. package/dist/ops/search.d.ts +50 -0
  40. package/dist/ops/search.d.ts.map +1 -0
  41. package/dist/ops/search.js +106 -0
  42. package/dist/testing/bundle-storage-contract.d.ts +3 -0
  43. package/dist/testing/bundle-storage-contract.d.ts.map +1 -0
  44. package/dist/testing/bundle-storage-contract.js +176 -0
  45. package/dist/testing/index.d.ts +10 -0
  46. package/dist/testing/index.d.ts.map +1 -0
  47. package/dist/testing/index.js +9 -0
  48. package/dist/testing/registry-storage-contract.d.ts +3 -0
  49. package/dist/testing/registry-storage-contract.d.ts.map +1 -0
  50. package/dist/testing/registry-storage-contract.js +392 -0
  51. package/dist/types.d.ts +482 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +110 -0
  54. package/dist/utils/base64.d.ts +15 -0
  55. package/dist/utils/base64.d.ts.map +1 -0
  56. package/dist/utils/base64.js +35 -0
  57. package/dist/utils/semver.d.ts +13 -0
  58. package/dist/utils/semver.d.ts.map +1 -0
  59. package/dist/utils/semver.js +69 -0
  60. package/package.json +85 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Local semver comparison — supports `MAJOR.MINOR.PATCH` + optional
3
+ * `-pre.release` + (ignored) `+build.metadata`. Implemented locally to
4
+ * avoid a `semver` runtime dep for the very narrow comparison
5
+ * registry-core needs (decide whether a newly-published version is
6
+ * the latest).
7
+ *
8
+ * Returns `-1` / `0` / `1` matching `Array.prototype.sort`. Pre-release
9
+ * versions sort lower than the corresponding non-pre version
10
+ * (`1.0.0-alpha < 1.0.0`) per semver.org. Build metadata is ignored.
11
+ */
12
+ export function compareSemver(a, b) {
13
+ const parse = (v) => {
14
+ const [coreAndPre] = v.split('+');
15
+ const [core, pre = ''] = (coreAndPre ?? '').split('-');
16
+ const [maj = '0', min = '0', pat = '0'] = (core ?? '').split('.');
17
+ return {
18
+ core: [parseInt(maj, 10), parseInt(min, 10), parseInt(pat, 10)],
19
+ pre: pre.length === 0
20
+ ? []
21
+ : pre.split('.').map((seg) => {
22
+ const n = Number(seg);
23
+ return Number.isInteger(n) && /^[0-9]+$/.test(seg) ? n : seg;
24
+ }),
25
+ };
26
+ };
27
+ const pa = parse(a);
28
+ const pb = parse(b);
29
+ for (let i = 0; i < 3; i++) {
30
+ const av = pa.core[i] ?? 0;
31
+ const bv = pb.core[i] ?? 0;
32
+ if (av < bv)
33
+ return -1;
34
+ if (av > bv)
35
+ return 1;
36
+ }
37
+ if (pa.pre.length === 0 && pb.pre.length > 0)
38
+ return 1;
39
+ if (pa.pre.length > 0 && pb.pre.length === 0)
40
+ return -1;
41
+ const len = Math.max(pa.pre.length, pb.pre.length);
42
+ for (let i = 0; i < len; i++) {
43
+ const av = pa.pre[i];
44
+ const bv = pb.pre[i];
45
+ if (av === undefined)
46
+ return -1;
47
+ if (bv === undefined)
48
+ return 1;
49
+ if (typeof av === 'number' && typeof bv === 'number') {
50
+ if (av < bv)
51
+ return -1;
52
+ if (av > bv)
53
+ return 1;
54
+ }
55
+ else if (typeof av === 'number') {
56
+ return -1;
57
+ }
58
+ else if (typeof bv === 'number') {
59
+ return 1;
60
+ }
61
+ else if (av < bv) {
62
+ return -1;
63
+ }
64
+ else if (av > bv) {
65
+ return 1;
66
+ }
67
+ }
68
+ return 0;
69
+ }
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@ggui-ai/registry-core",
3
+ "version": "0.1.0-rc.1",
4
+ "description": "Pure-TypeScript registry operations and storage interfaces for the ggui marketplace. No I/O, no HTTP — operations take typed inputs plus a storage deps bag and return discriminated-union results.",
5
+ "keywords": [
6
+ "ggui",
7
+ "registry",
8
+ "marketplace",
9
+ "mcp",
10
+ "conformance",
11
+ "storage-interface"
12
+ ],
13
+ "license": "Apache-2.0",
14
+ "type": "module",
15
+ "main": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./testing": {
28
+ "types": "./dist/testing/index.d.ts",
29
+ "import": "./dist/testing/index.js",
30
+ "default": "./dist/testing/index.js"
31
+ },
32
+ "./types": {
33
+ "types": "./dist/types.d.ts",
34
+ "import": "./dist/types.js",
35
+ "default": "./dist/types.js"
36
+ },
37
+ "./interfaces/registry-storage": {
38
+ "types": "./dist/interfaces/registry-storage.d.ts",
39
+ "import": "./dist/interfaces/registry-storage.js",
40
+ "default": "./dist/interfaces/registry-storage.js"
41
+ }
42
+ },
43
+ "dependencies": {
44
+ "esbuild": "0.25.12",
45
+ "oxc-parser": "^0.131.0",
46
+ "zod": "^4.3.6",
47
+ "@ggui-ai/artifact-manifest": "0.1.0-rc.1",
48
+ "@ggui-ai/gadget-signing": "0.1.0-rc.1",
49
+ "@ggui-ai/protocol": "0.1.0-rc.1"
50
+ },
51
+ "peerDependenciesMeta": {
52
+ "vitest": {
53
+ "optional": true
54
+ }
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^24.0.0",
58
+ "typescript": "^5.0.0",
59
+ "vitest": "^3.0.0"
60
+ },
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "https://github.com/ggui-ai/ggui.git",
64
+ "directory": "packages/registry-core"
65
+ },
66
+ "homepage": "https://github.com/ggui-ai/ggui/tree/main/packages/registry-core",
67
+ "bugs": {
68
+ "url": "https://github.com/ggui-ai/ggui/issues"
69
+ },
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
73
+ "engines": {
74
+ "node": ">=20.0.0"
75
+ },
76
+ "author": "ggui contributors <hello@ggui.ai>",
77
+ "scripts": {
78
+ "build": "tsc -p tsconfig.build.json",
79
+ "dev": "tsc --watch",
80
+ "typecheck": "tsc --noEmit",
81
+ "test": "vitest run",
82
+ "test:watch": "vitest",
83
+ "clean": "rm -rf dist"
84
+ }
85
+ }