camox 0.2.0-alpha.5 → 0.3.0
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/features/metadata/sitemap.d.ts +6 -0
- package/dist/features/metadata/sitemap.d.ts.map +1 -0
- package/dist/features/preview/components/AssetLightbox.d.ts.map +1 -1
- package/dist/features/preview/components/AssetLightbox.js +8 -2
- package/dist/features/vite/definitionsSync.d.ts.map +1 -1
- package/dist/features/vite/definitionsSync.js +7 -2
- package/dist/features/vite/vite.d.ts.map +1 -1
- package/dist/features/vite/vite.js +3 -1
- package/dist/hooks/use-file-upload.d.ts.map +1 -1
- package/dist/hooks/use-file-upload.js +5 -2
- package/dist/lib/api-client-server.d.ts +1 -1
- package/dist/lib/api-client-server.d.ts.map +1 -1
- package/dist/lib/api-client-server.js +1 -2
- package/dist/lib/api-client.d.ts +44 -13
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +14 -5
- package/dist/lib/auth.d.ts +5 -0
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +9 -1
- package/dist/lib/queries.d.ts +4 -2
- package/dist/lib/queries.d.ts.map +1 -1
- package/dist/lib/use-project-room.d.ts.map +1 -1
- package/dist/lib/use-project-room.js +3 -1
- package/package.json +9 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../../src/features/metadata/sitemap.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAe7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetLightbox.d.ts","sourceRoot":"","sources":["../../../../src/features/preview/components/AssetLightbox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AssetLightbox.d.ts","sourceRoot":"","sources":["../../../../src/features/preview/components/AssetLightbox.tsx"],"names":[],"mappings":"AAuDA,UAAU,kBAAkB;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,aAAa,GAAI,gCAAgC,kBAAkB,mDAsUxE,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAuthCookieHeader } from "../../../lib/auth.js";
|
|
2
|
+
import { getApiUrl, getEnvironmentName } from "../../../lib/api-client.js";
|
|
2
3
|
import { fileMutations, fileQueries } from "../../../lib/queries.js";
|
|
3
4
|
import { DebouncedFieldEditor } from "./DebouncedFieldEditor.js";
|
|
4
5
|
import { UploadDropZone } from "../../content/components/UploadDropZone.js";
|
|
@@ -97,10 +98,15 @@ var AssetLightbox = ({ open, onOpenChange, fileId }) => {
|
|
|
97
98
|
const formData = new FormData();
|
|
98
99
|
formData.append("file", droppedFile);
|
|
99
100
|
formData.append("projectId", String(file?.projectId ?? 0));
|
|
101
|
+
const envName = getEnvironmentName();
|
|
100
102
|
const uploadRes = await fetch(`${getApiUrl()}/files/upload`, {
|
|
101
103
|
method: "POST",
|
|
102
104
|
body: formData,
|
|
103
|
-
credentials: "
|
|
105
|
+
credentials: "omit",
|
|
106
|
+
headers: {
|
|
107
|
+
"Better-Auth-Cookie": getAuthCookieHeader(),
|
|
108
|
+
...envName ? { "x-environment-name": envName } : {}
|
|
109
|
+
}
|
|
104
110
|
});
|
|
105
111
|
if (!uploadRes.ok) throw new Error(`Upload failed: ${uploadRes.status}`);
|
|
106
112
|
setUploadState((prev) => prev ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitionsSync.d.ts","sourceRoot":"","sources":["../../../src/features/vite/definitionsSync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOjD,MAAM,WAAW,sBAAsB;IACrC,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAgBD,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"definitionsSync.d.ts","sourceRoot":"","sources":["../../../src/features/vite/definitionsSync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOjD,MAAM,WAAW,sBAAsB;IACrC,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAgBD,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFhB;AAOD,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAoMf"}
|
|
@@ -11,7 +11,7 @@ function throwIfSyncAuthError(error) {
|
|
|
11
11
|
}
|
|
12
12
|
async function syncDefinitionsToApi(options) {
|
|
13
13
|
const { camoxApp, projectSlug, apiUrl, syncSecret, environmentName, logger } = options;
|
|
14
|
-
const client = createServerApiClient(apiUrl,
|
|
14
|
+
const client = createServerApiClient(apiUrl, environmentName);
|
|
15
15
|
const definitions = camoxApp.getBlocks().map((block) => ({
|
|
16
16
|
blockId: block.id,
|
|
17
17
|
title: block.title,
|
|
@@ -26,6 +26,7 @@ async function syncDefinitionsToApi(options) {
|
|
|
26
26
|
try {
|
|
27
27
|
environmentCreated = (await client.blockDefinitions.sync({
|
|
28
28
|
projectSlug,
|
|
29
|
+
syncSecret,
|
|
29
30
|
definitions
|
|
30
31
|
})).environmentCreated;
|
|
31
32
|
} catch (error) {
|
|
@@ -39,6 +40,7 @@ async function syncDefinitionsToApi(options) {
|
|
|
39
40
|
try {
|
|
40
41
|
await client.layouts.sync({
|
|
41
42
|
projectSlug,
|
|
43
|
+
syncSecret,
|
|
42
44
|
layouts: layoutDefinitions
|
|
43
45
|
});
|
|
44
46
|
} catch (error) {
|
|
@@ -51,6 +53,7 @@ async function syncDefinitionsToApi(options) {
|
|
|
51
53
|
if (initialPage) try {
|
|
52
54
|
const result = await client.projects.initializeContent({
|
|
53
55
|
projectSlug,
|
|
56
|
+
syncSecret,
|
|
54
57
|
layoutId: initialPage.layoutId,
|
|
55
58
|
blocks: initialPage.blocks
|
|
56
59
|
});
|
|
@@ -82,7 +85,7 @@ async function syncDefinitions(server, options = {}) {
|
|
|
82
85
|
}
|
|
83
86
|
const syncSecret = options.syncSecret;
|
|
84
87
|
const environmentName = options.environmentName;
|
|
85
|
-
const client = createServerApiClient(apiUrl,
|
|
88
|
+
const client = createServerApiClient(apiUrl, environmentName);
|
|
86
89
|
async function performInitialSync() {
|
|
87
90
|
const camoxModule = await server.ssrLoadModule(camoxAppPath);
|
|
88
91
|
if (!camoxModule.camoxApp) {
|
|
@@ -112,6 +115,7 @@ async function syncDefinitions(server, options = {}) {
|
|
|
112
115
|
try {
|
|
113
116
|
result = await client.blockDefinitions.upsert({
|
|
114
117
|
projectSlug,
|
|
118
|
+
syncSecret,
|
|
115
119
|
blockId: block.id,
|
|
116
120
|
title: block.title,
|
|
117
121
|
description: block.description,
|
|
@@ -133,6 +137,7 @@ async function syncDefinitions(server, options = {}) {
|
|
|
133
137
|
try {
|
|
134
138
|
result = await client.blockDefinitions.delete({
|
|
135
139
|
projectSlug,
|
|
140
|
+
syncSecret,
|
|
136
141
|
blockId
|
|
137
142
|
});
|
|
138
143
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../src/features/vite/vite.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAC;AAUlE,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,mBAAmB,CAAC;AA6B3B,MAAM,WAAW,kBAAkB;IACjC,0FAA0F;IAC1F,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4FAA4F;IAC5F,SAAS,CAAC,EAAE;QACV,2DAA2D;QAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,0EAA0E;QAC1E,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,oDAAoD;QACpD,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAClC,CAAC;CACH;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../src/features/vite/vite.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAC;AAUlE,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,mBAAmB,CAAC;AA6B3B,MAAM,WAAW,kBAAkB;IACjC,0FAA0F;IAC1F,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4FAA4F;IAC5F,SAAS,CAAC,EAAE;QACV,2DAA2D;QAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,0EAA0E;QAC1E,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,oDAAoD;QACpD,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAClC,CAAC;CACH;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAuHzD"}
|
|
@@ -57,7 +57,9 @@ function camox(options) {
|
|
|
57
57
|
return { define: {
|
|
58
58
|
__CAMOX_ANALYTICS_DISABLED__: JSON.stringify(!!options.disableAnalytics),
|
|
59
59
|
__ENABLE_TANSTACK_DEVTOOLS__: JSON.stringify(enableTanstackDevtools),
|
|
60
|
-
__CAMOX_ENVIRONMENT_NAME__: JSON.stringify(environmentName)
|
|
60
|
+
__CAMOX_ENVIRONMENT_NAME__: JSON.stringify(environmentName),
|
|
61
|
+
__CAMOX_API_URL__: JSON.stringify(apiUrl),
|
|
62
|
+
__CAMOX_PROJECT_SLUG__: JSON.stringify(options.projectSlug)
|
|
61
63
|
} };
|
|
62
64
|
},
|
|
63
65
|
configResolved(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-file-upload.d.ts","sourceRoot":"","sources":["../../src/hooks/use-file-upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-file-upload.d.ts","sourceRoot":"","sources":["../../src/hooks/use-file-upload.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QACzB,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ;AAED,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB;;yBA6EhD,QAAQ;;EAgCnB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { getAuthCookieHeader } from "../lib/auth.js";
|
|
3
|
+
import { getApiUrl, getEnvironmentName } from "../lib/api-client.js";
|
|
3
4
|
import { trackClientEvent } from "../lib/analytics-client.js";
|
|
4
5
|
import { useCallback, useRef, useState } from "react";
|
|
5
6
|
//#region src/hooks/use-file-upload.ts
|
|
@@ -38,7 +39,9 @@ function useFileUpload(options) {
|
|
|
38
39
|
formData.append("projectId", String(projectIdRef.current ?? 0));
|
|
39
40
|
const uploadUrl = `${apiUrl}/files/upload`;
|
|
40
41
|
xhr.open("POST", uploadUrl);
|
|
41
|
-
xhr.
|
|
42
|
+
xhr.setRequestHeader("Better-Auth-Cookie", getAuthCookieHeader());
|
|
43
|
+
const envName = getEnvironmentName();
|
|
44
|
+
if (envName) xhr.setRequestHeader("x-environment-name", envName);
|
|
42
45
|
xhr.send(formData);
|
|
43
46
|
});
|
|
44
47
|
onFileCommittedRef.current?.({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from '@camox/api';
|
|
2
2
|
import { RouterClient } from '@orpc/server';
|
|
3
3
|
export type ServerApiClient = RouterClient<Router>;
|
|
4
|
-
export declare function createServerApiClient(apiUrl: string,
|
|
4
|
+
export declare function createServerApiClient(apiUrl: string, environmentName?: string): ServerApiClient;
|
|
5
5
|
//# sourceMappingURL=api-client-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client-server.d.ts","sourceRoot":"","sources":["../../src/lib/api-client-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAEnD,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"api-client-server.d.ts","sourceRoot":"","sources":["../../src/lib/api-client-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAEnD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,eAAe,CAK/F"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createORPCClient } from "@orpc/client";
|
|
2
2
|
import { RPCLink } from "@orpc/client/fetch";
|
|
3
3
|
//#region src/lib/api-client-server.ts
|
|
4
|
-
function createServerApiClient(apiUrl,
|
|
4
|
+
function createServerApiClient(apiUrl, environmentName) {
|
|
5
5
|
const headers = {};
|
|
6
|
-
if (syncSecret) headers["x-sync-secret"] = syncSecret;
|
|
7
6
|
if (environmentName) headers["x-environment-name"] = environmentName;
|
|
8
7
|
return createORPCClient(new RPCLink({
|
|
9
8
|
url: `${apiUrl}/rpc`,
|
package/dist/lib/api-client.d.ts
CHANGED
|
@@ -6,39 +6,40 @@ export declare function getApiClient(): ApiClient;
|
|
|
6
6
|
export declare function getOrpc(): {
|
|
7
7
|
projects: {
|
|
8
8
|
list: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
9
|
-
|
|
9
|
+
organizationId: string;
|
|
10
10
|
}, {
|
|
11
11
|
id: number;
|
|
12
12
|
slug: string;
|
|
13
13
|
name: string;
|
|
14
14
|
syncSecret: string;
|
|
15
|
-
|
|
15
|
+
organizationId: string;
|
|
16
16
|
createdAt: number;
|
|
17
17
|
updatedAt: number;
|
|
18
18
|
}[], Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
19
|
-
|
|
19
|
+
organizationId: string;
|
|
20
20
|
}>;
|
|
21
21
|
getFirst: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
22
|
-
|
|
22
|
+
organizationId: string;
|
|
23
23
|
}, {
|
|
24
24
|
id: number;
|
|
25
25
|
slug: string;
|
|
26
26
|
name: string;
|
|
27
27
|
syncSecret: string;
|
|
28
|
-
|
|
28
|
+
organizationId: string;
|
|
29
29
|
createdAt: number;
|
|
30
30
|
updatedAt: number;
|
|
31
31
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
32
|
-
|
|
32
|
+
organizationId: string;
|
|
33
33
|
}>;
|
|
34
34
|
getBySlug: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
35
35
|
slug: string;
|
|
36
36
|
}, {
|
|
37
|
+
organizationSlug: string | null;
|
|
37
38
|
id: number;
|
|
38
39
|
slug: string;
|
|
39
40
|
name: string;
|
|
40
41
|
syncSecret: string;
|
|
41
|
-
|
|
42
|
+
organizationId: string;
|
|
42
43
|
createdAt: number;
|
|
43
44
|
updatedAt: number;
|
|
44
45
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
@@ -47,11 +48,12 @@ export declare function getOrpc(): {
|
|
|
47
48
|
get: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
48
49
|
id: number;
|
|
49
50
|
}, {
|
|
51
|
+
organizationSlug: string | null;
|
|
50
52
|
id: number;
|
|
51
53
|
slug: string;
|
|
52
54
|
name: string;
|
|
53
55
|
syncSecret: string;
|
|
54
|
-
|
|
56
|
+
organizationId: string;
|
|
55
57
|
createdAt: number;
|
|
56
58
|
updatedAt: number;
|
|
57
59
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
@@ -59,18 +61,18 @@ export declare function getOrpc(): {
|
|
|
59
61
|
}>;
|
|
60
62
|
create: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
61
63
|
name: string;
|
|
62
|
-
|
|
64
|
+
organizationId: string;
|
|
63
65
|
}, {
|
|
64
66
|
name: string;
|
|
65
67
|
id: number;
|
|
66
68
|
slug: string;
|
|
67
69
|
syncSecret: string;
|
|
68
|
-
organizationSlug: string;
|
|
69
70
|
createdAt: number;
|
|
71
|
+
organizationId: string;
|
|
70
72
|
updatedAt: number;
|
|
71
73
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
72
74
|
name: string;
|
|
73
|
-
|
|
75
|
+
organizationId: string;
|
|
74
76
|
}>;
|
|
75
77
|
update: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
76
78
|
name: string;
|
|
@@ -80,8 +82,8 @@ export declare function getOrpc(): {
|
|
|
80
82
|
id: number;
|
|
81
83
|
slug: string;
|
|
82
84
|
syncSecret: string;
|
|
83
|
-
organizationSlug: string;
|
|
84
85
|
createdAt: number;
|
|
86
|
+
organizationId: string;
|
|
85
87
|
updatedAt: number;
|
|
86
88
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
87
89
|
name: string;
|
|
@@ -94,14 +96,15 @@ export declare function getOrpc(): {
|
|
|
94
96
|
id: number;
|
|
95
97
|
slug: string;
|
|
96
98
|
syncSecret: string;
|
|
97
|
-
organizationSlug: string;
|
|
98
99
|
createdAt: number;
|
|
100
|
+
organizationId: string;
|
|
99
101
|
updatedAt: number;
|
|
100
102
|
} | undefined, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
101
103
|
id: number;
|
|
102
104
|
}>;
|
|
103
105
|
initializeContent: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
104
106
|
projectSlug: string;
|
|
107
|
+
syncSecret: string;
|
|
105
108
|
layoutId: string;
|
|
106
109
|
blocks: {
|
|
107
110
|
type: string;
|
|
@@ -125,6 +128,7 @@ export declare function getOrpc(): {
|
|
|
125
128
|
blockCount: number;
|
|
126
129
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
127
130
|
projectSlug: string;
|
|
131
|
+
syncSecret: string;
|
|
128
132
|
layoutId: string;
|
|
129
133
|
blocks: {
|
|
130
134
|
type: string;
|
|
@@ -246,6 +250,24 @@ export declare function getOrpc(): {
|
|
|
246
250
|
}[], Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
247
251
|
projectId: number;
|
|
248
252
|
}>;
|
|
253
|
+
listBySlug: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
254
|
+
projectSlug: string;
|
|
255
|
+
}, {
|
|
256
|
+
id: number;
|
|
257
|
+
projectId: number;
|
|
258
|
+
environmentId: number;
|
|
259
|
+
pathSegment: string;
|
|
260
|
+
fullPath: string;
|
|
261
|
+
parentPageId: number | null;
|
|
262
|
+
layoutId: number;
|
|
263
|
+
metaTitle: string | null;
|
|
264
|
+
metaDescription: string | null;
|
|
265
|
+
aiSeoEnabled: boolean | null;
|
|
266
|
+
createdAt: number;
|
|
267
|
+
updatedAt: number;
|
|
268
|
+
}[], Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
269
|
+
projectSlug: string;
|
|
270
|
+
}>;
|
|
249
271
|
get: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
250
272
|
id: number;
|
|
251
273
|
}, {
|
|
@@ -678,6 +700,7 @@ export declare function getOrpc(): {
|
|
|
678
700
|
}>;
|
|
679
701
|
sync: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
680
702
|
projectSlug: string;
|
|
703
|
+
syncSecret: string;
|
|
681
704
|
layouts: {
|
|
682
705
|
layoutId: string;
|
|
683
706
|
description: string;
|
|
@@ -705,6 +728,7 @@ export declare function getOrpc(): {
|
|
|
705
728
|
description: string | null;
|
|
706
729
|
}[], Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
707
730
|
projectSlug: string;
|
|
731
|
+
syncSecret: string;
|
|
708
732
|
layouts: {
|
|
709
733
|
layoutId: string;
|
|
710
734
|
description: string;
|
|
@@ -1060,6 +1084,7 @@ export declare function getOrpc(): {
|
|
|
1060
1084
|
}>;
|
|
1061
1085
|
sync: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
1062
1086
|
projectSlug: string;
|
|
1087
|
+
syncSecret: string;
|
|
1063
1088
|
definitions: {
|
|
1064
1089
|
blockId: string;
|
|
1065
1090
|
title: string;
|
|
@@ -1089,6 +1114,7 @@ export declare function getOrpc(): {
|
|
|
1089
1114
|
environmentCreated: boolean;
|
|
1090
1115
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
1091
1116
|
projectSlug: string;
|
|
1117
|
+
syncSecret: string;
|
|
1092
1118
|
definitions: {
|
|
1093
1119
|
blockId: string;
|
|
1094
1120
|
title: string;
|
|
@@ -1102,6 +1128,7 @@ export declare function getOrpc(): {
|
|
|
1102
1128
|
}>;
|
|
1103
1129
|
upsert: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
1104
1130
|
projectSlug: string;
|
|
1131
|
+
syncSecret: string;
|
|
1105
1132
|
blockId: string;
|
|
1106
1133
|
title: string;
|
|
1107
1134
|
description: string;
|
|
@@ -1142,6 +1169,7 @@ export declare function getOrpc(): {
|
|
|
1142
1169
|
layoutOnly: boolean | null;
|
|
1143
1170
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
1144
1171
|
projectSlug: string;
|
|
1172
|
+
syncSecret: string;
|
|
1145
1173
|
blockId: string;
|
|
1146
1174
|
title: string;
|
|
1147
1175
|
description: string;
|
|
@@ -1153,15 +1181,18 @@ export declare function getOrpc(): {
|
|
|
1153
1181
|
}>;
|
|
1154
1182
|
delete: import('@orpc/tanstack-query').ProcedureUtils<Record<never, never>, {
|
|
1155
1183
|
projectSlug: string;
|
|
1184
|
+
syncSecret: string;
|
|
1156
1185
|
blockId: string;
|
|
1157
1186
|
}, {
|
|
1158
1187
|
deleted: boolean;
|
|
1159
1188
|
blockId: string;
|
|
1160
1189
|
}, Error> & import('@orpc/tanstack-query').GeneralUtils<{
|
|
1161
1190
|
projectSlug: string;
|
|
1191
|
+
syncSecret: string;
|
|
1162
1192
|
blockId: string;
|
|
1163
1193
|
}>;
|
|
1164
1194
|
} & import('@orpc/tanstack-query').GeneralUtils<unknown>;
|
|
1165
1195
|
} & import('@orpc/tanstack-query').GeneralUtils<unknown>;
|
|
1166
1196
|
export declare function getApiUrl(): string;
|
|
1197
|
+
export declare function getEnvironmentName(): string | null;
|
|
1167
1198
|
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceR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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAGtB;AAED,wBAAgB,SAAS,IAAI,MAAM,CAGlC;AAED,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAElD"}
|
package/dist/lib/api-client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAuthCookieHeader } from "./auth.js";
|
|
1
2
|
import { createORPCClient } from "@orpc/client";
|
|
2
3
|
import { RPCLink } from "@orpc/client/fetch";
|
|
3
4
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
@@ -5,17 +6,22 @@ import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
|
5
6
|
var _client = null;
|
|
6
7
|
var _orpc = null;
|
|
7
8
|
var _apiUrl = null;
|
|
9
|
+
var _environmentName = null;
|
|
8
10
|
function initApiClient(apiUrl, environmentName) {
|
|
9
11
|
_apiUrl = apiUrl;
|
|
12
|
+
_environmentName = environmentName ?? null;
|
|
10
13
|
const headers = {};
|
|
11
14
|
if (environmentName) headers["x-environment-name"] = environmentName;
|
|
12
15
|
_client = createORPCClient(new RPCLink({
|
|
13
16
|
url: `${apiUrl}/rpc`,
|
|
14
17
|
headers,
|
|
15
|
-
fetch: (request, init) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
fetch: (request, init) => {
|
|
19
|
+
if (request instanceof Request) request.headers.set("Better-Auth-Cookie", getAuthCookieHeader());
|
|
20
|
+
return fetch(request, {
|
|
21
|
+
...init,
|
|
22
|
+
credentials: "omit"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
19
25
|
}));
|
|
20
26
|
_orpc = createTanstackQueryUtils(_client);
|
|
21
27
|
return _client;
|
|
@@ -32,5 +38,8 @@ function getApiUrl() {
|
|
|
32
38
|
if (!_apiUrl) throw new Error("API client not initialized — call initApiClient first");
|
|
33
39
|
return _apiUrl;
|
|
34
40
|
}
|
|
41
|
+
function getEnvironmentName() {
|
|
42
|
+
return _environmentName;
|
|
43
|
+
}
|
|
35
44
|
//#endregion
|
|
36
|
-
export { getApiClient, getApiUrl, getOrpc, initApiClient };
|
|
45
|
+
export { getApiClient, getApiUrl, getEnvironmentName, getOrpc, initApiClient };
|
package/dist/lib/auth.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ClientStore } from 'better-auth';
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Read the cross-domain auth cookie from localStorage and return it as a
|
|
5
|
+
* string suitable for the `Better-Auth-Cookie` request header.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getAuthCookieHeader(): string;
|
|
3
8
|
export type CamoxAuthClient = ReturnType<typeof createCamoxAuthClient>;
|
|
4
9
|
export declare function createCamoxAuthClient(apiUrl: string): {
|
|
5
10
|
useActiveOrganization: () => {
|
package/dist/lib/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiG/B;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAG5C;AAiHD,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEvE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;yBAyEhD,CAAC;;;;;;;;;;;;;;;;;6BA/RuB,CAAC;iBAEnB,CAAA;;;;;;;;;;;;;;;6BAFkB,CAAC;iBAEnB,CAAA;;;;;;;;;;;;;;6BAFkB,CAAC;iBAEnB,CAAA;;;;;;;;;;6BAFkB,CAAC;iBAEnB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA6RN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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D;gBAEQ,CAAC;sBACJ,CAAD;cAEG,CAAC;cACmB,CAAC;eACnB,CAAJ;mBAGmB,CAAC;yBAClB,CAAD;;eAC8B,CAAC;;;aAEtB,CAAC;YACP,CAAF;;;;;;;;;;;;YAmBoB,CAAA;aAAgB,CAAC;cAAiB,CAAC;cAAiB,CAAC;;aAErB,CAAC;oBACG,CAAC;cACnD,CAAN;mBAEmC,CAAC;yBACe,CAAC;qBACxB,CAAC;;;uBAEN,CAAA;+GAIkD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDjF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,eAAe,WAkCxD;AAMD,UAAU,gBAAgB;IACxB,UAAU,EAAE,eAAe,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,WAAW,wCAAqD,CAAC;AAE9E,wBAAgB,cAAc,qBAI7B;AAMD,wBAAgB,cAAc,WAE7B;AAED,wBAAgB,YAAY;;;EAO3B;AAED,wBAAgB,kBAAkB,YAGjC;AAED,wBAAgB,iBAAiB,eAShC;AAED;;GAEG;AACH,wBAAgB,cAAc,SAiC7B"}
|
package/dist/lib/auth.js
CHANGED
|
@@ -49,6 +49,14 @@ function getCookie(cookie) {
|
|
|
49
49
|
return `${acc}; ${key}=${value.value}`;
|
|
50
50
|
}, "");
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Read the cross-domain auth cookie from localStorage and return it as a
|
|
54
|
+
* string suitable for the `Better-Auth-Cookie` request header.
|
|
55
|
+
*/
|
|
56
|
+
function getAuthCookieHeader() {
|
|
57
|
+
if (typeof window === "undefined") return "";
|
|
58
|
+
return getCookie(localStorage.getItem("better-auth_cookie") || "{}");
|
|
59
|
+
}
|
|
52
60
|
function crossDomainClient(opts = {}) {
|
|
53
61
|
let store = null;
|
|
54
62
|
const cookieName = `${opts?.storagePrefix || "better-auth"}_cookie`;
|
|
@@ -238,4 +246,4 @@ function useAuthActions() {
|
|
|
238
246
|
}, [authClient, authenticationUrl]);
|
|
239
247
|
}
|
|
240
248
|
//#endregion
|
|
241
|
-
export { AuthContext, createCamoxAuthClient, useAuthActions, useAuthContext, useAuthState, useIsAuthenticated, useProcessOtt, useProjectSlug, useSignInRedirect };
|
|
249
|
+
export { AuthContext, createCamoxAuthClient, getAuthCookieHeader, useAuthActions, useAuthContext, useAuthState, useIsAuthenticated, useProcessOtt, useProjectSlug, useSignInRedirect };
|
package/dist/lib/queries.d.ts
CHANGED
|
@@ -206,11 +206,12 @@ export declare const projectQueries: {
|
|
|
206
206
|
enabled?: boolean | undefined;
|
|
207
207
|
queryKey: readonly unknown[] & {
|
|
208
208
|
[dataTagSymbol]: {
|
|
209
|
+
organizationSlug: string | null;
|
|
209
210
|
id: number;
|
|
210
211
|
slug: string;
|
|
211
212
|
name: string;
|
|
212
213
|
syncSecret: string;
|
|
213
|
-
|
|
214
|
+
organizationId: string;
|
|
214
215
|
createdAt: number;
|
|
215
216
|
updatedAt: number;
|
|
216
217
|
};
|
|
@@ -219,11 +220,12 @@ export declare const projectQueries: {
|
|
|
219
220
|
throwOnError?: ((error: Error) => boolean) | undefined;
|
|
220
221
|
retryDelay?: ((count: number, error: Error) => number) | undefined;
|
|
221
222
|
queryFn: import('@tanstack/react-query').QueryFunction<{
|
|
223
|
+
organizationSlug: string | null;
|
|
222
224
|
id: number;
|
|
223
225
|
slug: string;
|
|
224
226
|
name: string;
|
|
225
227
|
syncSecret: string;
|
|
226
|
-
|
|
228
|
+
organizationId: string;
|
|
227
229
|
createdAt: number;
|
|
228
230
|
updatedAt: number;
|
|
229
231
|
}>;
|
|
@@ -1 +1 @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;;;;;;;;;;;;;;;;;;;CAOjB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ1B,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMnC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-room.d.ts","sourceRoot":"","sources":["../../src/lib/use-project-room.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-project-room.d.ts","sourceRoot":"","sources":["../../src/lib/use-project-room.ts"],"names":[],"mappings":"AASA,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,QAmC3E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAuthCookieHeader } from "./auth.js";
|
|
1
2
|
import { useQueryClient } from "@tanstack/react-query";
|
|
2
3
|
import { useRef } from "react";
|
|
3
4
|
import { usePartySocket } from "partysocket/react";
|
|
@@ -11,7 +12,8 @@ function useProjectRoom(apiUrl, projectId) {
|
|
|
11
12
|
host: apiUrl.replace(/^https?:\/\//, ""),
|
|
12
13
|
party: "project-room",
|
|
13
14
|
room: String(projectId ?? ""),
|
|
14
|
-
prefix: "
|
|
15
|
+
prefix: "parties",
|
|
16
|
+
query: () => ({ _authCookie: getAuthCookieHeader() }),
|
|
15
17
|
enabled: !!projectId,
|
|
16
18
|
onMessage(event) {
|
|
17
19
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"camox": "./bin/camox.mjs"
|
|
6
6
|
},
|
|
@@ -51,6 +51,11 @@
|
|
|
51
51
|
"types": "./dist/features/vite/vite.d.ts",
|
|
52
52
|
"import": "./dist/features/vite/vite.js"
|
|
53
53
|
},
|
|
54
|
+
"./metadata": {
|
|
55
|
+
"source": "./src/features/metadata/sitemap.ts",
|
|
56
|
+
"types": "./dist/features/metadata/sitemap.d.ts",
|
|
57
|
+
"import": "./dist/features/metadata/sitemap.js"
|
|
58
|
+
},
|
|
54
59
|
"./_internal/pageRoute": {
|
|
55
60
|
"source": "./src/features/routes/pageRoute.tsx",
|
|
56
61
|
"types": "./dist/features/routes/pageRoute.d.ts",
|
|
@@ -92,9 +97,9 @@
|
|
|
92
97
|
"react-dom": "19.3.0-canary-8b2e903a-20260320",
|
|
93
98
|
"react-og-preview": "^0.2.0",
|
|
94
99
|
"shiki": "^4.0.1",
|
|
95
|
-
"@camox/api": "0.
|
|
96
|
-
"@camox/
|
|
97
|
-
"@camox/
|
|
100
|
+
"@camox/api": "0.3.0",
|
|
101
|
+
"@camox/cli": "0.3.0",
|
|
102
|
+
"@camox/ui": "0.3.0"
|
|
98
103
|
},
|
|
99
104
|
"devDependencies": {
|
|
100
105
|
"@orpc/server": "^1.13.13",
|