@primate/core 0.7.4 → 0.7.5
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/lib/private/client/transport.js +0 -2
- package/lib/private/route.client.d.ts +1 -8
- package/lib/private/route.client.js +2 -1
- package/lib/private/session/index.client.d.ts +4 -0
- package/lib/private/session/index.client.js +24 -0
- package/lib/private/store.client.d.ts +11 -0
- package/lib/private/store.client.js +9 -0
- package/lib/public/session/config.client.d.ts +2 -0
- package/lib/public/session/config.client.js +2 -0
- package/package.json +6 -1
|
@@ -7,8 +7,6 @@ const get_location = (response, base) => {
|
|
|
7
7
|
return location !== null ? new URL(location, base) : null;
|
|
8
8
|
};
|
|
9
9
|
async function refetch(input, init = {}, max_hops = 5) {
|
|
10
|
-
console.log("location.href", globalThis.location.href);
|
|
11
|
-
console.log("input", input.toString());
|
|
12
10
|
let url = new URL(input.toString(), globalThis.location.href);
|
|
13
11
|
const method = (init.method ?? "GET").toUpperCase();
|
|
14
12
|
let hops = 0;
|
|
@@ -27,14 +27,7 @@ type WithResult<O extends RouteOptions> = {
|
|
|
27
27
|
type RouteHandlers = {
|
|
28
28
|
[key: string]: RouteHandler | WithResult<RouteOptions>;
|
|
29
29
|
};
|
|
30
|
-
declare function route<R extends RouteHandlers>(handlers: R):
|
|
31
|
-
_handlers: {
|
|
32
|
-
[k: string]: {
|
|
33
|
-
contentType: ("application/x-7z-compressed" | "application/octet-stream" | "application/x-bzip2" | "application/gzip" | "application/json" | "application/ld+json" | "application/pdf" | "application/x-rar-compressed" | "application/rss+xml" | "application/x-tar" | "application/wasm" | "application/manifest+json" | "application/xml" | "application/yaml" | "application/zip" | "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "font/otf" | "font/ttf" | "font/woff" | "font/woff2" | "image/apng" | "image/avif" | "image/bmp" | "image/gif" | "image/x-icon" | "image/jpeg" | "image/png" | "image/svg+xml" | "image/tiff" | "image/webp" | "text/css" | "text/csv" | "text/html" | "text/javascript" | "text/markdown" | "text/rtf" | "text/plain" | "text/tab-separated-values" | "text/vtt" | "video/quicktime" | "video/mp4" | "video/ogg" | "video/mp2t" | "video/webm" | "application/x-www-form-urlencoded" | "multipart/form-data" | "text/event-stream") | undefined;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
connect(path: string): ClientRoute<R>;
|
|
37
|
-
};
|
|
30
|
+
declare function route<R extends RouteHandlers>(handlers: R): ClientRoute<R>;
|
|
38
31
|
declare namespace route {
|
|
39
32
|
var _a: <O extends RouteOptions>(options: O, handler: RouteHandler<O>) => WithResult<O>;
|
|
40
33
|
export { _a as with };
|
|
@@ -25,7 +25,7 @@ function headers(contentType) {
|
|
|
25
25
|
return { "Content-Type": contentType };
|
|
26
26
|
}
|
|
27
27
|
function route(handlers) {
|
|
28
|
-
|
|
28
|
+
const r = {
|
|
29
29
|
_handlers: Object.fromEntries(Object.entries(handlers).map(([method, value]) => {
|
|
30
30
|
const options = is_with(value) ? value.options : {};
|
|
31
31
|
return [method, { contentType: options.contentType }];
|
|
@@ -43,6 +43,7 @@ function route(handlers) {
|
|
|
43
43
|
}));
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
|
+
return r;
|
|
46
47
|
}
|
|
47
48
|
route.with = function (options, handler) {
|
|
48
49
|
return { handler, options };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default function session() {
|
|
2
|
+
const facade = {
|
|
3
|
+
get id() {
|
|
4
|
+
return "";
|
|
5
|
+
},
|
|
6
|
+
get exists() {
|
|
7
|
+
return false;
|
|
8
|
+
},
|
|
9
|
+
create() {
|
|
10
|
+
},
|
|
11
|
+
get() {
|
|
12
|
+
return {};
|
|
13
|
+
},
|
|
14
|
+
try() {
|
|
15
|
+
return {};
|
|
16
|
+
},
|
|
17
|
+
set() {
|
|
18
|
+
},
|
|
19
|
+
destroy() {
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
return facade;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.client.js.map
|
|
@@ -7,5 +7,16 @@ declare function store(): {
|
|
|
7
7
|
update: () => Promise<number>;
|
|
8
8
|
delete: () => Promise<number>;
|
|
9
9
|
};
|
|
10
|
+
declare namespace store {
|
|
11
|
+
var key: {
|
|
12
|
+
primary(): void;
|
|
13
|
+
foreign(): void;
|
|
14
|
+
};
|
|
15
|
+
var relation: {
|
|
16
|
+
one(): void;
|
|
17
|
+
many(): void;
|
|
18
|
+
is(): void;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
10
21
|
export default store;
|
|
11
22
|
//# sourceMappingURL=store.client.d.ts.map
|
|
@@ -14,5 +14,14 @@ function store() {
|
|
|
14
14
|
delete: async () => 0,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
+
store.key = {
|
|
18
|
+
primary() { },
|
|
19
|
+
foreign() { },
|
|
20
|
+
};
|
|
21
|
+
store.relation = {
|
|
22
|
+
one() { },
|
|
23
|
+
many() { },
|
|
24
|
+
is() { },
|
|
25
|
+
};
|
|
17
26
|
export default store;
|
|
18
27
|
//# sourceMappingURL=store.client.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primate/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "The universal web framework",
|
|
5
5
|
"homepage": "https://primate.run",
|
|
6
6
|
"bugs": "https://github.com/primate-run/primate/issues",
|
|
@@ -65,6 +65,11 @@
|
|
|
65
65
|
"browser": "./lib/private/response.client.js",
|
|
66
66
|
"default": "./lib/public/response.js"
|
|
67
67
|
},
|
|
68
|
+
"./session/config": {
|
|
69
|
+
"@primate/source": "./src/public/session/config.ts",
|
|
70
|
+
"browser": "./lib/public/session/config.client.js",
|
|
71
|
+
"default": "./lib/public/session/config.js"
|
|
72
|
+
},
|
|
68
73
|
"./store": {
|
|
69
74
|
"@primate/source": "./src/public/store.ts",
|
|
70
75
|
"browser": "./lib/private/store.client.js",
|