@primate/core 0.6.3 → 0.7.1

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.
Files changed (187) hide show
  1. package/lib/private/App.d.ts +76 -149
  2. package/lib/private/App.js +22 -6
  3. package/lib/private/Flags.d.ts +5 -3
  4. package/lib/private/Flags.js +4 -2
  5. package/lib/private/app/Facade.d.ts +77 -156
  6. package/lib/private/app/Facade.js +4 -1
  7. package/lib/private/build/App.d.ts +4 -2
  8. package/lib/private/build/App.js +13 -4
  9. package/lib/private/build/client/index.js +24 -10
  10. package/lib/private/build/client/plugin/routes.d.ts +4 -0
  11. package/lib/private/build/client/plugin/routes.js +77 -0
  12. package/lib/private/build/hook.js +14 -6
  13. package/lib/private/build/index.d.ts +3 -2
  14. package/lib/private/build/index.js +9 -15
  15. package/lib/private/build/preclient/index.d.ts +3 -0
  16. package/lib/private/build/preclient/index.js +69 -0
  17. package/lib/private/build/preclient/plugin/routes.d.ts +4 -0
  18. package/lib/private/build/preclient/plugin/routes.js +44 -0
  19. package/lib/private/build/server/index.js +8 -5
  20. package/lib/private/build/server/plugin/assets.js +3 -3
  21. package/lib/private/build/server/plugin/native-addons.js +6 -8
  22. package/lib/private/build/server/plugin/node-imports.js +5 -7
  23. package/lib/private/build/server/plugin/route-client.d.ts +4 -0
  24. package/lib/private/build/server/plugin/route-client.js +111 -0
  25. package/lib/private/build/server/plugin/route.js +3 -10
  26. package/lib/private/build/server/plugin/virtual-pages.js +3 -3
  27. package/lib/private/build/server/plugin/virtual-routes.d.ts +2 -1
  28. package/lib/private/build/server/plugin/virtual-routes.js +27 -8
  29. package/lib/private/build/server/plugin/wasm.js +3 -2
  30. package/lib/private/build/shared/intercept.d.ts +4 -0
  31. package/lib/private/build/shared/intercept.js +29 -0
  32. package/lib/private/client/Data.d.ts +1 -1
  33. package/lib/private/client/boot.js +2 -2
  34. package/lib/private/client/create-form.d.ts +11 -1
  35. package/lib/private/client/create-form.js +21 -3
  36. package/lib/private/client/index.d.ts +2 -2
  37. package/lib/private/client/navigate.d.ts +1 -0
  38. package/lib/private/client/navigate.js +7 -6
  39. package/lib/private/client/submit.d.ts +2 -1
  40. package/lib/private/client/submit.js +8 -7
  41. package/lib/private/client/{http.d.ts → transport.d.ts} +3 -3
  42. package/lib/private/client/{http.js → transport.js} +7 -9
  43. package/lib/private/config/schema.d.ts +5 -13
  44. package/lib/private/config/schema.js +1 -5
  45. package/lib/private/db/DB.d.ts +3 -1
  46. package/lib/private/db/MemoryDB.d.ts +5 -2
  47. package/lib/private/db/MemoryDB.js +33 -19
  48. package/lib/private/db/SQLDB.d.ts +23 -0
  49. package/lib/private/db/SQLDB.js +2 -0
  50. package/lib/private/db/errors.d.ts +74 -7
  51. package/lib/private/db/errors.js +31 -7
  52. package/lib/private/db/migrate/apply.js +8 -9
  53. package/lib/private/db/migrate/bundle.js +2 -2
  54. package/lib/private/db/migrate/create.js +18 -20
  55. package/lib/private/db/migrate/status.js +9 -10
  56. package/lib/private/db/migrate/store.d.ts +3 -3
  57. package/lib/private/db/migrate/store.js +5 -5
  58. package/lib/private/db/test.js +256 -115
  59. package/lib/private/db/testSQL.d.ts +50 -0
  60. package/lib/private/db/testSQL.js +196 -0
  61. package/lib/private/errors.d.ts +66 -9
  62. package/lib/private/errors.js +37 -16
  63. package/lib/private/frontend.d.ts +4 -4
  64. package/lib/private/frontend.js +11 -8
  65. package/lib/private/i18n/errors.d.ts +7 -1
  66. package/lib/private/i18n/errors.js +1 -1
  67. package/lib/private/i18n/index/types.d.ts +1 -1
  68. package/lib/private/i18n/locale.d.ts +1 -1
  69. package/lib/private/i18n/module.js +6 -5
  70. package/lib/private/index.d.ts +10 -2
  71. package/lib/private/index.js +13 -1
  72. package/lib/private/logger.d.ts +24 -0
  73. package/lib/private/logger.js +66 -0
  74. package/lib/private/module/Setup.d.ts +3 -0
  75. package/lib/private/module/create.d.ts +2 -1
  76. package/lib/private/module/create.js +4 -0
  77. package/lib/private/paths.d.ts +2 -3
  78. package/lib/private/paths.js +6 -12
  79. package/lib/private/request/ContentType.d.ts +3 -0
  80. package/lib/private/request/ContentType.js +2 -0
  81. package/lib/private/request/RequestBag.d.ts +2 -18
  82. package/lib/private/request/RequestBag.js +4 -16
  83. package/lib/private/request/RequestBody.d.ts +20 -28
  84. package/lib/private/request/RequestBody.js +63 -86
  85. package/lib/private/request/RequestFacade.d.ts +2 -2
  86. package/lib/private/request/handle.js +2 -2
  87. package/lib/private/request/parse.js +2 -4
  88. package/lib/private/request/route.js +15 -8
  89. package/lib/private/response/binary.d.ts +2 -2
  90. package/lib/private/response/binary.js +6 -6
  91. package/lib/private/response/error.js +6 -2
  92. package/lib/private/response/json.js +2 -2
  93. package/lib/private/response/null.d.ts +3 -0
  94. package/lib/private/response/null.js +6 -0
  95. package/lib/private/response/redirect.js +4 -3
  96. package/lib/private/response/respond.js +4 -4
  97. package/lib/private/response/sse.js +2 -2
  98. package/lib/private/response/text.js +2 -2
  99. package/lib/private/route/ContentTypeMap.d.ts +10 -0
  100. package/lib/private/route/ContentTypeMap.js +2 -0
  101. package/lib/private/route/Handler.d.ts +3 -2
  102. package/lib/private/route/NarrowedRequest.d.ts +23 -0
  103. package/lib/private/route/NarrowedRequest.js +2 -0
  104. package/lib/private/route/Options.d.ts +6 -1
  105. package/lib/private/route/Path.d.ts +2 -2
  106. package/lib/private/route/hook.d.ts +3 -1
  107. package/lib/private/route/hook.js +1 -2
  108. package/lib/private/route/router.d.ts +7 -11
  109. package/lib/private/route/router.js +13 -20
  110. package/lib/private/route.client.d.ts +36 -0
  111. package/lib/private/route.client.js +8 -0
  112. package/lib/private/route.d.ts +21 -5
  113. package/lib/private/route.js +21 -5
  114. package/lib/private/serve/App.d.ts +1 -2
  115. package/lib/private/serve/App.js +64 -58
  116. package/lib/private/serve/Init.d.ts +2 -0
  117. package/lib/private/serve/dev-module.js +2 -3
  118. package/lib/private/serve/index.js +5 -6
  119. package/lib/private/server/TAG.d.ts +1 -1
  120. package/lib/private/server/TAG.js +1 -1
  121. package/lib/private/session/index.d.ts +1 -1
  122. package/lib/private/session/index.js +3 -2
  123. package/lib/private/session/module.js +3 -3
  124. package/lib/private/session/schema.d.ts +3 -3
  125. package/lib/private/session/schema.js +4 -3
  126. package/lib/private/store/ExtractRelation.d.ts +7 -0
  127. package/lib/private/store/ExtractRelation.js +2 -0
  128. package/lib/private/store/ExtractSchema.d.ts +10 -0
  129. package/lib/private/{orm → store}/ForeignKey.d.ts +1 -1
  130. package/lib/private/store/Init.d.ts +13 -0
  131. package/lib/private/store/Init.js +2 -0
  132. package/lib/private/{orm/store.d.ts → store/Store.d.ts} +50 -50
  133. package/lib/private/{orm/store.js → store/Store.js} +163 -107
  134. package/lib/private/store/StoreInput.d.ts +11 -0
  135. package/lib/private/store/key.d.ts +8 -0
  136. package/lib/private/store/key.js +8 -0
  137. package/lib/private/{orm → store}/parse.d.ts +3 -3
  138. package/lib/private/{orm → store}/parse.js +7 -2
  139. package/lib/private/store/relation.d.ts +29 -0
  140. package/lib/private/store/relation.js +26 -0
  141. package/lib/private/store.d.ts +24 -0
  142. package/lib/private/store.js +10 -0
  143. package/lib/public/db/errors.d.ts +1 -1
  144. package/lib/public/db/errors.js +1 -1
  145. package/lib/public/db/testSQL.d.ts +2 -0
  146. package/lib/public/db/testSQL.js +2 -0
  147. package/lib/public/db.d.ts +1 -0
  148. package/lib/public/index.d.ts +1 -0
  149. package/lib/public/index.js +1 -1
  150. package/lib/public/response.d.ts +6 -6
  151. package/lib/public/response.js +4 -1
  152. package/lib/public/route.client.d.ts +2 -0
  153. package/lib/public/route.client.js +2 -0
  154. package/lib/public/store.d.ts +2 -0
  155. package/lib/public/store.js +2 -0
  156. package/package.json +24 -17
  157. package/lib/private/bye.d.ts +0 -3
  158. package/lib/private/bye.js +0 -4
  159. package/lib/private/log.d.ts +0 -20
  160. package/lib/private/log.js +0 -47
  161. package/lib/private/orm/ExtractSchema.d.ts +0 -9
  162. package/lib/private/orm/StoreInput.d.ts +0 -10
  163. package/lib/private/orm/key.d.ts +0 -8
  164. package/lib/private/orm/key.js +0 -8
  165. package/lib/private/orm/relation.d.ts +0 -43
  166. package/lib/private/orm/relation.js +0 -26
  167. package/lib/private/request/Verb.d.ts +0 -4
  168. package/lib/private/request/Verb.js +0 -2
  169. package/lib/private/request/verbs.d.ts +0 -3
  170. package/lib/private/request/verbs.js +0 -12
  171. package/lib/private/route/wrap.d.ts +0 -2
  172. package/lib/private/route/wrap.js +0 -12
  173. package/lib/public/log.d.ts +0 -2
  174. package/lib/public/log.js +0 -2
  175. package/lib/public/orm/key.d.ts +0 -2
  176. package/lib/public/orm/key.js +0 -2
  177. package/lib/public/orm/relation.d.ts +0 -2
  178. package/lib/public/orm/relation.js +0 -2
  179. package/lib/public/orm/store.d.ts +0 -2
  180. package/lib/public/orm/store.js +0 -2
  181. package/lib/public/request/verbs.d.ts +0 -2
  182. package/lib/public/request/verbs.js +0 -2
  183. /package/lib/private/{orm → store}/ExtractSchema.js +0 -0
  184. /package/lib/private/{orm → store}/ForeignKey.js +0 -0
  185. /package/lib/private/{orm → store}/PrimaryKey.d.ts +0 -0
  186. /package/lib/private/{orm → store}/PrimaryKey.js +0 -0
  187. /package/lib/private/{orm → store}/StoreInput.js +0 -0
@@ -0,0 +1,10 @@
1
+ import key from "#store/key";
2
+ import relation from "#store/relation";
3
+ import Store from "#store/Store";
4
+ function store(init) {
5
+ return new Store(init);
6
+ }
7
+ store.key = key;
8
+ store.relation = relation;
9
+ export default store;
10
+ //# sourceMappingURL=store.js.map
@@ -1,2 +1,2 @@
1
- export { default } from "#db/errors";
1
+ export { default, Code } from "#db/errors";
2
2
  //# sourceMappingURL=errors.d.ts.map
@@ -1,2 +1,2 @@
1
- export { default } from "#db/errors";
1
+ export { default, Code } from "#db/errors";
2
2
  //# sourceMappingURL=errors.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#db/testSQL";
2
+ //# sourceMappingURL=testSQL.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#db/testSQL";
2
+ //# sourceMappingURL=testSQL.js.map
@@ -5,6 +5,7 @@ export type { default as PK } from "#db/PK";
5
5
  export type { default as ReadArgs } from "#db/ReadArgs";
6
6
  export type { default as ReadRelationsArgs } from "#db/ReadRelationsArgs";
7
7
  export type { default as Sort } from "#db/Sort";
8
+ export type { ExtractPlaceholders, default as SQLDB, SQLInput, SQLOutput, CheckPlaceholders, } from "#db/SQLDB";
8
9
  export type { default as TypeMap } from "#db/TypeMap";
9
10
  export type { default as Types } from "#db/Types";
10
11
  export type { default as With } from "#db/With";
@@ -1,2 +1,3 @@
1
1
  export type * from "#index";
2
+ export { default } from "#index";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export { default } from "#index";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,13 +1,12 @@
1
1
  import binary from "#response/binary";
2
2
  import error from "#response/error";
3
3
  import view from "#response/view";
4
- export type { default as ResponseFunction } from "#response/ResponseFunction";
5
- export type { default as ResponseLike } from "#response/ResponseLike";
6
- declare const _default: {
4
+ import $null from "#response/null";
5
+ declare const response: {
7
6
  binary: typeof binary;
8
7
  error: typeof error;
9
8
  json: (body: unknown, init?: ResponseInit) => (app: import("./index.js").ServeApp) => import("@rcompat/type").MaybePromise<Response>;
10
- redirect: (location: string, status?: 302 | 301 | 300 | 304 | 308 | 303 | 307) => import("#response/ResponseFunction").default;
9
+ redirect: (location: string, status?: 302 | 301 | 300 | 304 | 308 | 303 | 307) => import("./index.js").ResponseFunction;
11
10
  sse: (body: {
12
11
  close?(): undefined;
13
12
  open(events: {
@@ -16,7 +15,8 @@ declare const _default: {
16
15
  }, init?: ResponseInit) => (app: import("./index.js").ServeApp) => import("@rcompat/type").MaybePromise<Response>;
17
16
  text: (body: string, init?: ResponseInit) => (app: import("./index.js").ServeApp) => import("@rcompat/type").MaybePromise<Response>;
18
17
  view: typeof view;
19
- ws: (actions: import("@rcompat/http").Actions) => import("#response/ResponseFunction").default;
18
+ ws: (actions: import("@rcompat/http").Actions) => import("./index.js").ResponseFunction;
19
+ null: typeof $null;
20
20
  };
21
- export default _default;
21
+ export default response;
22
22
  //# sourceMappingURL=response.d.ts.map
@@ -6,7 +6,8 @@ import sse from "#response/sse";
6
6
  import text from "#response/text";
7
7
  import view from "#response/view";
8
8
  import ws from "#response/ws";
9
- export default {
9
+ import $null from "#response/null";
10
+ const response = {
10
11
  binary,
11
12
  error,
12
13
  json,
@@ -15,5 +16,7 @@ export default {
15
16
  text,
16
17
  view,
17
18
  ws,
19
+ null: $null,
18
20
  };
21
+ export default response;
19
22
  //# sourceMappingURL=response.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#route.client";
2
+ //# sourceMappingURL=route.client.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#route.client";
2
+ //# sourceMappingURL=route.client.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#store";
2
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#store";
2
+ //# sourceMappingURL=store.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/core",
3
- "version": "0.6.3",
3
+ "version": "0.7.1",
4
4
  "description": "The universal web framework",
5
5
  "homepage": "https://primate.run",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
@@ -18,23 +18,24 @@
18
18
  "!/**/*.spec.*"
19
19
  ],
20
20
  "dependencies": {
21
- "@rcompat/assert": "^0.8.1",
22
- "@rcompat/cli": "^0.18.1",
23
- "@rcompat/crypto": "^0.16.1",
24
- "@rcompat/dict": "^0.5.1",
25
- "@rcompat/env": "^0.17.2",
26
- "@rcompat/error": "^0.3.1",
27
- "@rcompat/fn": "^0.5.1",
28
- "@rcompat/fs": "^0.28.1",
29
- "@rcompat/http": "^0.25.1",
30
- "@rcompat/io": "^0.5.1",
31
- "@rcompat/is": "^0.6.1",
32
- "@rcompat/kv": "^0.8.1",
33
- "@rcompat/runtime": "^0.11.1",
34
- "@rcompat/string": "^0.16.1",
35
- "@rcompat/type": "^0.11.1",
21
+ "@rcompat/assert": "^0.13.0",
22
+ "@rcompat/cli": "^0.24.0",
23
+ "@rcompat/crypto": "^0.21.0",
24
+ "@rcompat/dict": "^0.10.0",
25
+ "@rcompat/env": "^0.22.0",
26
+ "@rcompat/error": "^0.8.0",
27
+ "@rcompat/fn": "^0.10.0",
28
+ "@rcompat/fs": "^0.33.2",
29
+ "@rcompat/http": "^0.30.0",
30
+ "@rcompat/io": "^0.10.0",
31
+ "@rcompat/is": "^0.11.0",
32
+ "@rcompat/kv": "^0.13.0",
33
+ "@rcompat/runtime": "^0.16.0",
34
+ "@rcompat/string": "^0.21.0",
35
+ "@rcompat/symbol": "^0.2.0",
36
+ "@rcompat/type": "^0.17.0",
36
37
  "esbuild": "^0.28.0",
37
- "pema": "^0.6.0"
38
+ "pema": "^0.7.0"
38
39
  },
39
40
  "imports": {
40
41
  "#i18n/index": {
@@ -53,6 +54,12 @@
53
54
  "browser": "./lib/private/app/Facade.browser.js",
54
55
  "default": "./lib/public/AppFacade.js"
55
56
  },
57
+ "./route": {
58
+ "types": "./lib/public/route.client.js",
59
+ "@primate/source": "./src/public/route.ts",
60
+ "browser": "./lib/public/route.client.js",
61
+ "default": "./lib/public/route.js"
62
+ },
56
63
  "./*": {
57
64
  "@primate/source": "./src/public/*.ts",
58
65
  "default": "./lib/public/*.js"
@@ -1,3 +0,0 @@
1
- declare const _default: () => boolean;
2
- export default _default;
3
- //# sourceMappingURL=bye.d.ts.map
@@ -1,4 +0,0 @@
1
- import color from "@rcompat/cli/color";
2
- import print from "@rcompat/cli/print";
3
- export default () => print(color.dim(color.yellow("~~ bye\n")));
4
- //# sourceMappingURL=bye.js.map
@@ -1,20 +0,0 @@
1
- declare const levels: {
2
- readonly error: 0;
3
- readonly info: 2;
4
- readonly warn: 1;
5
- };
6
- type Levels = typeof levels;
7
- type Level = keyof Levels;
8
- type N = Levels[Level];
9
- declare class Log {
10
- #private;
11
- constructor(level: N);
12
- print(message: string, ...params: unknown[]): void;
13
- system(message: string, ...params: unknown[]): void;
14
- info(message: string, ...params: unknown[]): void;
15
- warn(message: string, ...params: unknown[]): void;
16
- error(error: unknown): void;
17
- }
18
- declare const _default: Log;
19
- export default _default;
20
- //# sourceMappingURL=log.d.ts.map
@@ -1,47 +0,0 @@
1
- import color from "@rcompat/cli/color";
2
- import mark from "@rcompat/cli/mark";
3
- import print from "@rcompat/cli/print";
4
- import { CodeError } from "@rcompat/error";
5
- import runtime from "@rcompat/runtime";
6
- import p from "pema";
7
- const levels = {
8
- error: 0,
9
- info: 2,
10
- warn: 1,
11
- };
12
- const flag = "--log=";
13
- const n = runtime.args.find(arg => arg.startsWith(flag))?.slice(flag.length);
14
- const vn = p.union(...Object.keys(levels)).optional().parse(n);
15
- class Log {
16
- #level;
17
- constructor(level) {
18
- this.#level = level;
19
- }
20
- print(message, ...params) {
21
- print(mark(message, ...params));
22
- }
23
- system(message, ...params) {
24
- print(` ${mark(message, ...params)}\n`);
25
- }
26
- info(message, ...params) {
27
- if (this.#level === levels.info) {
28
- print(color.green("[INFO]"), mark(message, ...params), "\n");
29
- }
30
- }
31
- warn(message, ...params) {
32
- if (this.#level >= levels.warn) {
33
- print(color.yellow("[WARN]"), mark(message, ...params), "\n");
34
- }
35
- }
36
- error(error) {
37
- if (CodeError.is(error)) {
38
- const message = error.strings.reduce((acc, str, i) => acc + (i > 0 ? color.bold(String(error.params[i - 1])) : "") + str, "");
39
- print(color.red("[ERROR]"), message, "\n");
40
- }
41
- else {
42
- console.error(error);
43
- }
44
- }
45
- }
46
- export default new Log(n === undefined ? levels.warn : levels[vn]);
47
- //# sourceMappingURL=log.js.map
@@ -1,9 +0,0 @@
1
- import type ForeignKey from "#orm/ForeignKey";
2
- import type PrimaryKey from "#orm/PrimaryKey";
3
- import type StoreInput from "#orm/StoreInput";
4
- import type { DataKey, Storable } from "pema";
5
- type ExtractSchema<T extends StoreInput> = {
6
- [K in keyof T]: T[K] extends PrimaryKey<infer P> ? P : T[K] extends ForeignKey<infer P> ? P : T[K] extends Storable<DataKey> ? T[K] : never;
7
- };
8
- export type { ExtractSchema as default };
9
- //# sourceMappingURL=ExtractSchema.d.ts.map
@@ -1,10 +0,0 @@
1
- import type ForeignKey from "#orm/ForeignKey";
2
- import type { AllowedFKType } from "#orm/ForeignKey";
3
- import type PrimaryKey from "#orm/PrimaryKey";
4
- import type { AllowedPKType } from "#orm/PrimaryKey";
5
- import type { Dict } from "@rcompat/type";
6
- import type { DataKey, Storable } from "pema";
7
- type StoreField = Storable<DataKey> | PrimaryKey<AllowedPKType> | ForeignKey<AllowedFKType>;
8
- type StoreInput = Dict<StoreField>;
9
- export type { StoreInput as default };
10
- //# sourceMappingURL=StoreInput.d.ts.map
@@ -1,8 +0,0 @@
1
- import ForeignKey from "#orm/ForeignKey";
2
- import PrimaryKey from "#orm/PrimaryKey";
3
- declare const key: {
4
- foreign: typeof ForeignKey.new;
5
- primary: typeof PrimaryKey.new;
6
- };
7
- export default key;
8
- //# sourceMappingURL=key.d.ts.map
@@ -1,8 +0,0 @@
1
- import ForeignKey from "#orm/ForeignKey";
2
- import PrimaryKey from "#orm/PrimaryKey";
3
- const key = {
4
- foreign: ForeignKey.new,
5
- primary: PrimaryKey.new,
6
- };
7
- export default key;
8
- //# sourceMappingURL=key.js.map
@@ -1,43 +0,0 @@
1
- import type { Store } from "#orm/store";
2
- import type StoreInput from "#orm/StoreInput";
3
- /**
4
- * extracts schema type from either a schema or a Store.
5
- */
6
- type SchemaOf<T> = T extends Store<infer S, any> ? S : T;
7
- /**
8
- * One relation (singular) - returns single record or null
9
- *
10
- * Normal: FK is on the OTHER table, pointing to this table's PK.
11
- * Author has one Profile -> Profile has author_id
12
- *
13
- * Reverse: FK is on THIS table, pointing to other table's PK.
14
- * Profile belongs to Author -> Profile has author_id
15
- */
16
- export type OneRelation<T extends StoreInput, FK extends string> = {
17
- type: "one";
18
- schema: T;
19
- fk: FK;
20
- reverse: boolean;
21
- };
22
- /**
23
- * Many relation (plural) - returns array of records
24
- *
25
- * FK is always on the OTHER table, pointing to this table's PK.
26
- * Example: Author has many Articles → Article has author_id
27
- */
28
- export type ManyRelation<T extends StoreInput, FK extends string> = {
29
- type: "many";
30
- schema: T;
31
- fk: FK;
32
- };
33
- export type Relation = OneRelation<any, string> | ManyRelation<any, string>;
34
- declare function one<T extends StoreInput | Store<StoreInput, any>, FK extends string>(input: T, fk: FK, options?: {
35
- reverse?: boolean;
36
- }): OneRelation<SchemaOf<T>, FK>;
37
- declare function many<T extends StoreInput | Store<StoreInput, any>, FK extends string>(input: T, fk: FK): ManyRelation<SchemaOf<T>, FK>;
38
- declare const _default: {
39
- one: typeof one;
40
- many: typeof many;
41
- };
42
- export default _default;
43
- //# sourceMappingURL=relation.d.ts.map
@@ -1,26 +0,0 @@
1
- import is from "@rcompat/is";
2
- function is_store(value) {
3
- return is.dict(value) && "schema" in value && is.function(value.get);
4
- }
5
- function extract_schema(schema_or_store) {
6
- return (is_store(schema_or_store)
7
- ? schema_or_store.schema
8
- : schema_or_store);
9
- }
10
- function one(input, fk, options) {
11
- return {
12
- type: "one",
13
- schema: extract_schema(input),
14
- fk,
15
- reverse: options?.reverse ?? false,
16
- };
17
- }
18
- function many(input, fk) {
19
- return {
20
- type: "many",
21
- schema: extract_schema(input),
22
- fk,
23
- };
24
- }
25
- export default { one, many };
26
- //# sourceMappingURL=relation.js.map
@@ -1,4 +0,0 @@
1
- import type verbs from "#request/verbs";
2
- type Verb = typeof verbs[number];
3
- export type { Verb as default };
4
- //# sourceMappingURL=Verb.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Verb.js.map
@@ -1,3 +0,0 @@
1
- declare const _default: readonly ["get", "post", "put", "delete", "head", "connect", "options", "trace", "patch"];
2
- export default _default;
3
- //# sourceMappingURL=verbs.d.ts.map
@@ -1,12 +0,0 @@
1
- export default [
2
- "get",
3
- "post",
4
- "put",
5
- "delete",
6
- "head",
7
- "connect",
8
- "options",
9
- "trace",
10
- "patch",
11
- ];
12
- //# sourceMappingURL=verbs.js.map
@@ -1,2 +0,0 @@
1
- export default function wrap(code: string, path: string, build_id: string): string;
2
- //# sourceMappingURL=wrap.d.ts.map
@@ -1,12 +0,0 @@
1
- import string from "@rcompat/string";
2
- export default function wrap(code, path, build_id) {
3
- const router = `ROUTER_${build_id}`;
4
- const prelude = string.dedent `
5
- import ${router} from "primate/router";
6
- ${router}.push("${path}");
7
- `;
8
- const postlude = `\n${router}.pop();\n`;
9
- return `${prelude}${code}${postlude}`;
10
- }
11
- ;
12
- //# sourceMappingURL=wrap.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#log";
2
- //# sourceMappingURL=log.d.ts.map
package/lib/public/log.js DELETED
@@ -1,2 +0,0 @@
1
- export { default } from "#log";
2
- //# sourceMappingURL=log.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#orm/key";
2
- //# sourceMappingURL=key.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#orm/key";
2
- //# sourceMappingURL=key.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#orm/relation";
2
- //# sourceMappingURL=relation.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#orm/relation";
2
- //# sourceMappingURL=relation.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#orm/store";
2
- //# sourceMappingURL=store.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#orm/store";
2
- //# sourceMappingURL=store.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#request/verbs";
2
- //# sourceMappingURL=verbs.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#request/verbs";
2
- //# sourceMappingURL=verbs.js.map
File without changes
File without changes
File without changes
File without changes
File without changes