appflare 0.0.20 → 0.0.22
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.
|
@@ -39,9 +39,11 @@ export function generateWranglerJson(params: {
|
|
|
39
39
|
|
|
40
40
|
const wrangler: Record<string, unknown> = {
|
|
41
41
|
$schema: "node_modules/wrangler/config-schema.json",
|
|
42
|
-
name:
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
name:
|
|
43
|
+
params.config.wrangler?.name ?? sanitizeWorkerName(params.configDirAbs),
|
|
44
|
+
main: params.config.wrangler?.main ?? workerMain,
|
|
45
|
+
compatibility_date:
|
|
46
|
+
params.config.wrangler?.compatibilityDate ?? compatibilityDate,
|
|
45
47
|
compatibility_flags: [
|
|
46
48
|
"nodejs_compat",
|
|
47
49
|
"nodejs_compat_populate_process_env",
|
|
@@ -64,6 +66,7 @@ export function generateWranglerJson(params: {
|
|
|
64
66
|
vars: {
|
|
65
67
|
ALLOWED_ORIGINS: allowedOrigins.join(","),
|
|
66
68
|
},
|
|
69
|
+
...params.config.wrangler,
|
|
67
70
|
};
|
|
68
71
|
|
|
69
72
|
if (r2Buckets && r2Buckets.length > 0) {
|
package/cli/utils/utils.ts
CHANGED
|
@@ -39,6 +39,13 @@ export type AppflareConfig<
|
|
|
39
39
|
wranglerCompatibilityDate?: string;
|
|
40
40
|
/** Optional CORS whitelist for generated Worker entrypoint. */
|
|
41
41
|
corsOrigin?: string | string[];
|
|
42
|
+
/** Optional wrangler.json overrides. */
|
|
43
|
+
wrangler?: {
|
|
44
|
+
name?: string;
|
|
45
|
+
main?: string;
|
|
46
|
+
compatibilityDate?: string;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
};
|
|
42
49
|
auth?: AppflareAuthConfig<Options>;
|
|
43
50
|
storage?: AppflareStorageConfig;
|
|
44
51
|
scheduler?: AppflareSchedulerConfig;
|
|
@@ -66,7 +73,7 @@ export type DiscoveredHandler = {
|
|
|
66
73
|
export function pascalCase(value: string): string {
|
|
67
74
|
return value
|
|
68
75
|
.replace(/(^|[^A-Za-z0-9]+)([A-Za-z0-9])/g, (_, __, c: string) =>
|
|
69
|
-
c.toUpperCase()
|
|
76
|
+
c.toUpperCase(),
|
|
70
77
|
)
|
|
71
78
|
.replace(/[^A-Za-z0-9]/g, "");
|
|
72
79
|
}
|
|
@@ -77,7 +84,7 @@ export function isValidIdentifier(value: string): boolean {
|
|
|
77
84
|
|
|
78
85
|
export function groupBy<T, TKey>(
|
|
79
86
|
items: T[],
|
|
80
|
-
keyFn: (item: T) => TKey
|
|
87
|
+
keyFn: (item: T) => TKey,
|
|
81
88
|
): Map<TKey, T[]> {
|
|
82
89
|
const map = new Map<TKey, T[]>();
|
|
83
90
|
for (const item of items) {
|
|
@@ -93,7 +100,7 @@ export function groupBy<T, TKey>(
|
|
|
93
100
|
|
|
94
101
|
export function toImportPathFromGeneratedSrc(
|
|
95
102
|
outDirAbs: string,
|
|
96
|
-
fileAbs: string
|
|
103
|
+
fileAbs: string,
|
|
97
104
|
): string {
|
|
98
105
|
const fromDir = path.join(outDirAbs, "src");
|
|
99
106
|
let rel = path.relative(fromDir, fileAbs);
|
|
@@ -107,7 +114,7 @@ export function toImportPathFromGeneratedSrc(
|
|
|
107
114
|
|
|
108
115
|
export function toImportPathFromGeneratedServer(
|
|
109
116
|
outDirAbs: string,
|
|
110
|
-
fileAbs: string
|
|
117
|
+
fileAbs: string,
|
|
111
118
|
): string {
|
|
112
119
|
const fromDir = path.join(outDirAbs, "server");
|
|
113
120
|
let rel = path.relative(fromDir, fileAbs);
|
|
@@ -121,7 +128,7 @@ export function toImportPathFromGeneratedServer(
|
|
|
121
128
|
|
|
122
129
|
export async function assertFileExists(
|
|
123
130
|
fileAbs: string,
|
|
124
|
-
message: string
|
|
131
|
+
message: string,
|
|
125
132
|
): Promise<void> {
|
|
126
133
|
const ok = await fileExists(fileAbs);
|
|
127
134
|
if (!ok) throw new Error(message);
|
|
@@ -129,7 +136,7 @@ export async function assertFileExists(
|
|
|
129
136
|
|
|
130
137
|
export async function assertDirExists(
|
|
131
138
|
dirAbs: string,
|
|
132
|
-
message: string
|
|
139
|
+
message: string,
|
|
133
140
|
): Promise<void> {
|
|
134
141
|
try {
|
|
135
142
|
const stat = await fs.stat(dirAbs);
|
|
@@ -150,7 +157,7 @@ export async function fileExists(fileAbs: string): Promise<boolean> {
|
|
|
150
157
|
|
|
151
158
|
export async function walkTsFiles(
|
|
152
159
|
rootAbs: string,
|
|
153
|
-
ignoreDirs: Set<string
|
|
160
|
+
ignoreDirs: Set<string>,
|
|
154
161
|
): Promise<string[]> {
|
|
155
162
|
const out: string[] = [];
|
|
156
163
|
const entries = await fs.readdir(rootAbs, { withFileTypes: true });
|
package/package.json
CHANGED
package/server/auth.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function createBetterAuthRouter<
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export function initBetterAuth<Options extends BetterAuthOptions>(
|
|
43
|
-
options: Options
|
|
43
|
+
options: Options,
|
|
44
44
|
): Auth<Options> {
|
|
45
45
|
return betterAuth({
|
|
46
46
|
...options,
|
|
@@ -53,7 +53,7 @@ export const getHeaders = (headers: Headers) => {
|
|
|
53
53
|
const headerObject: Record<string, any> = {};
|
|
54
54
|
for (const key in newHeaders) {
|
|
55
55
|
const isAuthorization =
|
|
56
|
-
key.toLowerCase() === "authorization" && newHeaders[key]?.
|
|
56
|
+
key.toLowerCase() === "authorization" && newHeaders[key]?.length > 7;
|
|
57
57
|
if (isAuthorization) {
|
|
58
58
|
if (key !== "cookie") {
|
|
59
59
|
headerObject[key] = newHeaders[key];
|