@donkeylabs/server 0.1.3 → 0.1.4
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/examples/starter/node_modules/@donkeylabs/server/README.md +15 -0
- package/examples/starter/node_modules/@donkeylabs/server/cli/commands/generate.ts +461 -0
- package/examples/starter/node_modules/@donkeylabs/server/cli/commands/init.ts +476 -0
- package/examples/starter/node_modules/@donkeylabs/server/cli/commands/interactive.ts +223 -0
- package/examples/starter/node_modules/@donkeylabs/server/cli/commands/plugin.ts +192 -0
- package/examples/starter/node_modules/@donkeylabs/server/cli/donkeylabs +106 -0
- package/examples/starter/node_modules/@donkeylabs/server/cli/index.ts +100 -0
- package/examples/starter/node_modules/@donkeylabs/server/context.d.ts +17 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/api-client.md +520 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/cache.md +437 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/cli.md +353 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/core-services.md +338 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/cron.md +465 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/errors.md +303 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/events.md +460 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/handlers.md +549 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/jobs.md +556 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/logger.md +316 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/middleware.md +682 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/plugins.md +524 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/project-structure.md +493 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/rate-limiter.md +525 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/router.md +566 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/sse.md +542 -0
- package/examples/starter/node_modules/@donkeylabs/server/docs/svelte-frontend.md +324 -0
- package/examples/starter/node_modules/@donkeylabs/server/mcp/donkeylabs-mcp +3238 -0
- package/examples/starter/node_modules/@donkeylabs/server/mcp/server.ts +3238 -0
- package/examples/starter/node_modules/@donkeylabs/server/package.json +77 -0
- package/examples/starter/node_modules/@donkeylabs/server/registry.d.ts +11 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/client/base.ts +481 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/client/index.ts +150 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/cache.ts +183 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/cron.ts +255 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/errors.ts +320 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/events.ts +163 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/index.ts +94 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/jobs.ts +334 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/logger.ts +131 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/rate-limiter.ts +193 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core/sse.ts +210 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/core.ts +428 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/handlers.ts +87 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/harness.ts +70 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/index.ts +38 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/middleware.ts +34 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/registry.ts +13 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/router.ts +155 -0
- package/examples/starter/node_modules/@donkeylabs/server/src/server.ts +234 -0
- package/examples/starter/node_modules/@donkeylabs/server/templates/init/donkeylabs.config.ts.template +14 -0
- package/examples/starter/node_modules/@donkeylabs/server/templates/init/index.ts.template +41 -0
- package/examples/starter/node_modules/@donkeylabs/server/templates/plugin/index.ts.template +25 -0
- package/examples/starter/src/routes/health/ping/models/model.ts +11 -7
- package/package.json +3 -3
- package/examples/starter/node_modules/.svelte2tsx-language-server-files/svelte-native-jsx.d.ts +0 -32
- package/examples/starter/node_modules/.svelte2tsx-language-server-files/svelte-shims-v4.d.ts +0 -290
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createPlugin } from "@donkeylabs/server";
|
|
2
|
+
// import type { DB as {{PascalName}}Schema } from "./schema";
|
|
3
|
+
|
|
4
|
+
export interface {{PascalName}}Service {
|
|
5
|
+
// Define your service interface here
|
|
6
|
+
getData(): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const {{camelName}}Plugin = createPlugin
|
|
10
|
+
// .withSchema<{{PascalName}}Schema>() // Uncomment if using database schema
|
|
11
|
+
.define({
|
|
12
|
+
name: "{{name}}",
|
|
13
|
+
version: "1.0.0",
|
|
14
|
+
// dependencies: ["otherPlugin"] as const, // Uncomment if depending on other plugins
|
|
15
|
+
|
|
16
|
+
service: async (ctx): Promise<{{PascalName}}Service> => {
|
|
17
|
+
console.log("[{{PascalName}}Plugin] Initializing...");
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
getData: async () => {
|
|
21
|
+
return "Hello from {{name}} plugin!";
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
//
|
|
2
|
-
import {
|
|
1
|
+
// After running `bun run gen:types`, use typed Handler:
|
|
2
|
+
import type { Handler } from "@donkeylabs/server";
|
|
3
3
|
import type { Health } from "$server/routes";
|
|
4
|
+
import { AppContext } from "$server/context";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Model class with handler logic.
|
|
7
|
-
* Extends BaseHandler<Health.Ping> to get automatic input/output typing.
|
|
8
8
|
*/
|
|
9
|
-
export class PingModel
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export class PingModel implements Handler<Health.Ping> {
|
|
10
|
+
private ctx: AppContext;
|
|
11
|
+
|
|
12
|
+
constructor(ctx: AppContext) {
|
|
13
|
+
this.ctx = ctx;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
handle(input: Health.Ping.Input): Health.Ping.Output {
|
|
13
17
|
return {
|
|
14
18
|
status: "ok",
|
|
15
19
|
timestamp: new Date().toISOString(),
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donkeylabs/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Type-safe plugin system for building RPC-style APIs with Bun",
|
|
6
6
|
"main": "./src/index.ts",
|
|
7
7
|
"types": "./src/index.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"donkeylabs": "./cli/
|
|
10
|
-
"donkeylabs-mcp": "./mcp/
|
|
9
|
+
"donkeylabs": "./cli/index.ts",
|
|
10
|
+
"donkeylabs-mcp": "./mcp/server.ts"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
package/examples/starter/node_modules/.svelte2tsx-language-server-files/svelte-native-jsx.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
declare namespace svelteNative.JSX {
|
|
2
|
-
|
|
3
|
-
// Every namespace eligible for use needs to implement the following two functions
|
|
4
|
-
function mapElementTag(
|
|
5
|
-
tag: string
|
|
6
|
-
): any;
|
|
7
|
-
|
|
8
|
-
function createElement<Elements extends IntrinsicElements, Key extends keyof Elements>(
|
|
9
|
-
element: Key | undefined | null, attrs: Elements[Key]
|
|
10
|
-
): any;
|
|
11
|
-
function createElement<Elements extends IntrinsicElements, Key extends keyof Elements, T>(
|
|
12
|
-
element: Key | undefined | null, attrEnhancers: T, attrs: Elements[Key] & T
|
|
13
|
-
): any;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/* svelte specific */
|
|
17
|
-
interface ElementClass {
|
|
18
|
-
$$prop_def: any;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface ElementAttributesProperty {
|
|
22
|
-
$$prop_def: any; // specify the property name to use
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Add empty IntrinsicAttributes to prevent fallback to the one in the JSX namespace
|
|
26
|
-
interface IntrinsicAttributes {
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface IntrinsicElements {
|
|
30
|
-
[name: string]: { [name: string]: any };
|
|
31
|
-
}
|
|
32
|
-
}
|
package/examples/starter/node_modules/.svelte2tsx-language-server-files/svelte-shims-v4.d.ts
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
// Whenever a ambient declaration changes, its number should be increased
|
|
2
|
-
// This way, we avoid the situation where multiple ambient versions of svelte2tsx
|
|
3
|
-
// are loaded and their declarations conflict each other
|
|
4
|
-
// See https://github.com/sveltejs/language-tools/issues/1059 for an example bug that stems from it
|
|
5
|
-
// If you change anything in this file, think about whether or not it should be backported to svelte-shims.d.ts
|
|
6
|
-
|
|
7
|
-
type AConstructorTypeOf<T, U extends any[] = any[]> = new (...args: U) => T;
|
|
8
|
-
|
|
9
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
10
|
-
type SvelteActionReturnType = {
|
|
11
|
-
update?: (args: any) => void,
|
|
12
|
-
destroy?: () => void
|
|
13
|
-
} | void
|
|
14
|
-
|
|
15
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
16
|
-
type SvelteTransitionConfig = {
|
|
17
|
-
delay?: number,
|
|
18
|
-
duration?: number,
|
|
19
|
-
easing?: (t: number) => number,
|
|
20
|
-
css?: (t: number, u: number) => string,
|
|
21
|
-
tick?: (t: number, u: number) => void
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
25
|
-
type SvelteTransitionReturnType = SvelteTransitionConfig | (() => SvelteTransitionConfig)
|
|
26
|
-
|
|
27
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
28
|
-
type SvelteAnimationReturnType = {
|
|
29
|
-
delay?: number,
|
|
30
|
-
duration?: number,
|
|
31
|
-
easing?: (t: number) => number,
|
|
32
|
-
css?: (t: number, u: number) => string,
|
|
33
|
-
tick?: (t: number, u: number) => void
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
37
|
-
type SvelteWithOptionalProps<Props, Keys extends keyof Props> = Omit<Props, Keys> & Partial<Pick<Props, Keys>>;
|
|
38
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
39
|
-
type SvelteAllProps = { [index: string]: any }
|
|
40
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
41
|
-
type SveltePropsAnyFallback<Props> = {[K in keyof Props]: Props[K] extends never ? never : Props[K] extends undefined ? any : Props[K]}
|
|
42
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
43
|
-
type SvelteSlotsAnyFallback<Slots> = {[K in keyof Slots]: {[S in keyof Slots[K]]: Slots[K][S] extends undefined ? any : Slots[K][S]}}
|
|
44
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
45
|
-
type SvelteRestProps = { [index: string]: any }
|
|
46
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
47
|
-
type SvelteSlots = { [index: string]: any }
|
|
48
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
49
|
-
type SvelteStore<T> = { subscribe: (run: (value: T) => any, invalidate?: any) => any }
|
|
50
|
-
|
|
51
|
-
// Forces TypeScript to look into the type which results in a better representation of it
|
|
52
|
-
// which helps for error messages and is necessary for d.ts file transformation so that
|
|
53
|
-
// no ambient type references are left in the output
|
|
54
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
55
|
-
type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
|
|
56
|
-
|
|
57
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
58
|
-
type KeysMatching<Obj, V> = {[K in keyof Obj]-?: Obj[K] extends V ? K : never}[keyof Obj]
|
|
59
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
60
|
-
declare type __sveltets_2_CustomEvents<T> = {[K in KeysMatching<T, CustomEvent>]: T[K] extends CustomEvent ? T[K]['detail']: T[K]}
|
|
61
|
-
|
|
62
|
-
declare function __sveltets_2_ensureRightProps<Props>(props: Props): {};
|
|
63
|
-
declare function __sveltets_2_instanceOf<T = any>(type: AConstructorTypeOf<T>): T;
|
|
64
|
-
declare function __sveltets_2_allPropsType(): SvelteAllProps
|
|
65
|
-
declare function __sveltets_2_restPropsType(): SvelteRestProps
|
|
66
|
-
declare function __sveltets_2_slotsType<Slots, Key extends keyof Slots>(slots: Slots): Record<Key, boolean>;
|
|
67
|
-
|
|
68
|
-
// Overload of the following two functions is necessary.
|
|
69
|
-
// An empty array of optionalProps makes OptionalProps type any, which means we lose the prop typing.
|
|
70
|
-
// optionalProps need to be first or its type cannot be infered correctly.
|
|
71
|
-
|
|
72
|
-
declare function __sveltets_2_partial<Props = {}, Events = {}, Slots = {}, Exports = {}, Bindings = string>(
|
|
73
|
-
render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }
|
|
74
|
-
): {props: Expand<SveltePropsAnyFallback<Props>>, events: Events, slots: Expand<SvelteSlotsAnyFallback<Slots>>, exports?: Exports, bindings?: Bindings }
|
|
75
|
-
declare function __sveltets_2_partial<Props = {}, Events = {}, Slots = {}, Exports = {}, Bindings = string, OptionalProps extends keyof Props = any>(
|
|
76
|
-
optionalProps: OptionalProps[],
|
|
77
|
-
render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }
|
|
78
|
-
): {props: Expand<SvelteWithOptionalProps<SveltePropsAnyFallback<Props>, OptionalProps>>, events: Events, slots: Expand<SvelteSlotsAnyFallback<Slots>>, exports?: Exports, bindings?: Bindings }
|
|
79
|
-
|
|
80
|
-
declare function __sveltets_2_partial_with_any<Props = {}, Events = {}, Slots = {}, Exports = {}, Bindings = string>(
|
|
81
|
-
render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }
|
|
82
|
-
): {props: Expand<SveltePropsAnyFallback<Props> & SvelteAllProps>, events: Events, slots: Expand<SvelteSlotsAnyFallback<Slots>>, exports?: Exports, bindings?: Bindings }
|
|
83
|
-
declare function __sveltets_2_partial_with_any<Props = {}, Events = {}, Slots = {}, Exports = {}, Bindings = string, OptionalProps extends keyof Props = any>(
|
|
84
|
-
optionalProps: OptionalProps[],
|
|
85
|
-
render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }
|
|
86
|
-
): {props: Expand<SvelteWithOptionalProps<SveltePropsAnyFallback<Props>, OptionalProps> & SvelteAllProps>, events: Events, slots: Expand<SvelteSlotsAnyFallback<Slots>>, exports?: Exports, bindings?: Bindings }
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
declare function __sveltets_2_with_any<Props = {}, Events = {}, Slots = {}, Exports = {}, Bindings = string>(
|
|
90
|
-
render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }
|
|
91
|
-
): {props: Expand<Props & SvelteAllProps>, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }
|
|
92
|
-
|
|
93
|
-
declare function __sveltets_2_with_any_event<Props = {}, Events = {}, Slots = {}, Exports = {}, Bindings = string>(
|
|
94
|
-
render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }
|
|
95
|
-
): {props: Props, events: Events & {[evt: string]: CustomEvent<any>;}, slots: Slots, exports?: Exports, bindings?: Bindings }
|
|
96
|
-
|
|
97
|
-
declare function __sveltets_2_store_get<T = any>(store: SvelteStore<T>): T
|
|
98
|
-
declare function __sveltets_2_store_get<Store extends SvelteStore<any> | undefined | null>(store: Store): Store extends SvelteStore<infer T> ? T : Store;
|
|
99
|
-
declare function __sveltets_2_any(dummy: any): any;
|
|
100
|
-
declare function __sveltets_2_invalidate<T>(getValue: () => T): T
|
|
101
|
-
|
|
102
|
-
declare function __sveltets_2_mapWindowEvent<K extends keyof HTMLBodyElementEventMap>(
|
|
103
|
-
event: K
|
|
104
|
-
): HTMLBodyElementEventMap[K];
|
|
105
|
-
declare function __sveltets_2_mapBodyEvent<K extends keyof WindowEventMap>(
|
|
106
|
-
event: K
|
|
107
|
-
): WindowEventMap[K];
|
|
108
|
-
declare function __sveltets_2_mapElementEvent<K extends keyof HTMLElementEventMap>(
|
|
109
|
-
event: K
|
|
110
|
-
): HTMLElementEventMap[K];
|
|
111
|
-
|
|
112
|
-
declare function __sveltets_2_bubbleEventDef<Events, K extends keyof Events>(
|
|
113
|
-
events: Events, eventKey: K
|
|
114
|
-
): Events[K];
|
|
115
|
-
declare function __sveltets_2_bubbleEventDef(
|
|
116
|
-
events: any, eventKey: string
|
|
117
|
-
): any;
|
|
118
|
-
|
|
119
|
-
declare const __sveltets_2_customEvent: CustomEvent<any>;
|
|
120
|
-
declare function __sveltets_2_toEventTypings<Typings>(): {[Key in keyof Typings]: CustomEvent<Typings[Key]>};
|
|
121
|
-
|
|
122
|
-
declare function __sveltets_2_unionType<T1, T2>(t1: T1, t2: T2): T1 | T2;
|
|
123
|
-
declare function __sveltets_2_unionType<T1, T2, T3>(t1: T1, t2: T2, t3: T3): T1 | T2 | T3;
|
|
124
|
-
declare function __sveltets_2_unionType<T1, T2, T3, T4>(t1: T1, t2: T2, t3: T3, t4: T4): T1 | T2 | T3 | T4;
|
|
125
|
-
declare function __sveltets_2_unionType(...types: any[]): any;
|
|
126
|
-
|
|
127
|
-
declare function __sveltets_2_createSvelte2TsxComponent<Props extends {}, Events extends {}, Slots extends {}>(
|
|
128
|
-
render: {props: Props, events: Events, slots: Slots }
|
|
129
|
-
): typeof import("svelte").SvelteComponent<Props, Events, Slots>;
|
|
130
|
-
|
|
131
|
-
declare function __sveltets_2_unwrapArr<T>(arr: ArrayLike<T>): T
|
|
132
|
-
declare function __sveltets_2_unwrapPromiseLike<T>(promise: PromiseLike<T> | T): T
|
|
133
|
-
|
|
134
|
-
// v2
|
|
135
|
-
declare function __sveltets_2_createCreateSlot<Slots = Record<string, Record<string, any>>>(): <SlotName extends keyof Slots>(slotName: SlotName, attrs: Slots[SlotName]) => Record<string, any>;
|
|
136
|
-
declare function __sveltets_2_createComponentAny(props: Record<string, any>): import("svelte").SvelteComponent<any, any, any>;
|
|
137
|
-
|
|
138
|
-
declare function __sveltets_2_any(...dummy: any[]): any;
|
|
139
|
-
declare function __sveltets_2_empty(...dummy: any[]): {};
|
|
140
|
-
declare function __sveltets_2_union<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(t1:T1,t2?:T2,t3?:T3,t4?:T4,t5?:T5,t6?:T6,t7?:T7,t8?:T8,t9?:T9,t10?:T10): T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8 & T9 & T10;
|
|
141
|
-
declare function __sveltets_2_nonNullable<T>(type: T): NonNullable<T>;
|
|
142
|
-
|
|
143
|
-
declare function __sveltets_2_cssProp(prop: Record<string, any>): {};
|
|
144
|
-
|
|
145
|
-
// @ts-ignore Svelte v3/v4 don't have this
|
|
146
|
-
declare function __sveltets_2_ensureSnippet(val: ReturnType<import('svelte').Snippet> | undefined | null): any;
|
|
147
|
-
|
|
148
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
149
|
-
type __sveltets_2_SvelteAnimationReturnType = {
|
|
150
|
-
delay?: number,
|
|
151
|
-
duration?: number,
|
|
152
|
-
easing?: (t: number) => number,
|
|
153
|
-
css?: (t: number, u: number) => string,
|
|
154
|
-
tick?: (t: number, u: number) => void
|
|
155
|
-
}
|
|
156
|
-
declare var __sveltets_2_AnimationMove: { from: DOMRect, to: DOMRect }
|
|
157
|
-
declare function __sveltets_2_ensureAnimation(animationCall: __sveltets_2_SvelteAnimationReturnType): {};
|
|
158
|
-
|
|
159
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
160
|
-
type __sveltets_2_SvelteActionReturnType = {
|
|
161
|
-
update?: (args: any) => void,
|
|
162
|
-
destroy?: () => void,
|
|
163
|
-
$$_attributes?: Record<string, any>,
|
|
164
|
-
} | void
|
|
165
|
-
declare function __sveltets_2_ensureAction<T extends __sveltets_2_SvelteActionReturnType>(actionCall: T): T extends {$$_attributes?: any} ? T['$$_attributes'] : {};
|
|
166
|
-
|
|
167
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
168
|
-
type __sveltets_2_SvelteTransitionConfig = {
|
|
169
|
-
delay?: number,
|
|
170
|
-
duration?: number,
|
|
171
|
-
easing?: (t: number) => number,
|
|
172
|
-
css?: (t: number, u: number) => string,
|
|
173
|
-
tick?: (t: number, u: number) => void
|
|
174
|
-
}
|
|
175
|
-
/** @internal PRIVATE API, DO NOT USE */
|
|
176
|
-
type __sveltets_2_SvelteTransitionReturnType = __sveltets_2_SvelteTransitionConfig | (() => __sveltets_2_SvelteTransitionConfig)
|
|
177
|
-
declare function __sveltets_2_ensureTransition(transitionCall: __sveltets_2_SvelteTransitionReturnType): {};
|
|
178
|
-
|
|
179
|
-
// Includes undefined and null for all types as all usages also allow these
|
|
180
|
-
declare function __sveltets_2_ensureType<T>(type: AConstructorTypeOf<T>, el: T | undefined | null): {};
|
|
181
|
-
declare function __sveltets_2_ensureType<T1, T2>(type1: AConstructorTypeOf<T1>, type2: AConstructorTypeOf<T2>, el: T1 | T2 | undefined | null): {};
|
|
182
|
-
|
|
183
|
-
// The following is necessary because there are two clashing errors that can't be solved at the same time
|
|
184
|
-
// when using Svelte2TsxComponent, more precisely the event typings in
|
|
185
|
-
// __sveltets_2_ensureComponent<T extends new (..) => _SvelteComponent<any,||any||<-this,any>>(type: T): T;
|
|
186
|
-
// If we type it as "any", we have an error when using sth like {a: CustomEvent<any>}
|
|
187
|
-
// If we type it as "{}", we have an error when using sth like {[evt: string]: CustomEvent<any>}
|
|
188
|
-
// If we type it as "unknown", we get all kinds of follow up errors which we want to avoid
|
|
189
|
-
// Therefore introduce two more base classes just for this case.
|
|
190
|
-
/**
|
|
191
|
-
* Ambient type only used for intellisense, DO NOT USE IN YOUR PROJECT
|
|
192
|
-
*/
|
|
193
|
-
declare type ATypedSvelteComponent = {
|
|
194
|
-
/**
|
|
195
|
-
* @internal This is for type checking capabilities only
|
|
196
|
-
* and does not exist at runtime. Don't use this property.
|
|
197
|
-
*/
|
|
198
|
-
$$prop_def: any;
|
|
199
|
-
/**
|
|
200
|
-
* @internal This is for type checking capabilities only
|
|
201
|
-
* and does not exist at runtime. Don't use this property.
|
|
202
|
-
*/
|
|
203
|
-
$$events_def: any;
|
|
204
|
-
/**
|
|
205
|
-
* @internal This is for type checking capabilities only
|
|
206
|
-
* and does not exist at runtime. Don't use this property.
|
|
207
|
-
*/
|
|
208
|
-
$$slot_def: any;
|
|
209
|
-
|
|
210
|
-
$on(event: string, handler: any): () => void;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Ambient type only used for intellisense, DO NOT USE IN YOUR PROJECT.
|
|
214
|
-
*
|
|
215
|
-
* If you're looking for the type of a Svelte Component, use `SvelteComponent` and `ComponentType` instead:
|
|
216
|
-
*
|
|
217
|
-
* ```ts
|
|
218
|
-
* import type { ComponentType, SvelteComponent } from "svelte";
|
|
219
|
-
* let myComponentConstructor: ComponentType<SvelteComponent> = ..;
|
|
220
|
-
* ```
|
|
221
|
-
*/
|
|
222
|
-
declare type ConstructorOfATypedSvelteComponent = new (args: {target: any, props?: any}) => ATypedSvelteComponent
|
|
223
|
-
// Usage note: Cannot properly transform generic function components to class components due to TypeScript limitations
|
|
224
|
-
declare function __sveltets_2_ensureComponent<
|
|
225
|
-
T extends
|
|
226
|
-
| ConstructorOfATypedSvelteComponent
|
|
227
|
-
| (typeof import('svelte') extends { mount: any }
|
|
228
|
-
? // @ts-ignore svelte.Component doesn't exist in Svelte 4
|
|
229
|
-
import('svelte').Component<any, any, any>
|
|
230
|
-
: never)
|
|
231
|
-
| null
|
|
232
|
-
| undefined
|
|
233
|
-
>(
|
|
234
|
-
type: T
|
|
235
|
-
): NonNullable<
|
|
236
|
-
T extends ConstructorOfATypedSvelteComponent
|
|
237
|
-
? T
|
|
238
|
-
: typeof import('svelte') extends { mount: any }
|
|
239
|
-
? // @ts-ignore svelte.Component doesn't exist in Svelte 4
|
|
240
|
-
T extends import('svelte').Component<
|
|
241
|
-
infer Props extends Record<string, any>,
|
|
242
|
-
infer Exports extends Record<string, any>,
|
|
243
|
-
infer Bindings extends string
|
|
244
|
-
>
|
|
245
|
-
? new (
|
|
246
|
-
options: import('svelte').ComponentConstructorOptions<Props>
|
|
247
|
-
) => import('svelte').SvelteComponent<Props, Props['$$events'], Props['$$slots']> &
|
|
248
|
-
Exports & { $$bindings: Bindings }
|
|
249
|
-
: never
|
|
250
|
-
: never
|
|
251
|
-
>;
|
|
252
|
-
|
|
253
|
-
declare function __sveltets_2_ensureArray<T extends ArrayLike<unknown> | Iterable<unknown>>(
|
|
254
|
-
// Svelte 5 allows undefined or null here, Svelte 4 doesn't
|
|
255
|
-
array: T | (typeof import('svelte') extends { mount: any } ? (undefined | null) : never)
|
|
256
|
-
): T extends ArrayLike<infer U> ? U[] : T extends Iterable<infer U> ? Iterable<U> : any[];
|
|
257
|
-
|
|
258
|
-
type __sveltets_2_PropsWithChildren<Props, Slots> = Props &
|
|
259
|
-
(Slots extends { default: any }
|
|
260
|
-
// This is unfortunate because it means "accepts no props" turns into "accepts any prop"
|
|
261
|
-
// but the alternative is non-fixable type errors because of the way TypeScript index
|
|
262
|
-
// signatures work (they will always take precedence and make an impossible-to-satisfy children type).
|
|
263
|
-
? Props extends Record<string, never>
|
|
264
|
-
? any
|
|
265
|
-
: { children?: any }
|
|
266
|
-
: {});
|
|
267
|
-
declare function __sveltets_2_runes_constructor<Props extends {}>(render: {props: Props }): import("svelte").ComponentConstructorOptions<Props>;
|
|
268
|
-
|
|
269
|
-
declare function __sveltets_2_get_set_binding<T>(get: (() => T) | null | undefined, set: (t: T) => void): T;
|
|
270
|
-
|
|
271
|
-
declare function __sveltets_$$bindings<Bindings extends string[]>(...bindings: Bindings): Bindings[number];
|
|
272
|
-
|
|
273
|
-
declare function __sveltets_2_fn_component<
|
|
274
|
-
Props extends Record<string, any>, Exports extends Record<string, any>, Bindings extends string
|
|
275
|
-
// @ts-ignore Svelte 5 only
|
|
276
|
-
>(klass: {props: Props, exports?: Exports, bindings?: Bindings }): import('svelte').Component<Props, Exports, Bindings>;
|
|
277
|
-
|
|
278
|
-
interface __sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
279
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & { $$bindings?: Bindings } & Exports;
|
|
280
|
-
(internal: unknown, props: Props extends Record<string, never> ? {$$events?: Events, $$slots?: Slots} : Props & {$$events?: Events, $$slots?: Slots}): Exports & { $set?: any, $on?: any };
|
|
281
|
-
z_$$bindings?: Bindings;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
declare function __sveltets_2_isomorphic_component<
|
|
285
|
-
Props extends Record<string, any>, Events extends Record<string, any>, Slots extends Record<string, any>, Exports extends Record<string, any>, Bindings extends string
|
|
286
|
-
>(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): __sveltets_2_IsomorphicComponent<Props, Events, Slots, Exports, Bindings>;
|
|
287
|
-
|
|
288
|
-
declare function __sveltets_2_isomorphic_component_slots<
|
|
289
|
-
Props extends Record<string, any>, Events extends Record<string, any>, Slots extends Record<string, any>, Exports extends Record<string, any>, Bindings extends string
|
|
290
|
-
>(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): __sveltets_2_IsomorphicComponent<__sveltets_2_PropsWithChildren<Props, Slots>, Events, Slots, Exports, Bindings>;
|