crelte 0.5.8 → 0.5.10

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 (175) hide show
  1. package/dist/blocks/Blocks.d.ts +41 -4
  2. package/dist/blocks/Blocks.d.ts.map +1 -1
  3. package/dist/blocks/Blocks.js +47 -2
  4. package/dist/blocks/Blocks.svelte +2 -16
  5. package/dist/blocks/Blocks.svelte.d.ts +20 -37
  6. package/dist/blocks/Blocks.svelte.d.ts.map +1 -1
  7. package/dist/blocks/index.d.ts +2 -2
  8. package/dist/blocks/index.d.ts.map +1 -1
  9. package/dist/blocks/index.js +2 -2
  10. package/dist/cookies/ServerCookies.d.ts +1 -1
  11. package/dist/cookies/ServerCookies.js +1 -1
  12. package/dist/cookies/index.d.ts +1 -1
  13. package/dist/crelte.d.ts +21 -10
  14. package/dist/crelte.d.ts.map +1 -1
  15. package/dist/index.d.ts +19 -14
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +17 -13
  18. package/dist/init/client.d.ts +2 -2
  19. package/dist/init/client.d.ts.map +1 -1
  20. package/dist/init/client.js +3 -2
  21. package/dist/init/server.d.ts +7 -6
  22. package/dist/init/server.d.ts.map +1 -1
  23. package/dist/init/server.js +6 -6
  24. package/dist/loadData/Globals.d.ts +3 -3
  25. package/dist/loadData/Globals.js +3 -3
  26. package/dist/loadData/loadData.d.ts +8 -18
  27. package/dist/loadData/loadData.d.ts.map +1 -1
  28. package/dist/loadData/loadData.js +2 -2
  29. package/dist/node/index.d.ts +5 -0
  30. package/dist/node/index.d.ts.map +1 -1
  31. package/dist/node/index.js +84 -35
  32. package/dist/plugins/Events.d.ts +4 -4
  33. package/dist/plugins/Plugins.d.ts +2 -2
  34. package/dist/plugins/index.d.ts +2 -3
  35. package/dist/plugins/index.d.ts.map +1 -1
  36. package/dist/plugins/index.js +2 -1
  37. package/dist/queries/Queries.d.ts +9 -0
  38. package/dist/queries/Queries.d.ts.map +1 -1
  39. package/dist/queries/Queries.js +29 -17
  40. package/dist/queries/QueryError.d.ts +2 -0
  41. package/dist/queries/QueryError.d.ts.map +1 -1
  42. package/dist/queries/QueryError.js +6 -1
  43. package/dist/queries/gql.d.ts +2 -2
  44. package/dist/queries/gql.js +2 -2
  45. package/dist/queries/index.d.ts +7 -5
  46. package/dist/queries/index.d.ts.map +1 -1
  47. package/dist/queries/vars.d.ts +7 -7
  48. package/dist/queries/vars.d.ts.map +1 -1
  49. package/dist/queries/vars.js +10 -8
  50. package/dist/routing/LoadRunner.d.ts +1 -1
  51. package/dist/routing/LoadRunner.js +1 -1
  52. package/dist/routing/index.d.ts +4 -4
  53. package/dist/routing/index.d.ts.map +1 -1
  54. package/dist/routing/route/BaseRoute.d.ts +25 -25
  55. package/dist/routing/route/BaseRoute.js +24 -24
  56. package/dist/routing/route/Request.d.ts +4 -4
  57. package/dist/routing/route/Request.js +4 -4
  58. package/dist/routing/route/Route.d.ts +2 -2
  59. package/dist/routing/route/Route.js +2 -2
  60. package/dist/routing/router/BaseRouter.d.ts +4 -4
  61. package/dist/routing/router/BaseRouter.js +3 -3
  62. package/dist/routing/router/ClientRouter.d.ts +1 -1
  63. package/dist/routing/router/ClientRouter.js +1 -1
  64. package/dist/routing/router/Router.d.ts +27 -25
  65. package/dist/routing/router/Router.d.ts.map +1 -1
  66. package/dist/routing/router/Router.js +24 -21
  67. package/dist/routing/router/ServerRouter.d.ts +1 -1
  68. package/dist/routing/router/ServerRouter.js +1 -1
  69. package/dist/server/CrelteServer.d.ts +5 -5
  70. package/dist/server/CrelteServer.d.ts.map +1 -1
  71. package/dist/server/CrelteServer.js +4 -4
  72. package/dist/server/Request.d.ts +7 -1
  73. package/dist/server/Request.d.ts.map +1 -1
  74. package/dist/server/Request.js +7 -1
  75. package/dist/server/ServerRouter.d.ts +1 -1
  76. package/dist/server/ServerRouter.d.ts.map +1 -1
  77. package/dist/server/index.d.ts +4 -4
  78. package/dist/server/index.d.ts.map +1 -1
  79. package/dist/server/index.js +1 -1
  80. package/dist/server/shared.d.ts +7 -13
  81. package/dist/server/shared.d.ts.map +1 -1
  82. package/dist/server/shared.js +14 -16
  83. package/dist/ssr/SsrCache.d.ts +56 -4
  84. package/dist/ssr/SsrCache.d.ts.map +1 -1
  85. package/dist/ssr/SsrCache.js +94 -20
  86. package/dist/std/index.d.ts +13 -0
  87. package/dist/std/index.d.ts.map +1 -1
  88. package/dist/std/index.js +13 -0
  89. package/dist/std/rand/index.d.ts +34 -0
  90. package/dist/std/rand/index.d.ts.map +1 -0
  91. package/dist/std/rand/index.js +45 -0
  92. package/dist/std/rand/internal.d.ts +8 -0
  93. package/dist/std/rand/internal.d.ts.map +1 -0
  94. package/dist/std/rand/internal.js +15 -0
  95. package/dist/std/stores/Writable.d.ts +1 -1
  96. package/dist/std/stores/Writable.js +1 -1
  97. package/dist/translations/index.d.ts +28 -0
  98. package/dist/translations/index.d.ts.map +1 -0
  99. package/dist/translations/index.js +31 -0
  100. package/dist/translations/loadTranslations.d.ts +23 -0
  101. package/dist/translations/loadTranslations.d.ts.map +1 -0
  102. package/dist/translations/loadTranslations.js +26 -0
  103. package/dist/translations/loader/GlobalLoader.d.ts +34 -0
  104. package/dist/translations/loader/GlobalLoader.d.ts.map +1 -0
  105. package/dist/translations/loader/GlobalLoader.js +45 -0
  106. package/dist/translations/loader/fileLoader/ClientFileLoader.d.ts +10 -0
  107. package/dist/translations/loader/fileLoader/ClientFileLoader.d.ts.map +1 -0
  108. package/dist/translations/loader/fileLoader/ClientFileLoader.js +24 -0
  109. package/dist/translations/loader/fileLoader/NodeFileLoader.d.ts +9 -0
  110. package/dist/translations/loader/fileLoader/NodeFileLoader.d.ts.map +1 -0
  111. package/dist/translations/loader/fileLoader/NodeFileLoader.js +21 -0
  112. package/dist/translations/loader/fileLoader/fileLoader.d.ts +5 -0
  113. package/dist/translations/loader/fileLoader/fileLoader.d.ts.map +1 -0
  114. package/dist/translations/loader/fileLoader/fileLoader.js +16 -0
  115. package/dist/translations/loader/index.d.ts +7 -0
  116. package/dist/translations/loader/index.d.ts.map +1 -0
  117. package/dist/translations/loader/index.js +1 -0
  118. package/dist/translations/translationsPlugin.d.ts +64 -0
  119. package/dist/translations/translationsPlugin.d.ts.map +1 -0
  120. package/dist/translations/translationsPlugin.js +110 -0
  121. package/dist/translations/utils.d.ts +8 -0
  122. package/dist/translations/utils.d.ts.map +1 -0
  123. package/dist/translations/utils.js +15 -0
  124. package/dist/vite/index.d.ts.map +1 -1
  125. package/dist/vite/index.js +30 -38
  126. package/package.json +9 -1
  127. package/src/blocks/Blocks.svelte +3 -78
  128. package/src/blocks/Blocks.ts +63 -6
  129. package/src/blocks/index.ts +2 -2
  130. package/src/cookies/ServerCookies.ts +1 -1
  131. package/src/cookies/index.ts +1 -1
  132. package/src/crelte.ts +21 -10
  133. package/src/index.ts +19 -14
  134. package/src/init/client.ts +3 -2
  135. package/src/init/server.ts +14 -8
  136. package/src/loadData/Globals.ts +3 -3
  137. package/src/loadData/loadData.ts +8 -18
  138. package/src/node/index.ts +100 -39
  139. package/src/plugins/Events.ts +4 -4
  140. package/src/plugins/Plugins.ts +2 -2
  141. package/src/plugins/index.ts +2 -3
  142. package/src/queries/Queries.ts +35 -18
  143. package/src/queries/QueryError.ts +10 -1
  144. package/src/queries/gql.ts +2 -2
  145. package/src/queries/index.ts +7 -4
  146. package/src/queries/vars.ts +12 -8
  147. package/src/routing/LoadRunner.ts +1 -1
  148. package/src/routing/index.ts +13 -3
  149. package/src/routing/route/BaseRoute.ts +25 -25
  150. package/src/routing/route/Request.ts +4 -4
  151. package/src/routing/route/Route.ts +2 -2
  152. package/src/routing/router/BaseRouter.ts +4 -4
  153. package/src/routing/router/ClientRouter.ts +1 -1
  154. package/src/routing/router/Router.ts +28 -25
  155. package/src/routing/router/ServerRouter.ts +1 -1
  156. package/src/server/CrelteServer.ts +5 -5
  157. package/src/server/Request.ts +7 -1
  158. package/src/server/ServerRouter.ts +1 -2
  159. package/src/server/index.ts +17 -3
  160. package/src/server/shared.ts +28 -33
  161. package/src/ssr/SsrCache.ts +104 -22
  162. package/src/std/index.ts +14 -0
  163. package/src/std/rand/index.ts +55 -0
  164. package/src/std/rand/internal.ts +17 -0
  165. package/src/std/stores/Writable.ts +1 -1
  166. package/src/translations/index.ts +56 -0
  167. package/src/translations/loadTranslations.ts +33 -0
  168. package/src/translations/loader/GlobalLoader.ts +62 -0
  169. package/src/translations/loader/fileLoader/ClientFileLoader.ts +40 -0
  170. package/src/translations/loader/fileLoader/NodeFileLoader.ts +32 -0
  171. package/src/translations/loader/fileLoader/fileLoader.ts +19 -0
  172. package/src/translations/loader/index.ts +8 -0
  173. package/src/translations/translationsPlugin.ts +145 -0
  174. package/src/translations/utils.ts +17 -0
  175. package/src/vite/index.ts +43 -39
@@ -22,6 +22,15 @@ export default class Queries {
22
22
  this.route = route;
23
23
  this.request = request;
24
24
  }
25
+ /**
26
+ * Create a new Queries instance
27
+ *
28
+ * @param endpoint the craft GraphQl endpoint
29
+ * @param frontend the frontend url where the server queries are reachable
30
+ * @param ssrCache the ssrCache to use for caching
31
+ * @param opts options
32
+ * @returns
33
+ */
25
34
  static new(endpoint, frontend, ssrCache, opts = {}) {
26
35
  return new Queries(new Inner(endpoint, frontend, ssrCache, opts), opts?.route ?? null, null);
27
36
  }
@@ -44,6 +53,7 @@ export default class Queries {
44
53
  // for convenience we set the siteId as variable if it is known
45
54
  if (siteId !== null)
46
55
  vars = { siteId, ...vars };
56
+ // todo, maybe we should set the XCraftSiteId, with the siteId from vars?
47
57
  return this.inner.query(query, vars, {
48
58
  previewToken,
49
59
  siteToken,
@@ -104,24 +114,20 @@ class Inner {
104
114
  if (key) {
105
115
  // todo maybe we should objClone here?
106
116
  this.ssrCache.set(key, resp);
107
- // ! because the listeners get's in the previous if statement and will
108
- // always be set when the key is set
117
+ // ! (never null) because the listeners get's in the previous
118
+ // if statement and will always be set when the key is set
109
119
  const listeners = this.listeners.get(key);
110
- listeners.forEach(([resolve, _error]) => {
111
- resolve(resp);
112
- });
120
+ listeners.forEach(([resolve, _error]) => resolve(resp));
113
121
  this.listeners.delete(key);
114
122
  }
115
123
  return resp;
116
124
  }
117
125
  catch (e) {
118
126
  if (key) {
119
- // ! because the listeners get's in the previous if statement and will
120
- // always be set when the key is set
127
+ // ! (never null) because the listeners get's in the previous
128
+ // if statement and will always be set when the key is set
121
129
  const listeners = this.listeners.get(key);
122
- listeners.forEach(([_resolve, error]) => {
123
- error(e);
124
- });
130
+ listeners.forEach(([_resolve, error]) => error(e));
125
131
  this.listeners.delete(key);
126
132
  }
127
133
  throw e;
@@ -163,11 +169,17 @@ class Inner {
163
169
  else {
164
170
  body = { query: query.query, variables: vars };
165
171
  }
166
- const resp = await fetch(url, {
167
- method: 'POST',
168
- headers,
169
- body: JSON.stringify(body),
170
- });
172
+ let resp;
173
+ try {
174
+ resp = await fetch(url, {
175
+ method: 'POST',
176
+ headers,
177
+ body: JSON.stringify(body),
178
+ });
179
+ }
180
+ catch (e) {
181
+ throw new Error(`query to '${url}' failed with: ${e.message}`);
182
+ }
171
183
  if (!resp.ok) {
172
184
  throw new QueryError({ status: resp.status, body: await resp.text() }, 'resp not ok');
173
185
  }
@@ -184,8 +196,8 @@ class Inner {
184
196
  throw new QueryError({ status: resp.status }, e);
185
197
  }
186
198
  if ('errors' in jsonResp) {
187
- console.log(logName + ' errors', jsonResp.errors);
188
- throw new QueryError({ status: resp.status }, jsonResp.errors);
199
+ console.error(logName + ' errors', jsonResp.errors);
200
+ throw new QueryError({ status: resp.status, errors: jsonResp.errors }, 'received errors');
189
201
  }
190
202
  return jsonResp.data ?? null;
191
203
  }
@@ -1,6 +1,7 @@
1
1
  export type QueryErrorResponse = {
2
2
  status?: number;
3
3
  body?: string;
4
+ errors?: any[];
4
5
  };
5
6
  /**
6
7
  * A QueryError error
@@ -19,4 +20,5 @@ export default class QueryError extends Error {
19
20
  */
20
21
  get message(): string;
21
22
  }
23
+ export declare function isQueryError(err: any): err is QueryError;
22
24
  //# sourceMappingURL=QueryError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryError.d.ts","sourceRoot":"","sources":["../../src/queries/QueryError.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAGF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,KAAK;IAC5C,IAAI,EAAE,kBAAkB,CAAC;IACzB,GAAG,EAAE,GAAG,CAAC;gBAGG,IAAI,EAAE,kBAAkB,EAAE,GAAG,GAAE,GAAU;IAOrD;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB,cAAc;IAEd;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;CACD"}
1
+ {"version":3,"file":"QueryError.d.ts","sourceRoot":"","sources":["../../src/queries/QueryError.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;CACf,CAAC;AAGF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,KAAK;IAC5C,IAAI,EAAE,kBAAkB,CAAC;IACzB,GAAG,EAAE,GAAG,CAAC;gBAGG,IAAI,EAAE,kBAAkB,EAAE,GAAG,GAAE,GAAU;IAOrD;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB,cAAc;IAEd;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;CACD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,UAAU,CAMxD"}
@@ -22,6 +22,11 @@ export default class QueryError extends Error {
22
22
  * The error message in string form
23
23
  */
24
24
  get message() {
25
- return 'QueryError: ' + JSON.stringify(this.resp);
25
+ return 'QueryError: ' + JSON.stringify(this.resp, null, ' ');
26
26
  }
27
27
  }
28
+ export function isQueryError(err) {
29
+ return (typeof err === 'object' &&
30
+ err !== null &&
31
+ typeof err.__QueryError__ === 'function');
32
+ }
@@ -4,8 +4,8 @@ import { Query } from './Queries.js';
4
4
  * @param strings
5
5
  * @param keys
6
6
  *
7
- * ## Example
8
- * ```
7
+ * #### Example
8
+ * ```js
9
9
  * const query = gql`query ($id: ID!) { page(id: $id) { id } }`;
10
10
  * ```
11
11
  */
@@ -4,8 +4,8 @@ import { isQuery } from './Queries.js';
4
4
  * @param strings
5
5
  * @param keys
6
6
  *
7
- * ## Example
8
- * ```
7
+ * #### Example
8
+ * ```js
9
9
  * const query = gql`query ($id: ID!) { page(id: $id) { id } }`;
10
10
  * ```
11
11
  */
@@ -1,14 +1,16 @@
1
1
  import Queries, { isQuery, QueriesOptions, Query, QueryOptions } from '../queries/Queries.js';
2
2
  import { gql } from './gql.js';
3
- import QueryError from './QueryError.js';
3
+ import QueryError, { QueryErrorResponse } from './QueryError.js';
4
4
  import { QueryVar, ValidIf, vars, varsIdsEqual } from './vars.js';
5
- export { Queries, type QueriesOptions, type QueryOptions, type Query, isQuery, QueryError, gql, vars, type ValidIf, QueryVar, varsIdsEqual, };
6
- type InferQueryVarType<T> = T extends QueryVar<infer U> ? U : never;
7
- type InferVariableTypes<T> = {
5
+ export { Queries, type QueriesOptions, type QueryOptions, type Query, isQuery, QueryError, type QueryErrorResponse, gql, vars, type ValidIf, QueryVar, varsIdsEqual, };
6
+ /** @hidden */
7
+ export type InferQueryVarType<T> = T extends QueryVar<infer U> ? U : never;
8
+ /** @hidden */
9
+ export type InferVariableTypes<T> = {
8
10
  [K in keyof T]: InferQueryVarType<T[K]>;
9
11
  };
10
12
  /**
11
- * ## Example
13
+ * #### Example
12
14
  * ```ts
13
15
  * import { vars, Caching } from 'crelte/queries';
14
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/queries/index.ts"],"names":[],"mappings":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AAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EACN,OAAO,EACP,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,OAAO,EACP,UAAU,EACV,KAAK,kBAAkB,EACvB,GAAG,EACH,IAAI,EACJ,KAAK,OAAO,EACZ,QAAQ,EACR,YAAY,GACZ,CAAC;AAEF,cAAc;AACd,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE3E,cAAc;AACd,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI;KAClC,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,CAClB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,IACpE,OAAO,GAAG,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC"}
@@ -7,7 +7,7 @@ export declare const vars: {
7
7
  * Id is almost the same as number but will also parse
8
8
  * strings, but only allow non negative integers
9
9
  *
10
- * ## Warning
10
+ * #### Warning
11
11
  * Ids are not automatically safe to be cached
12
12
  * you need to validate the response to make sure filters
13
13
  * with this id returned something
@@ -21,7 +21,7 @@ export declare const vars: {
21
21
  *
22
22
  * The numbers are always unique and sorted in ascending order
23
23
  *
24
- * ## Warning
24
+ * #### Warning
25
25
  * Ids are not automatically safe to be cached, it is also not
26
26
  * enough to just check if the filter returned some results.
27
27
  * Since for example a `relatedTo` filter works like an `or` and
@@ -69,8 +69,8 @@ export declare function isQueryVar(v: any): v is QueryVar;
69
69
  * The first argument needs to come from a `vars.ids()` variable.
70
70
  * The second argument should come from a query, where the output is trusted.
71
71
  *
72
- * ## Example
73
- * ```
72
+ * #### Example
73
+ * ```js
74
74
  * export const variables = {
75
75
  * categories: vars.ids()
76
76
  * };
@@ -81,15 +81,15 @@ export declare function isQueryVar(v: any): v is QueryVar;
81
81
  * };
82
82
  * ```
83
83
  *
84
- * ## Note
84
+ * #### Note
85
85
  * The following cases are considered equal:
86
- * ```
86
+ * ```js
87
87
  * varsIdsEqual(null, null);
88
88
  * varsIdsEqual([], null);
89
89
  * varsIdsEqual([1,2], ['2',1]);
90
90
  * ```
91
91
  * These are not equal:
92
- * ```
92
+ * ```js
93
93
  * varsIdsEqual([1], null);
94
94
  * varsIdsEqual([2,1], [2,1]); // because the second arg gets ordered
95
95
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"vars.d.ts","sourceRoot":"","sources":["../../src/queries/vars.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2BAA2B,CAAC;AAErD,eAAO,MAAM,IAAI;eACP,QAAQ,CAAC,GAAG,CAAC;kBACV,QAAQ,CAAC,MAAM,CAAC;kBAChB,QAAQ,CAAC,MAAM,CAAC;IAE5B;;;;;;;;OAQG;cACK,QAAQ,CAAC,MAAM,CAAC;IAExB;;;;;;;;;;;;;;;;;;OAkBG;eACM,QAAQ,CAAC,MAAM,EAAE,CAAC;kBAEf,QAAQ,CAAC,MAAM,CAAC;CAM5B,CAAC;AAIF,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,YAAY,KAAK,OAAO,CAAC;AAE7D,qBAAa,QAAQ,CAAC,CAAC,GAAG,GAAG;IAC5B,OAAO,CAAC,IAAI,CAAgB;IAC5B,OAAO,CAAC,IAAI,CAA6C;IACzD,OAAO,CAA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
  *
9
- * ## Warning
9
+ * #### Warning
10
10
  * Ids are not automatically safe to be cached
11
11
  * you need to validate the response to make sure filters
12
12
  * with this id returned something
@@ -20,7 +20,7 @@ export const vars = {
20
20
  *
21
21
  * The numbers are always unique and sorted in ascending order
22
22
  *
23
- * ## Warning
23
+ * #### Warning
24
24
  * Ids are not automatically safe to be cached, it is also not
25
25
  * enough to just check if the filter returned some results.
26
26
  * Since for example a `relatedTo` filter works like an `or` and
@@ -138,7 +138,9 @@ export class QueryVar {
138
138
  __QueryVar__() { }
139
139
  }
140
140
  export function isQueryVar(v) {
141
- return v && typeof v === 'object' && typeof v.__QueryVar__ === 'function';
141
+ return (typeof v === 'object' &&
142
+ v !== null &&
143
+ typeof v.__QueryVar__ === 'function');
142
144
  }
143
145
  // does not do string to number conversion
144
146
  function isValidId(id) {
@@ -150,8 +152,8 @@ function isValidId(id) {
150
152
  * The first argument needs to come from a `vars.ids()` variable.
151
153
  * The second argument should come from a query, where the output is trusted.
152
154
  *
153
- * ## Example
154
- * ```
155
+ * #### Example
156
+ * ```js
155
157
  * export const variables = {
156
158
  * categories: vars.ids()
157
159
  * };
@@ -162,15 +164,15 @@ function isValidId(id) {
162
164
  * };
163
165
  * ```
164
166
  *
165
- * ## Note
167
+ * #### Note
166
168
  * The following cases are considered equal:
167
- * ```
169
+ * ```js
168
170
  * varsIdsEqual(null, null);
169
171
  * varsIdsEqual([], null);
170
172
  * varsIdsEqual([1,2], ['2',1]);
171
173
  * ```
172
174
  * These are not equal:
173
- * ```
175
+ * ```js
174
176
  * varsIdsEqual([1], null);
175
177
  * varsIdsEqual([2,1], [2,1]); // because the second arg gets ordered
176
178
  * ```
@@ -29,7 +29,7 @@ export default class LoadRunner {
29
29
  /**
30
30
  * @returns true if the load was completed
31
31
  *
32
- * ## Throws
32
+ * #### Throws
33
33
  * if there was an error but not if the request
34
34
  * was cancelled before
35
35
  */
@@ -29,7 +29,7 @@ export default class LoadRunner {
29
29
  /**
30
30
  * @returns true if the load was completed
31
31
  *
32
- * ## Throws
32
+ * #### Throws
33
33
  * if there was an error but not if the request
34
34
  * was cancelled before
35
35
  */
@@ -1,8 +1,8 @@
1
1
  import Router, { type UpdateRequest } from './router/Router.js';
2
- import Route, { type RouteOptions } from './route/Route.js';
2
+ import Route, { type TemplateModule, type RouteOptions } from './route/Route.js';
3
3
  import Request, { type RequestOptions, type DelayRender } from './route/Request.js';
4
- import Site from './Site.js';
5
- import BaseRoute from './route/BaseRoute.js';
4
+ import Site, { type SiteFromGraphQl } from './Site.js';
5
+ import BaseRoute, { type BaseRouteOptions, type RouteOrigin } from './route/BaseRoute.js';
6
6
  import { shouldInterceptClick } from './utils.js';
7
- export { Router, UpdateRequest, BaseRoute, Route, RouteOptions, Site, Request, DelayRender, RequestOptions, shouldInterceptClick, };
7
+ export { Router, UpdateRequest, BaseRoute, BaseRouteOptions, Route, RouteOptions, TemplateModule, Site, SiteFromGraphQl, Request, DelayRender, RequestOptions, shouldInterceptClick, RouteOrigin, };
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,OAAO,EAAE,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EACN,MAAM,EACN,aAAa,EACb,SAAS,EACT,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,WAAW,EACX,cAAc,EACd,oBAAoB,GACpB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,EACb,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,OAAO,EAAE,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,EAAE,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,SAAS,EAAE,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EACN,MAAM,EACN,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,eAAe,EACf,OAAO,EACP,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,WAAW,GACX,CAAC"}
@@ -18,7 +18,7 @@ export type BaseRouteOptions = {
18
18
  * - `'replace'`: is set when a route is replaced via `Router.replaceState`
19
19
  * - `'push'`: is set when a route is pushed via `Router.pushState`
20
20
  *
21
- * ## Note
21
+ * #### Note
22
22
  * `replace` and `push` will not call loadData
23
23
  */
24
24
  export type RouteOrigin = 'init' | 'manual' | 'preload' | 'click' | 'pop' | 'replace' | 'push';
@@ -32,9 +32,9 @@ export default class BaseRoute {
32
32
  */
33
33
  url: URL;
34
34
  /**
35
- * The site of the route
35
+ * The {@link Site} of the route
36
36
  *
37
- * ## Note
37
+ * #### Note
38
38
  * In the `beforeRequest` event the site might not match
39
39
  * the url and could be the default site or one that matches
40
40
  * the users language.
@@ -45,7 +45,7 @@ export default class BaseRoute {
45
45
  /**
46
46
  * The scroll position of the current route
47
47
  *
48
- * ## Note
48
+ * #### Note
49
49
  * This does not have to represent the current scroll position
50
50
  * should more be used internally.
51
51
  *
@@ -59,7 +59,7 @@ export default class BaseRoute {
59
59
  */
60
60
  index: number;
61
61
  /**
62
- * The origin of this route, See [[RouteOrigin]]
62
+ * The origin of this route, See {@link RouteOrigin}
63
63
  */
64
64
  origin: RouteOrigin;
65
65
  /**
@@ -74,7 +74,7 @@ export default class BaseRoute {
74
74
  * This context is not persistant and should be considered "valid"
75
75
  * only for the current request / route
76
76
  *
77
- * ## Note
77
+ * #### Note
78
78
  * Consider using state instead. This will not be cloned in the clone
79
79
  * call so will always be the same object
80
80
  */
@@ -88,8 +88,8 @@ export default class BaseRoute {
88
88
  *
89
89
  * Never ends with a slash
90
90
  *
91
- * ## Example
92
- * ```
91
+ * #### Example
92
+ * ```js
93
93
  * const site = _; // site with url https://example.com/fo
94
94
  * const route = new Route('https://example.com/foo/bar/', site);
95
95
  * console.log(route.uri); // '/bar'
@@ -105,8 +105,8 @@ export default class BaseRoute {
105
105
  *
106
106
  * Never ends with a slash
107
107
  *
108
- * ## Example
109
- * ```
108
+ * #### Example
109
+ * ```js
110
110
  * const site = _; // site with url https://example.com/foo
111
111
  * const route = new Route('https://example.com/foo/bar/', null);
112
112
  * console.log(route.baseUrl); // 'https://example.com/foo'
@@ -120,11 +120,11 @@ export default class BaseRoute {
120
120
  /**
121
121
  * Returns the search params
122
122
  *
123
- * ## Note
123
+ * #### Note
124
124
  * You might also have a look at `getSearchParam` and `setSearchParam`
125
125
  *
126
- * ## Example
127
- * ```
126
+ * #### Example
127
+ * ```js
128
128
  * const route = new Route('https://example.com/foo/bar/?a=1&b=2', null);
129
129
  * console.log(route.search.get('a')); // '1'
130
130
  * ```
@@ -133,8 +133,8 @@ export default class BaseRoute {
133
133
  /**
134
134
  * Returns the hash of the route
135
135
  *
136
- * ## Example
137
- * ```
136
+ * #### Example
137
+ * ```js
138
138
  * const route = new Route('https://example.com/foo/bar/#hash', null);
139
139
  * console.log(route.hash); // '#hash'
140
140
  * ```
@@ -143,8 +143,8 @@ export default class BaseRoute {
143
143
  /**
144
144
  * Set the hash of the route
145
145
  *
146
- * ## Example
147
- * ```
146
+ * #### Example
147
+ * ```js
148
148
  * const route = new Route('https://example.com/foo/bar/', null);
149
149
  * route.hash = '#hash';
150
150
  * console.log(route.url.href); // 'https://example.com/foo/bar/#hash'
@@ -158,8 +158,8 @@ export default class BaseRoute {
158
158
  /**
159
159
  * Gets the search param
160
160
  *
161
- * ## Example
162
- * ```
161
+ * #### Example
162
+ * ```js
163
163
  * const route = new Route('https://example.com/foo/bar/?a=1&b=2', null);
164
164
  * console.log(route.getSearchParam('a')); // '1'
165
165
  * ```
@@ -169,8 +169,8 @@ export default class BaseRoute {
169
169
  * Sets the search param or removes it if the value is null, undefined or an
170
170
  * empty string
171
171
  *
172
- * ## Example
173
- * ```
172
+ * #### Example
173
+ * ```js
174
174
  * const route = new Route('https://example.com/foo/bar/?a=1&b=2', null);
175
175
  * route.setSearchParam('a', '3');
176
176
  * console.log(route.url.href); // 'https://example.com/foo/bar/?a=3&b=2'
@@ -188,7 +188,7 @@ export default class BaseRoute {
188
188
  * Sets a state value.
189
189
  * If the value is null or undefined, the key will be removed.
190
190
  *
191
- * ## When to use state
191
+ * #### When to use state
192
192
  * State is used to store additional information that persists across route changes.
193
193
  * The State is only available in the client code since it is stored using window.history.
194
194
  *
@@ -203,7 +203,7 @@ export default class BaseRoute {
203
203
  * Sets a context value.
204
204
  * If the value is null or undefined, the key will be removed.
205
205
  *
206
- * ## When to use context
206
+ * #### When to use context
207
207
  * Context is used to pass data to onRoute and onRequest handlers or exchange data between loadData calls.
208
208
  * This context is not persistent and should be considered valid only for the current request/route.
209
209
  * The context is not cloned in the clone call and will be the same object.
@@ -223,7 +223,7 @@ export default class BaseRoute {
223
223
  * This checks the url but search params do not have to be in the
224
224
  * same order
225
225
  *
226
- * ## Note
226
+ * #### Note
227
227
  * This only check the url, not site or anything else.
228
228
  */
229
229
  eq(route: BaseRoute | null): boolean | null;
@@ -244,7 +244,7 @@ export default class BaseRoute {
244
244
  /**
245
245
  * Create a copy of the Route
246
246
  *
247
- * ## Note
247
+ * #### Note
248
248
  * This does not make a copy of the template or context
249
249
  */
250
250
  clone(): BaseRoute;
@@ -10,9 +10,9 @@ export default class BaseRoute {
10
10
  */
11
11
  url;
12
12
  /**
13
- * The site of the route
13
+ * The {@link Site} of the route
14
14
  *
15
- * ## Note
15
+ * #### Note
16
16
  * In the `beforeRequest` event the site might not match
17
17
  * the url and could be the default site or one that matches
18
18
  * the users language.
@@ -23,7 +23,7 @@ export default class BaseRoute {
23
23
  /**
24
24
  * The scroll position of the current route
25
25
  *
26
- * ## Note
26
+ * #### Note
27
27
  * This does not have to represent the current scroll position
28
28
  * should more be used internally.
29
29
  *
@@ -37,7 +37,7 @@ export default class BaseRoute {
37
37
  */
38
38
  index;
39
39
  /**
40
- * The origin of this route, See [[RouteOrigin]]
40
+ * The origin of this route, See {@link RouteOrigin}
41
41
  */
42
42
  origin;
43
43
  /**
@@ -52,7 +52,7 @@ export default class BaseRoute {
52
52
  * This context is not persistant and should be considered "valid"
53
53
  * only for the current request / route
54
54
  *
55
- * ## Note
55
+ * #### Note
56
56
  * Consider using state instead. This will not be cloned in the clone
57
57
  * call so will always be the same object
58
58
  */
@@ -74,8 +74,8 @@ export default class BaseRoute {
74
74
  *
75
75
  * Never ends with a slash
76
76
  *
77
- * ## Example
78
- * ```
77
+ * #### Example
78
+ * ```js
79
79
  * const site = _; // site with url https://example.com/fo
80
80
  * const route = new Route('https://example.com/foo/bar/', site);
81
81
  * console.log(route.uri); // '/bar'
@@ -96,8 +96,8 @@ export default class BaseRoute {
96
96
  *
97
97
  * Never ends with a slash
98
98
  *
99
- * ## Example
100
- * ```
99
+ * #### Example
100
+ * ```js
101
101
  * const site = _; // site with url https://example.com/foo
102
102
  * const route = new Route('https://example.com/foo/bar/', null);
103
103
  * console.log(route.baseUrl); // 'https://example.com/foo'
@@ -115,11 +115,11 @@ export default class BaseRoute {
115
115
  /**
116
116
  * Returns the search params
117
117
  *
118
- * ## Note
118
+ * #### Note
119
119
  * You might also have a look at `getSearchParam` and `setSearchParam`
120
120
  *
121
- * ## Example
122
- * ```
121
+ * #### Example
122
+ * ```js
123
123
  * const route = new Route('https://example.com/foo/bar/?a=1&b=2', null);
124
124
  * console.log(route.search.get('a')); // '1'
125
125
  * ```
@@ -130,8 +130,8 @@ export default class BaseRoute {
130
130
  /**
131
131
  * Returns the hash of the route
132
132
  *
133
- * ## Example
134
- * ```
133
+ * #### Example
134
+ * ```js
135
135
  * const route = new Route('https://example.com/foo/bar/#hash', null);
136
136
  * console.log(route.hash); // '#hash'
137
137
  * ```
@@ -142,8 +142,8 @@ export default class BaseRoute {
142
142
  /**
143
143
  * Set the hash of the route
144
144
  *
145
- * ## Example
146
- * ```
145
+ * #### Example
146
+ * ```js
147
147
  * const route = new Route('https://example.com/foo/bar/', null);
148
148
  * route.hash = '#hash';
149
149
  * console.log(route.url.href); // 'https://example.com/foo/bar/#hash'
@@ -161,8 +161,8 @@ export default class BaseRoute {
161
161
  /**
162
162
  * Gets the search param
163
163
  *
164
- * ## Example
165
- * ```
164
+ * #### Example
165
+ * ```js
166
166
  * const route = new Route('https://example.com/foo/bar/?a=1&b=2', null);
167
167
  * console.log(route.getSearchParam('a')); // '1'
168
168
  * ```
@@ -174,8 +174,8 @@ export default class BaseRoute {
174
174
  * Sets the search param or removes it if the value is null, undefined or an
175
175
  * empty string
176
176
  *
177
- * ## Example
178
- * ```
177
+ * #### Example
178
+ * ```js
179
179
  * const route = new Route('https://example.com/foo/bar/?a=1&b=2', null);
180
180
  * route.setSearchParam('a', '3');
181
181
  * console.log(route.url.href); // 'https://example.com/foo/bar/?a=3&b=2'
@@ -205,7 +205,7 @@ export default class BaseRoute {
205
205
  * Sets a state value.
206
206
  * If the value is null or undefined, the key will be removed.
207
207
  *
208
- * ## When to use state
208
+ * #### When to use state
209
209
  * State is used to store additional information that persists across route changes.
210
210
  * The State is only available in the client code since it is stored using window.history.
211
211
  *
@@ -229,7 +229,7 @@ export default class BaseRoute {
229
229
  * Sets a context value.
230
230
  * If the value is null or undefined, the key will be removed.
231
231
  *
232
- * ## When to use context
232
+ * #### When to use context
233
233
  * Context is used to pass data to onRoute and onRequest handlers or exchange data between loadData calls.
234
234
  * This context is not persistent and should be considered valid only for the current request/route.
235
235
  * The context is not cloned in the clone call and will be the same object.
@@ -265,7 +265,7 @@ export default class BaseRoute {
265
265
  * This checks the url but search params do not have to be in the
266
266
  * same order
267
267
  *
268
- * ## Note
268
+ * #### Note
269
269
  * This only check the url, not site or anything else.
270
270
  */
271
271
  eq(route) {
@@ -310,7 +310,7 @@ export default class BaseRoute {
310
310
  /**
311
311
  * Create a copy of the Route
312
312
  *
313
- * ## Note
313
+ * #### Note
314
314
  * This does not make a copy of the template or context
315
315
  */
316
316
  clone() {