@remixhq/core 0.1.5 → 0.1.6
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/api.d.ts +1 -0
- package/dist/chunk-ZAQZKEH4.js +46 -0
- package/dist/collab.d.ts +1 -0
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RemixError
|
|
3
|
+
} from "./chunk-YZ34ICNN.js";
|
|
4
|
+
|
|
5
|
+
// src/config/model.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var DEFAULT_API_URL = "http://192.168.8.242:8080";
|
|
8
|
+
var DEFAULT_SUPABASE_URL = "https://xtfxwbckjpfmqubnsusu.supabase.co";
|
|
9
|
+
var DEFAULT_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inh0Znh3YmNranBmbXF1Ym5zdXN1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjA2MDEyMzAsImV4cCI6MjA3NjE3NzIzMH0.dzWGAWrK4CvrmHVHzf8w7JlUZohdap0ZPnLZnABMV8s";
|
|
10
|
+
function isValidUrl(value) {
|
|
11
|
+
try {
|
|
12
|
+
new URL(value);
|
|
13
|
+
return true;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
var urlSchema = z.string().min(1).transform((s) => s.trim()).refine((s) => isValidUrl(s), "Invalid URL.").transform((s) => s.replace(/\/+$/, ""));
|
|
19
|
+
var configSchema = z.object({
|
|
20
|
+
apiUrl: urlSchema,
|
|
21
|
+
supabaseUrl: urlSchema,
|
|
22
|
+
supabaseAnonKey: z.string().min(1)
|
|
23
|
+
});
|
|
24
|
+
var cachedConfig = null;
|
|
25
|
+
async function resolveConfig(_opts) {
|
|
26
|
+
if (cachedConfig) return cachedConfig;
|
|
27
|
+
const cfgRaw = {
|
|
28
|
+
apiUrl: DEFAULT_API_URL,
|
|
29
|
+
supabaseUrl: DEFAULT_SUPABASE_URL,
|
|
30
|
+
supabaseAnonKey: DEFAULT_SUPABASE_ANON_KEY
|
|
31
|
+
};
|
|
32
|
+
const parsedCfg = configSchema.safeParse(cfgRaw);
|
|
33
|
+
if (!parsedCfg.success) {
|
|
34
|
+
throw new RemixError("Invalid core configuration.", {
|
|
35
|
+
exitCode: 1,
|
|
36
|
+
hint: parsedCfg.error.issues.map((i) => `${i.path.join(".") || "config"}: ${i.message}`).join("; ")
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
cachedConfig = parsedCfg.data;
|
|
40
|
+
return parsedCfg.data;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
configSchema,
|
|
45
|
+
resolveConfig
|
|
46
|
+
};
|
package/dist/collab.d.ts
CHANGED