@nordcraft/core 1.0.53 → 1.0.54
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/ToddleApiV2.d.ts +11 -11
- package/dist/api/apiTypes.d.ts +10 -10
- package/package.json +1 -1
- package/src/api/apiTypes.ts +13 -10
|
@@ -13,28 +13,28 @@ export declare class ToddleApiV2<Handler> implements ApiRequest {
|
|
|
13
13
|
get name(): string;
|
|
14
14
|
get type(): "http" | "ws";
|
|
15
15
|
get autoFetch(): Formula | null | undefined;
|
|
16
|
-
get url(): Formula | undefined;
|
|
16
|
+
get url(): Formula | null | undefined;
|
|
17
17
|
get path(): Record<string, {
|
|
18
18
|
formula: Formula;
|
|
19
19
|
index: number;
|
|
20
|
-
}> | undefined;
|
|
20
|
+
}> | null | undefined;
|
|
21
21
|
get headers(): Record<string, {
|
|
22
22
|
formula: Formula;
|
|
23
23
|
enabled?: Formula | null;
|
|
24
|
-
}> | undefined;
|
|
24
|
+
}> | null | undefined;
|
|
25
25
|
set headers(headers: Record<string, {
|
|
26
26
|
formula: Formula;
|
|
27
27
|
enabled?: Formula | null;
|
|
28
|
-
}> | undefined);
|
|
29
|
-
get method(): import("./apiTypes").ApiMethod | undefined;
|
|
30
|
-
get body(): Formula | undefined;
|
|
28
|
+
}> | null | undefined);
|
|
29
|
+
get method(): import("./apiTypes").ApiMethod | null | undefined;
|
|
30
|
+
get body(): Formula | null | undefined;
|
|
31
31
|
get inputs(): Record<string, {
|
|
32
32
|
formula: Formula | null;
|
|
33
33
|
}>;
|
|
34
34
|
get queryParams(): Record<string, {
|
|
35
35
|
formula: Formula;
|
|
36
36
|
enabled?: Formula | null;
|
|
37
|
-
}> | undefined;
|
|
37
|
+
}> | null | undefined;
|
|
38
38
|
get server(): {
|
|
39
39
|
proxy?: {
|
|
40
40
|
enabled: {
|
|
@@ -48,8 +48,8 @@ export declare class ToddleApiV2<Handler> implements ApiRequest {
|
|
|
48
48
|
enabled?: {
|
|
49
49
|
formula: Formula;
|
|
50
50
|
} | null;
|
|
51
|
-
};
|
|
52
|
-
} | undefined;
|
|
51
|
+
} | null;
|
|
52
|
+
} | null | undefined;
|
|
53
53
|
get client(): {
|
|
54
54
|
debounce?: {
|
|
55
55
|
formula: Formula;
|
|
@@ -58,8 +58,8 @@ export declare class ToddleApiV2<Handler> implements ApiRequest {
|
|
|
58
58
|
onFailed?: import("../component/component.types").EventModel | null;
|
|
59
59
|
onMessage?: import("../component/component.types").EventModel | null;
|
|
60
60
|
parserMode: import("./apiTypes").ApiParserMode;
|
|
61
|
-
credentials?: "include" | "same-origin" | "omit";
|
|
62
|
-
} | undefined;
|
|
61
|
+
credentials?: "include" | "same-origin" | "omit" | null;
|
|
62
|
+
} | null | undefined;
|
|
63
63
|
get redirectRules(): Record<string, {
|
|
64
64
|
formula: Formula;
|
|
65
65
|
statusCode?: import("./apiTypes").RedirectStatusCode | null;
|
package/dist/api/apiTypes.d.ts
CHANGED
|
@@ -45,15 +45,15 @@ export declare enum ApiMethod {
|
|
|
45
45
|
export type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | 307 | 308;
|
|
46
46
|
export type ApiParserMode = 'auto' | 'text' | 'json' | 'event-stream' | 'json-stream' | 'blob';
|
|
47
47
|
export interface ApiBase extends NordcraftMetadata {
|
|
48
|
-
url?: Formula;
|
|
48
|
+
url?: Formula | null;
|
|
49
49
|
path?: Record<string, {
|
|
50
50
|
formula: Formula;
|
|
51
51
|
index: number;
|
|
52
|
-
}
|
|
52
|
+
}> | null;
|
|
53
53
|
queryParams?: Record<string, {
|
|
54
54
|
formula: Formula;
|
|
55
55
|
enabled?: Formula | null;
|
|
56
|
-
}
|
|
56
|
+
}> | null;
|
|
57
57
|
hash?: {
|
|
58
58
|
formula: Formula;
|
|
59
59
|
} | null;
|
|
@@ -66,9 +66,9 @@ export interface ApiRequest extends ApiBase {
|
|
|
66
66
|
headers?: Record<string, {
|
|
67
67
|
formula: Formula;
|
|
68
68
|
enabled?: Formula | null;
|
|
69
|
-
}
|
|
70
|
-
method?: ApiMethod;
|
|
71
|
-
body?: Formula;
|
|
69
|
+
}> | null;
|
|
70
|
+
method?: ApiMethod | null;
|
|
71
|
+
body?: Formula | null;
|
|
72
72
|
inputs: Record<string, {
|
|
73
73
|
formula: Formula | null;
|
|
74
74
|
}>;
|
|
@@ -87,8 +87,8 @@ export interface ApiRequest extends ApiBase {
|
|
|
87
87
|
enabled?: {
|
|
88
88
|
formula: Formula;
|
|
89
89
|
} | null;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
90
|
+
} | null;
|
|
91
|
+
} | null;
|
|
92
92
|
client?: {
|
|
93
93
|
debounce?: {
|
|
94
94
|
formula: Formula;
|
|
@@ -97,8 +97,8 @@ export interface ApiRequest extends ApiBase {
|
|
|
97
97
|
onFailed?: EventModel | null;
|
|
98
98
|
onMessage?: EventModel | null;
|
|
99
99
|
parserMode: ApiParserMode;
|
|
100
|
-
credentials?: 'include' | 'same-origin' | 'omit';
|
|
101
|
-
};
|
|
100
|
+
credentials?: 'include' | 'same-origin' | 'omit' | null;
|
|
101
|
+
} | null;
|
|
102
102
|
redirectRules?: Record<string, {
|
|
103
103
|
formula: Formula;
|
|
104
104
|
statusCode?: RedirectStatusCode | null;
|
package/package.json
CHANGED
package/src/api/apiTypes.ts
CHANGED
|
@@ -53,13 +53,13 @@ export type ApiParserMode =
|
|
|
53
53
|
| 'blob'
|
|
54
54
|
|
|
55
55
|
export interface ApiBase extends NordcraftMetadata {
|
|
56
|
-
url?: Formula
|
|
57
|
-
path?: Record<string, { formula: Formula; index: number }>
|
|
56
|
+
url?: Formula | null
|
|
57
|
+
path?: Record<string, { formula: Formula; index: number }> | null
|
|
58
58
|
queryParams?: Record<
|
|
59
59
|
string,
|
|
60
60
|
// The enabled formula is used to determine if the query parameter should be included in the request or not
|
|
61
61
|
{ formula: Formula; enabled?: Formula | null }
|
|
62
|
-
>
|
|
62
|
+
> | null
|
|
63
63
|
// hash is relevant for redirects and rewrites, but not for API calls
|
|
64
64
|
hash?: { formula: Formula } | null
|
|
65
65
|
}
|
|
@@ -69,9 +69,12 @@ export interface ApiRequest extends ApiBase {
|
|
|
69
69
|
name: string
|
|
70
70
|
type: 'http' | 'ws' // The structure for web sockets might look different
|
|
71
71
|
autoFetch?: Formula | null
|
|
72
|
-
headers?: Record<
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
headers?: Record<
|
|
73
|
+
string,
|
|
74
|
+
{ formula: Formula; enabled?: Formula | null }
|
|
75
|
+
> | null
|
|
76
|
+
method?: ApiMethod | null
|
|
77
|
+
body?: Formula | null
|
|
75
78
|
// inputs for an API request
|
|
76
79
|
inputs: Record<string, { formula: Formula | null }>
|
|
77
80
|
service?: string | null
|
|
@@ -89,8 +92,8 @@ export interface ApiRequest extends ApiBase {
|
|
|
89
92
|
// it should probably be true by default for autofetch APIs
|
|
90
93
|
// During SSR we will only fetch autoFetch requests
|
|
91
94
|
enabled?: { formula: Formula } | null
|
|
92
|
-
}
|
|
93
|
-
}
|
|
95
|
+
} | null
|
|
96
|
+
} | null
|
|
94
97
|
client?: {
|
|
95
98
|
debounce?: { formula: Formula } | null
|
|
96
99
|
onCompleted?: EventModel | null
|
|
@@ -101,8 +104,8 @@ export interface ApiRequest extends ApiBase {
|
|
|
101
104
|
// stream: The response will be handled as a stream
|
|
102
105
|
parserMode: ApiParserMode
|
|
103
106
|
// Whether to include credentials (cookies) in the request or not. Default is 'same-origin'
|
|
104
|
-
credentials?: 'include' | 'same-origin' | 'omit'
|
|
105
|
-
}
|
|
107
|
+
credentials?: 'include' | 'same-origin' | 'omit' | null
|
|
108
|
+
} | null
|
|
106
109
|
// Shared logic for client/server 👇
|
|
107
110
|
// The user could distinguish using an environment
|
|
108
111
|
// variable e.g. IS_SERVER when they declare the formula
|