appflare 0.2.0 → 0.2.2
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.
|
@@ -172,11 +172,6 @@ function renderRouteFactory(operation: HttpOperation): string {
|
|
|
172
172
|
(args ?? {}) as ${inputType},
|
|
173
173
|
) as ${inputType};
|
|
174
174
|
const requestAuthToken = resolveRealtimeAuthToken(authToken, mergedOptions?.headers);
|
|
175
|
-
if (!requestAuthToken && !runtime.getAuthToken) {
|
|
176
|
-
throw new Error(
|
|
177
|
-
"authToken is required for realtime subscribe (pass options.authToken or Authorization Bearer header)",
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
175
|
|
|
181
176
|
let removed = false;
|
|
182
177
|
let socket: WebSocket | null = null;
|
|
@@ -229,17 +224,6 @@ function renderRouteFactory(operation: HttpOperation): string {
|
|
|
229
224
|
}
|
|
230
225
|
}
|
|
231
226
|
|
|
232
|
-
if (!resolvedAuthToken) {
|
|
233
|
-
const authError = new Error(
|
|
234
|
-
"authToken is required for realtime subscribe (pass options.authToken or Authorization Bearer header)",
|
|
235
|
-
);
|
|
236
|
-
if (onError) {
|
|
237
|
-
onError(authError);
|
|
238
|
-
} else {
|
|
239
|
-
console.warn("[appflare:subscribe]", authError.message);
|
|
240
|
-
}
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
227
|
|
|
244
228
|
const subscription = (await requestRoute<RealtimeSubscriptionResponse>(runtime.endpoint, {
|
|
245
229
|
route: "/realtime/subscribe",
|
|
@@ -94,6 +94,32 @@ export type AppflareQueryRouteClient<
|
|
|
94
94
|
) => AppflareRealtimeSubscription;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
export type InferRouteSchema<TRoute> = TRoute extends {
|
|
98
|
+
schema: infer TSchema;
|
|
99
|
+
}
|
|
100
|
+
? TSchema
|
|
101
|
+
: never;
|
|
102
|
+
|
|
103
|
+
export type InferRouteInput<TRoute> = TRoute extends {
|
|
104
|
+
run: (...args: infer TArgs) => Promise<unknown>;
|
|
105
|
+
}
|
|
106
|
+
? TArgs extends [infer TInput, ...unknown[]]
|
|
107
|
+
? TInput
|
|
108
|
+
: never
|
|
109
|
+
: never;
|
|
110
|
+
|
|
111
|
+
export type InferRouteResult<TRoute> = TRoute extends {
|
|
112
|
+
run: (...args: infer _TArgs) => Promise<infer TResult>;
|
|
113
|
+
}
|
|
114
|
+
? TResult
|
|
115
|
+
: never;
|
|
116
|
+
|
|
117
|
+
export type InferRouteOutput<TRoute> = InferRouteResult<TRoute> extends AppflareRequestResult<
|
|
118
|
+
infer TOutput
|
|
119
|
+
>
|
|
120
|
+
? TOutput
|
|
121
|
+
: never;
|
|
122
|
+
|
|
97
123
|
export type StorageSignedUrlResponse = {
|
|
98
124
|
url: string;
|
|
99
125
|
method: "GET" | "PUT" | "DELETE";
|