@cyclone-ui/registry-api 0.0.0-stage → 0.3.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/LICENSE +187 -0
  3. package/README.md +23 -2
  4. package/dist/client-B1f6qn7V.d.mts +30 -0
  5. package/dist/client-B1f6qn7V.d.mts.map +1 -0
  6. package/dist/client-CdEiR_5f.d.cts +30 -0
  7. package/dist/client-CdEiR_5f.d.cts.map +1 -0
  8. package/dist/client.cjs +1 -0
  9. package/dist/client.d.cts +2 -0
  10. package/dist/client.d.mts +2 -0
  11. package/dist/client.mjs +2 -0
  12. package/dist/client.mjs.map +1 -0
  13. package/dist/context-80NMoklc.d.cts +10 -0
  14. package/dist/context-80NMoklc.d.cts.map +1 -0
  15. package/dist/context-XjFUvK1j.d.mts +10 -0
  16. package/dist/context-XjFUvK1j.d.mts.map +1 -0
  17. package/dist/context.cjs +1 -0
  18. package/dist/context.d.cts +2 -0
  19. package/dist/context.d.mts +2 -0
  20. package/dist/context.mjs +2 -0
  21. package/dist/context.mjs.map +1 -0
  22. package/dist/errors-BntyHNM7.d.cts +7 -0
  23. package/dist/errors-BntyHNM7.d.cts.map +1 -0
  24. package/dist/errors-BntyHNM7.d.mts +7 -0
  25. package/dist/errors-BntyHNM7.d.mts.map +1 -0
  26. package/dist/errors.cjs +1 -0
  27. package/dist/errors.d.cts +2 -0
  28. package/dist/errors.d.mts +2 -0
  29. package/dist/errors.mjs +2 -0
  30. package/dist/errors.mjs.map +1 -0
  31. package/dist/index.cjs +1 -0
  32. package/dist/index.d.cts +6 -0
  33. package/dist/index.d.mts +6 -0
  34. package/dist/index.mjs +1 -0
  35. package/dist/router-B1KmNsNV.d.cts +29 -0
  36. package/dist/router-B1KmNsNV.d.cts.map +1 -0
  37. package/dist/router-CzaRhoPr.d.mts +29 -0
  38. package/dist/router-CzaRhoPr.d.mts.map +1 -0
  39. package/dist/router.cjs +1 -0
  40. package/dist/router.d.cts +2 -0
  41. package/dist/router.d.mts +2 -0
  42. package/dist/router.mjs +2 -0
  43. package/dist/router.mjs.map +1 -0
  44. package/dist/routes/components.cjs +1 -0
  45. package/dist/routes/components.d.cts +22 -0
  46. package/dist/routes/components.d.cts.map +1 -0
  47. package/dist/routes/components.d.mts +22 -0
  48. package/dist/routes/components.d.mts.map +1 -0
  49. package/dist/routes/components.mjs +2 -0
  50. package/dist/routes/components.mjs.map +1 -0
  51. package/dist/trpc.cjs +1 -0
  52. package/dist/trpc.d.cts +8 -0
  53. package/dist/trpc.d.cts.map +1 -0
  54. package/dist/trpc.d.mts +8 -0
  55. package/dist/trpc.d.mts.map +1 -0
  56. package/dist/trpc.mjs +2 -0
  57. package/dist/trpc.mjs.map +1 -0
  58. package/dist/types-Cn4R4SGM.d.cts +47 -0
  59. package/dist/types-Cn4R4SGM.d.cts.map +1 -0
  60. package/dist/types-Cn4R4SGM.d.mts +47 -0
  61. package/dist/types-Cn4R4SGM.d.mts.map +1 -0
  62. package/dist/types.cjs +1 -0
  63. package/dist/types.d.cts +2 -0
  64. package/dist/types.d.mts +2 -0
  65. package/dist/types.mjs +2 -0
  66. package/dist/types.mjs.map +1 -0
  67. package/package.json +147 -3
  68. package/powerlines.config.ts +28 -0
  69. package/project.json +8 -0
  70. package/src/client.ts +34 -0
  71. package/src/context.ts +41 -0
  72. package/src/errors.ts +25 -0
  73. package/src/index.ts +32 -0
  74. package/src/router.ts +27 -0
  75. package/src/routes/components.ts +175 -0
  76. package/src/trpc.ts +31 -0
  77. package/src/types.ts +70 -0
  78. package/test/routes/components.spec.ts +96 -0
  79. package/tsconfig.json +13 -0
  80. package/tsconfig.spec.json +16 -0
  81. package/vitest.config.mts +24 -0
@@ -0,0 +1,2 @@
1
+ import{createRouter as e,publicProcedure as t}from"../trpc.mjs";import{z as n}from"zod";const r=`registry/components/`;async function i(e,t){let n=[],r;do{let i=await e.list({prefix:t,cursor:r});n.push(...i.objects),r=i.truncated?i.cursor:void 0}while(r);return n}function a(e){let t=e.key.slice(20).split(`/`).filter(Boolean);if(t.length<2||t.at(-1)!==`meta.json`)return null;let n=t[0],i=t.slice(1,-1).join(`/`);return{componentName:n,prefix:`${r}${n}/${i?`${i}/`:``}`,metaObject:e}}function o(e){return[...e.map(a).filter(e=>!!e)].sort((e,t)=>t.metaObject.uploaded.getTime()-e.metaObject.uploaded.getTime()).filter((e,t,n)=>n.findIndex(t=>t.componentName===e.componentName)===t)}const s=e({list:t.query(async({ctx:e})=>{let t=o(await i(e.storage,r));return(await Promise.all(t.map(async t=>{let n=await e.storage.get(t.metaObject.key);if(!n)return null;let r=await n.json();return{name:r.name||t.componentName,version:r.version,release:r.release,description:r.description,tags:r.tags,updatedOn:t.metaObject.uploaded}}))).filter(Boolean)}),get:t.input(n.string()).query(async({input:e,ctx:t})=>{let n=e.replace(/^@cyclone-ui\//,``),a=`${r}${n}/`,s=await i(t.storage,a),c=o(s)[0];if(!c)throw Error(`Component \"${e}\" was not found`);let l=(await Promise.all(s.filter(e=>e.key.startsWith(c.prefix)).map(async e=>t.storage.get(e.key).then(t=>({name:e.key.slice(c.prefix.length),content:t,updatedOn:e.uploaded}))))).filter(Boolean),u=l.find(e=>e.name===`meta.json`);if(!u||!u.content)throw Error(`Metadata file not found`);let d=await u.content.json(),f=l.filter(e=>e.name!==`meta.json`&&e.content),p=await Promise.all(f.filter(e=>e.name!==`meta.json`&&e.content).map(async e=>Promise.resolve(e.content.text())));return{...d,files:f.map((e,t)=>({...e,content:p[t]}))}})});export{s as componentsRouter};
2
+ //# sourceMappingURL=components.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.mjs","names":["COMPONENTS_PREFIX","listAllObjects","objects","cursor","result","storage","getComponentVersion","segments","storageObject","componentName","versionPath","getLatestVersions","value","right","left","all","candidate","version","index","componentsRouter","createRouter","publicProcedure","latestVersions","ctx","content","meta","z","input","componentPrefix","storageObjects","latestVersion","storageFiles","metaFile","file","componentFiles","componentContent"],"sources":[],"mappings":""}
package/dist/trpc.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("@trpc/server").initTRPC.context().create(),t=e.procedure,n=e.procedure,r=e.router;exports.createRouter=r,exports.protectedProcedure=n,exports.publicProcedure=t,exports.t=e;
@@ -0,0 +1,8 @@
1
+ import { t as Context } from "./context-80NMoklc.cjs";
2
+ import { TRPCRootObject } from "@trpc/server";
3
+ declare const t: TRPCRootObject<Context, object, {}>;
4
+ declare const publicProcedure: typeof t.procedure;
5
+ declare const protectedProcedure: typeof t.procedure;
6
+ declare const createRouter: typeof t.router;
7
+ export { createRouter, protectedProcedure, publicProcedure, t };
8
+ //# sourceMappingURL=trpc.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trpc.d.cts","names":[],"sources":["../src/trpc.ts"],"mappings":";;cAuBa,GAAG,eAAe;cAIlB,wBAAwB,EAAE;cAC1B,2BAA2B,EAAE;cAE7B,qBAAqB,EAAE"}
@@ -0,0 +1,8 @@
1
+ import { t as Context } from "./context-XjFUvK1j.mjs";
2
+ import { TRPCRootObject } from "@trpc/server";
3
+ declare const t: TRPCRootObject<Context, object, {}>;
4
+ declare const publicProcedure: typeof t.procedure;
5
+ declare const protectedProcedure: typeof t.procedure;
6
+ declare const createRouter: typeof t.router;
7
+ export { createRouter, protectedProcedure, publicProcedure, t };
8
+ //# sourceMappingURL=trpc.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trpc.d.mts","names":[],"sources":["../src/trpc.ts"],"mappings":""}
package/dist/trpc.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{initTRPC as e}from"@trpc/server";const t=e.context().create(),n=t.procedure,r=t.procedure,i=t.router;export{i as createRouter,r as protectedProcedure,n as publicProcedure,t};
2
+ //# sourceMappingURL=trpc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trpc.mjs","names":["initTRPC","publicProcedure","protectedProcedure","createRouter"],"sources":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ import { R2ObjectBody, R2Objects } from "@cloudflare/workers-types";
2
+ type ComponentPlatform = "web" | "mobile" | "all";
3
+ declare const ComponentPlatform: {
4
+ WEB: ComponentPlatform;
5
+ MOBILE: ComponentPlatform;
6
+ ALL: ComponentPlatform;
7
+ };
8
+ interface ComponentHeader {
9
+ name: string;
10
+ version?: string;
11
+ release: string;
12
+ tags: string[];
13
+ description: string;
14
+ }
15
+ interface ComponentSummary extends ComponentHeader {
16
+ updatedOn: Date;
17
+ }
18
+ interface ComponentMeta extends ComponentHeader {
19
+ dependencies: Record<string, string>;
20
+ devDependencies: Record<string, string>;
21
+ internalDependencies: string[];
22
+ }
23
+ interface ComponentFile {
24
+ name: string;
25
+ content: string;
26
+ checksum?: string;
27
+ updatedOn: Date;
28
+ }
29
+ interface ComponentDetails extends ComponentMeta {
30
+ files: ComponentFile[];
31
+ }
32
+ declare const HttpHeaders: {
33
+ Version: string;
34
+ Checksum: string;
35
+ };
36
+ interface Env {
37
+ STORAGE_BUCKET: RegistryStorage;
38
+ }
39
+ interface RegistryStorage {
40
+ list(options: {
41
+ prefix: string;
42
+ cursor?: string;
43
+ }): Promise<R2Objects>;
44
+ get(key: string): Promise<R2ObjectBody | null>;
45
+ }
46
+ export { ComponentSummary as a, RegistryStorage as c, ComponentPlatform as i, ComponentFile as n, Env as o, ComponentMeta as r, HttpHeaders as s, ComponentDetails as t };
47
+ //# sourceMappingURL=types-Cn4R4SGM.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Cn4R4SGM.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";KAoBY;cAEC;EACG,KAAA;EACM,QAAA;EACN,KAAA;;UAGN;EACR;EACA;EACA;EACA;EACA;;UAGe,yBAAyB;EACxC,WAAW;;UAGI,sBAAsB;EACrC,cAAc;EACd,iBAAiB;EACjB;;UAGe;EACf;EACA;EACA;EACA,WAAW;;UAGI,yBAAyB;EACxC,OAAO;;cAGI;;;;UAKI;EACf,gBAAgB;;UAGD;EACf,KAAK;IAAW;IAAgB;MAAoB,QAAQ;EAC5D,IAAI,cAAc,QAAQ"}
@@ -0,0 +1,47 @@
1
+ import { R2ObjectBody, R2Objects } from "@cloudflare/workers-types";
2
+ type ComponentPlatform = "web" | "mobile" | "all";
3
+ declare const ComponentPlatform: {
4
+ WEB: ComponentPlatform;
5
+ MOBILE: ComponentPlatform;
6
+ ALL: ComponentPlatform;
7
+ };
8
+ interface ComponentHeader {
9
+ name: string;
10
+ version?: string;
11
+ release: string;
12
+ tags: string[];
13
+ description: string;
14
+ }
15
+ interface ComponentSummary extends ComponentHeader {
16
+ updatedOn: Date;
17
+ }
18
+ interface ComponentMeta extends ComponentHeader {
19
+ dependencies: Record<string, string>;
20
+ devDependencies: Record<string, string>;
21
+ internalDependencies: string[];
22
+ }
23
+ interface ComponentFile {
24
+ name: string;
25
+ content: string;
26
+ checksum?: string;
27
+ updatedOn: Date;
28
+ }
29
+ interface ComponentDetails extends ComponentMeta {
30
+ files: ComponentFile[];
31
+ }
32
+ declare const HttpHeaders: {
33
+ Version: string;
34
+ Checksum: string;
35
+ };
36
+ interface Env {
37
+ STORAGE_BUCKET: RegistryStorage;
38
+ }
39
+ interface RegistryStorage {
40
+ list(options: {
41
+ prefix: string;
42
+ cursor?: string;
43
+ }): Promise<R2Objects>;
44
+ get(key: string): Promise<R2ObjectBody | null>;
45
+ }
46
+ export { ComponentSummary as a, RegistryStorage as c, ComponentPlatform as i, ComponentFile as n, Env as o, ComponentMeta as r, HttpHeaders as s, ComponentDetails as t };
47
+ //# sourceMappingURL=types-Cn4R4SGM.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Cn4R4SGM.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
package/dist/types.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e={WEB:`web`,MOBILE:`mobile`,ALL:`all`},t={Version:`x-cyclone-version`,Checksum:`x-cyclone-checksum`};exports.ComponentPlatform=e,exports.HttpHeaders=t;
@@ -0,0 +1,2 @@
1
+ import { a as ComponentSummary, c as RegistryStorage, i as ComponentPlatform, n as ComponentFile, o as Env, r as ComponentMeta, s as HttpHeaders, t as ComponentDetails } from "./types-Cn4R4SGM.cjs";
2
+ export { ComponentDetails, ComponentFile, ComponentMeta, ComponentPlatform, ComponentSummary, Env, HttpHeaders, RegistryStorage };
@@ -0,0 +1,2 @@
1
+ import { a as ComponentSummary, c as RegistryStorage, i as ComponentPlatform, n as ComponentFile, o as Env, r as ComponentMeta, s as HttpHeaders, t as ComponentDetails } from "./types-Cn4R4SGM.mjs";
2
+ export { ComponentDetails, ComponentFile, ComponentMeta, ComponentPlatform, ComponentSummary, Env, HttpHeaders, RegistryStorage };
package/dist/types.mjs ADDED
@@ -0,0 +1,2 @@
1
+ const e={WEB:`web`,MOBILE:`mobile`,ALL:`all`},t={Version:`x-cyclone-version`,Checksum:`x-cyclone-checksum`};export{e as ComponentPlatform,t as HttpHeaders};
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","names":["ComponentPlatform","HttpHeaders"],"sources":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,150 @@
1
1
  {
2
2
  "name": "@cyclone-ui/registry-api",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.3.34",
4
+ "description": "A repository containing the core front-end components used by Storm Software across many platforms",
5
+ "repository": {
6
+ "type": "github",
7
+ "url": "https://github.com/storm-software/cyclone-ui.git",
8
+ "directory": "packages/registry-api"
9
+ },
10
+ "private": false,
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "dependencies": {
15
+ "@trpc/client": "^11.19.0",
16
+ "@trpc/server": "^11.19.0",
17
+ "zod": "^3.25.76"
18
+ },
19
+ "devDependencies": {
20
+ "@cloudflare/workers-types": "^4.20260702.1",
21
+ "@powerlines/plugin-tsdown": "^0.1.618",
22
+ "powerlines": "^0.47.217"
23
+ },
24
+ "peerDependencies": {
25
+ "@cloudflare/workers-types": "^4.20260702.1"
26
+ },
27
+ "peerDependenciesMeta": {
28
+ "@cloudflare/workers-types": {
29
+ "optional": true
30
+ }
31
+ },
32
+ "main": "./dist/index.cjs",
33
+ "module": "./dist/index.mjs",
34
+ "types": "./dist/index.d.cts",
35
+ "exports": {
36
+ ".": {
37
+ "require": {
38
+ "types": "./dist/index.d.cts",
39
+ "default": "./dist/index.cjs"
40
+ },
41
+ "import": {
42
+ "types": "./dist/index.d.mts",
43
+ "default": "./dist/index.mjs"
44
+ },
45
+ "default": {
46
+ "types": "./dist/index.d.mts",
47
+ "default": "./dist/index.mjs"
48
+ }
49
+ },
50
+ "./client": {
51
+ "require": {
52
+ "types": "./dist/client.d.cts",
53
+ "default": "./dist/client.cjs"
54
+ },
55
+ "import": {
56
+ "types": "./dist/client.d.mts",
57
+ "default": "./dist/client.mjs"
58
+ },
59
+ "default": {
60
+ "types": "./dist/client.d.mts",
61
+ "default": "./dist/client.mjs"
62
+ }
63
+ },
64
+ "./context": {
65
+ "require": {
66
+ "types": "./dist/context.d.cts",
67
+ "default": "./dist/context.cjs"
68
+ },
69
+ "import": {
70
+ "types": "./dist/context.d.mts",
71
+ "default": "./dist/context.mjs"
72
+ },
73
+ "default": {
74
+ "types": "./dist/context.d.mts",
75
+ "default": "./dist/context.mjs"
76
+ }
77
+ },
78
+ "./errors": {
79
+ "require": {
80
+ "types": "./dist/errors.d.cts",
81
+ "default": "./dist/errors.cjs"
82
+ },
83
+ "import": {
84
+ "types": "./dist/errors.d.mts",
85
+ "default": "./dist/errors.mjs"
86
+ },
87
+ "default": {
88
+ "types": "./dist/errors.d.mts",
89
+ "default": "./dist/errors.mjs"
90
+ }
91
+ },
92
+ "./package.json": "./package.json",
93
+ "./router": {
94
+ "require": {
95
+ "types": "./dist/router.d.cts",
96
+ "default": "./dist/router.cjs"
97
+ },
98
+ "import": {
99
+ "types": "./dist/router.d.mts",
100
+ "default": "./dist/router.mjs"
101
+ },
102
+ "default": {
103
+ "types": "./dist/router.d.mts",
104
+ "default": "./dist/router.mjs"
105
+ }
106
+ },
107
+ "./routes/components": {
108
+ "require": {
109
+ "types": "./dist/routes/components.d.cts",
110
+ "default": "./dist/routes/components.cjs"
111
+ },
112
+ "import": {
113
+ "types": "./dist/routes/components.d.mts",
114
+ "default": "./dist/routes/components.mjs"
115
+ },
116
+ "default": {
117
+ "types": "./dist/routes/components.d.mts",
118
+ "default": "./dist/routes/components.mjs"
119
+ }
120
+ },
121
+ "./trpc": {
122
+ "require": {
123
+ "types": "./dist/trpc.d.cts",
124
+ "default": "./dist/trpc.cjs"
125
+ },
126
+ "import": {
127
+ "types": "./dist/trpc.d.mts",
128
+ "default": "./dist/trpc.mjs"
129
+ },
130
+ "default": {
131
+ "types": "./dist/trpc.d.mts",
132
+ "default": "./dist/trpc.mjs"
133
+ }
134
+ },
135
+ "./types": {
136
+ "require": {
137
+ "types": "./dist/types.d.cts",
138
+ "default": "./dist/types.cjs"
139
+ },
140
+ "import": {
141
+ "types": "./dist/types.d.mts",
142
+ "default": "./dist/types.mjs"
143
+ },
144
+ "default": {
145
+ "types": "./dist/types.d.mts",
146
+ "default": "./dist/types.mjs"
147
+ }
148
+ }
149
+ }
6
150
  }
@@ -0,0 +1,28 @@
1
+ /* -------------------------------------------------------------------
2
+
3
+ 🗲 Storm Software - Cyclone UI
4
+
5
+ This code was released as part of the Cyclone UI project. Cyclone UI
6
+ is maintained by Storm Software under the Apache-2.0 license, and is
7
+ free for commercial and private use. For more information, please visit
8
+ our licensing page at https://stormsoftware.com/licenses/projects/cyclone-ui.
9
+
10
+ Website: https://stormsoftware.com
11
+ Repository: https://github.com/storm-software/cyclone-ui
12
+ Documentation: https://docs.stormsoftware.com/projects/cyclone-ui
13
+ Contact: https://stormsoftware.com/contact
14
+
15
+ SPDX-License-Identifier: Apache-2.0
16
+
17
+ ------------------------------------------------------------------- */
18
+
19
+ import { plugin as tsdown } from "@powerlines/plugin-tsdown";
20
+ import type { UserConfig } from "powerlines";
21
+ import { defineConfig } from "powerlines/config";
22
+
23
+ const config: UserConfig = defineConfig({
24
+ input: ["src/**/*.ts"],
25
+ plugins: [tsdown()]
26
+ });
27
+
28
+ export default config;
package/project.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "registry-api",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "projectType": "library",
5
+ "sourceRoot": "packages/registry-api/src",
6
+ "// targets": "to see all targets run: nx show project registry-api --web",
7
+ "targets": {}
8
+ }
package/src/client.ts ADDED
@@ -0,0 +1,34 @@
1
+ /* -------------------------------------------------------------------
2
+
3
+ 🗲 Storm Software - Cyclone UI
4
+
5
+ This code was released as part of the Cyclone UI project. Cyclone UI
6
+ is maintained by Storm Software under the Apache-2.0 license, and is
7
+ free for commercial and private use. For more information, please visit
8
+ our licensing page at https://stormsoftware.com/licenses/projects/cyclone-ui.
9
+
10
+ Website: https://stormsoftware.com
11
+ Repository: https://github.com/storm-software/cyclone-ui
12
+ Documentation: https://docs.stormsoftware.com/projects/cyclone-ui
13
+ Contact: https://stormsoftware.com/contact
14
+
15
+ SPDX-License-Identifier: Apache-2.0
16
+
17
+ ------------------------------------------------------------------- */
18
+
19
+ import { createTRPCClient, httpBatchLink } from "@trpc/client";
20
+ import type { Router } from "./router";
21
+
22
+ export const DEFAULT_REGISTRY_URL = "https://registry.cyclone-ui.com/api";
23
+
24
+ export type RegistryClient = ReturnType<typeof createRegistryClient>;
25
+
26
+ export function createRegistryClient(url = DEFAULT_REGISTRY_URL) {
27
+ return createTRPCClient<Router>({
28
+ links: [
29
+ httpBatchLink({
30
+ url
31
+ })
32
+ ]
33
+ });
34
+ }
package/src/context.ts ADDED
@@ -0,0 +1,41 @@
1
+ /* -------------------------------------------------------------------
2
+
3
+ 🗲 Storm Software - Cyclone UI
4
+
5
+ This code was released as part of the Cyclone UI project. Cyclone UI
6
+ is maintained by Storm Software under the Apache-2.0 license, and is
7
+ free for commercial and private use. For more information, please visit
8
+ our licensing page at https://stormsoftware.com/licenses/projects/cyclone-ui.
9
+
10
+ Website: https://stormsoftware.com
11
+ Repository: https://github.com/storm-software/cyclone-ui
12
+ Documentation: https://docs.stormsoftware.com/projects/cyclone-ui
13
+ Contact: https://stormsoftware.com/contact
14
+
15
+ SPDX-License-Identifier: Apache-2.0
16
+
17
+ ------------------------------------------------------------------- */
18
+
19
+ import type { FetchCreateContextFnOptions } from "@trpc/server/adapters/fetch";
20
+ import type { Env } from "./types";
21
+ import { HttpHeaders } from "./types";
22
+
23
+ export type Context = FetchCreateContextFnOptions & {
24
+ version: string | undefined;
25
+ storage: Env["STORAGE_BUCKET"];
26
+ };
27
+
28
+ export type CreateContext = (
29
+ env: Env
30
+ ) => (options: FetchCreateContextFnOptions) => Context;
31
+
32
+ export const createContext: CreateContext =
33
+ (env: Env) => (options: FetchCreateContextFnOptions) => {
34
+ const version = options.req.headers.get(HttpHeaders.Version);
35
+
36
+ return {
37
+ ...options,
38
+ version: version ? String(version) : undefined,
39
+ storage: env.STORAGE_BUCKET
40
+ };
41
+ };
package/src/errors.ts ADDED
@@ -0,0 +1,25 @@
1
+ /* -------------------------------------------------------------------
2
+
3
+ 🗲 Storm Software - Cyclone UI
4
+
5
+ This code was released as part of the Cyclone UI project. Cyclone UI
6
+ is maintained by Storm Software under the Apache-2.0 license, and is
7
+ free for commercial and private use. For more information, please visit
8
+ our licensing page at https://stormsoftware.com/licenses/projects/cyclone-ui.
9
+
10
+ Website: https://stormsoftware.com
11
+ Repository: https://github.com/storm-software/cyclone-ui
12
+ Documentation: https://docs.stormsoftware.com/projects/cyclone-ui
13
+ Contact: https://stormsoftware.com/contact
14
+
15
+ SPDX-License-Identifier: Apache-2.0
16
+
17
+ ------------------------------------------------------------------- */
18
+
19
+ export const CycloneRegistryErrorCode = {
20
+ not_found: "not_found",
21
+ metadata_not_found: "metadata_not_found"
22
+ } as const;
23
+
24
+ export type CycloneRegistryErrorCode =
25
+ (typeof CycloneRegistryErrorCode)[keyof typeof CycloneRegistryErrorCode];
package/src/index.ts ADDED
@@ -0,0 +1,32 @@
1
+ /* -------------------------------------------------------------------
2
+
3
+ 🗲 Storm Software - Cyclone UI
4
+
5
+ This code was released as part of the Cyclone UI project. Cyclone UI
6
+ is maintained by Storm Software under the Apache-2.0 license, and is
7
+ free for commercial and private use. For more information, please visit
8
+ our licensing page at https://stormsoftware.com/licenses/projects/cyclone-ui.
9
+
10
+ Website: https://stormsoftware.com
11
+ Repository: https://github.com/storm-software/cyclone-ui
12
+ Documentation: https://docs.stormsoftware.com/projects/cyclone-ui
13
+ Contact: https://stormsoftware.com/contact
14
+
15
+ SPDX-License-Identifier: Apache-2.0
16
+
17
+ ------------------------------------------------------------------- */
18
+
19
+ /**
20
+ * The registry-api library used by Storm Software for building TypeScript applications.
21
+ *
22
+ * @remarks
23
+ * A package containing the shared TRPC router code used by the Cyclone Registry
24
+ *
25
+ * @packageDocumentation
26
+ */
27
+
28
+ export * from "./client";
29
+ export * from "./context";
30
+ export * from "./errors";
31
+ export * from "./router";
32
+ export * from "./types";
package/src/router.ts ADDED
@@ -0,0 +1,27 @@
1
+ /* -------------------------------------------------------------------
2
+
3
+ 🗲 Storm Software - Cyclone UI
4
+
5
+ This code was released as part of the Cyclone UI project. Cyclone UI
6
+ is maintained by Storm Software under the Apache-2.0 license, and is
7
+ free for commercial and private use. For more information, please visit
8
+ our licensing page at https://stormsoftware.com/licenses/projects/cyclone-ui.
9
+
10
+ Website: https://stormsoftware.com
11
+ Repository: https://github.com/storm-software/cyclone-ui
12
+ Documentation: https://docs.stormsoftware.com/projects/cyclone-ui
13
+ Contact: https://stormsoftware.com/contact
14
+
15
+ SPDX-License-Identifier: Apache-2.0
16
+
17
+ ------------------------------------------------------------------- */
18
+
19
+ import { componentsRouter } from "./routes/components";
20
+ import { createRouter } from "./trpc";
21
+
22
+ export const router = createRouter({
23
+ components: componentsRouter
24
+ });
25
+
26
+ // export type definition of API
27
+ export type Router = typeof router;