@livestore/common 0.0.0-snapshot-a031088a8e879e9efab2d7ab870069964d2c54ac → 0.0.0-snapshot-3048408788803b90894d93d103c76b82f21cdb36

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/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // TODO bring back when Expo and Playwright supports `with` imports
2
2
  // import packageJson from '../package.json' with { type: 'json' }
3
3
  // export const liveStoreVersion = packageJson.version
4
- export const liveStoreVersion = '0.3.0-dev.36';
4
+ export const liveStoreVersion = '0.3.0-dev.37';
5
5
  /**
6
6
  * This version number is incremented whenever the internal storage format changes in a breaking way.
7
7
  * Whenever this version changes, LiveStore will start with fresh database files. Old database files are not deleted.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/common",
3
- "version": "0.0.0-snapshot-a031088a8e879e9efab2d7ab870069964d2c54ac",
3
+ "version": "0.0.0-snapshot-3048408788803b90894d93d103c76b82f21cdb36",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -54,11 +54,11 @@
54
54
  "graphology": "0.26.0-alpha1",
55
55
  "graphology-dag": "0.4.1",
56
56
  "graphology-types": "0.24.8",
57
- "@livestore/utils": "0.0.0-snapshot-a031088a8e879e9efab2d7ab870069964d2c54ac"
57
+ "@livestore/utils": "0.0.0-snapshot-3048408788803b90894d93d103c76b82f21cdb36"
58
58
  },
59
59
  "devDependencies": {
60
60
  "vitest": "^3.1.1",
61
- "@livestore/utils-dev": "0.0.0-snapshot-a031088a8e879e9efab2d7ab870069964d2c54ac"
61
+ "@livestore/utils-dev": "0.0.0-snapshot-3048408788803b90894d93d103c76b82f21cdb36"
62
62
  },
63
63
  "files": [
64
64
  "package.json",
@@ -36,7 +36,8 @@ export const getExecArgsFromEvent = ({
36
36
  bindValues: PreparedBindValues
37
37
  writeTables: ReadonlySet<string> | undefined
38
38
  }> => {
39
- const eventArgsDecoded = event.decoded?.args ?? Schema.decodeUnknownSync(eventDef.schema)(event.encoded!.args)
39
+ const eventArgsDecoded =
40
+ event.decoded === undefined ? Schema.decodeUnknownSync(eventDef.schema)(event.encoded!.args) : event.decoded.args
40
41
 
41
42
  const query: MaterializerContextQuery = (
42
43
  rawQueryOrQueryBuilder:
@@ -19,7 +19,7 @@ export namespace QueryBuilderAst {
19
19
  export interface SelectQuery {
20
20
  readonly _tag: 'SelectQuery'
21
21
  readonly columns: string[]
22
- readonly pickFirst: false | { fallback: () => any } | 'no-fallback'
22
+ readonly pickFirst: false | { fallback: () => any } | 'throws'
23
23
  readonly select: {
24
24
  columns: ReadonlyArray<string>
25
25
  }
@@ -288,10 +288,11 @@ export namespace QueryBuilder {
288
288
  * db.todos.where('id', '123').first()
289
289
  * ```
290
290
  *
291
- * Query will fail if no rows are returned and no fallback is provided.
291
+ * Query will throw if no rows are returned and no fallback is provided.
292
292
  */
293
293
  readonly first: <TFallback = never>(options?: {
294
- fallback?: () => TFallback | GetSingle<TResult>
294
+ /** @default 'throws' */
295
+ fallback?: (() => TFallback | GetSingle<TResult>) | 'throws'
295
296
  }) => QueryBuilder<
296
297
  TFallback | GetSingle<TResult>,
297
298
  TTableDef,
@@ -143,7 +143,8 @@ export const makeQueryBuilder = <TResult, TTableDef extends TableDefBase>(
143
143
  return makeQueryBuilder(tableDef, {
144
144
  ...ast,
145
145
  limit: Option.some(1),
146
- pickFirst: options?.fallback ? { fallback: options.fallback } : 'no-fallback',
146
+ pickFirst:
147
+ options?.fallback !== undefined && options.fallback !== 'throws' ? { fallback: options.fallback } : 'throws',
147
148
  })
148
149
  },
149
150
  // // eslint-disable-next-line prefer-arrow/prefer-arrow-functions
@@ -309,7 +310,7 @@ export const getResultSchema = (qb: QueryBuilder<any, any, any>): Schema.Schema<
309
310
  const arraySchema = Schema.Array(queryAst.resultSchemaSingle)
310
311
  if (queryAst.pickFirst === false) {
311
312
  return arraySchema
312
- } else if (queryAst.pickFirst === 'no-fallback') {
313
+ } else if (queryAst.pickFirst === 'throws') {
313
314
  // Will throw if the array is empty
314
315
  return arraySchema.pipe(Schema.headOrElse())
315
316
  } else {
package/src/version.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // import packageJson from '../package.json' with { type: 'json' }
3
3
  // export const liveStoreVersion = packageJson.version
4
4
 
5
- export const liveStoreVersion = '0.3.0-dev.36' as const
5
+ export const liveStoreVersion = '0.3.0-dev.37' as const
6
6
 
7
7
  /**
8
8
  * This version number is incremented whenever the internal storage format changes in a breaking way.