@syncular/typegen 0.15.45 → 0.15.46

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.
@@ -272,6 +272,7 @@ function emitSyqlQuery(query, hash) {
272
272
  lines.push(` sqlFor: (params: ${Params}) => ${query.name}Select(params).sql,`);
273
273
  }
274
274
  lines.push(` tables: ${query.name}Tables,`);
275
+ lines.push(` resultColumns: [${query.columns.map((column) => `{ name: ${quote(column.langName)}, type: ${quote(column.type)}, nullable: ${column.nullable} }`).join(', ')}],`);
275
276
  const reactiveUsesParams = query.reactive.dependencies.some((dependency) => dependency.scopes.some((scope) => scope.params.length > 0));
276
277
  lines.push(` dependencies: (${reactiveUsesParams ? 'params' : ''}) => [`);
277
278
  for (const dependency of query.reactive.dependencies) {
@@ -359,6 +360,7 @@ function emitQuery(query, hash) {
359
360
  lines.push(` sql: ${sqlConst},`);
360
361
  lines.push(` mapRow: ${query.name}MapRow,`);
361
362
  lines.push(` tables: ${query.name}Tables,`);
363
+ lines.push(` resultColumns: [${query.columns.map((column) => `{ name: ${quote(column.langName)}, type: ${quote(column.type)}, nullable: ${column.nullable} }`).join(', ')}],`);
362
364
  const reactiveUsesParams = query.reactive.dependencies.some((dependency) => dependency.scopes.some((scope) => scope.params.length > 0));
363
365
  lines.push(` dependencies: (${reactiveUsesParams ? 'params' : ''}) => [`);
364
366
  for (const dependency of query.reactive.dependencies) {
@@ -472,6 +474,7 @@ export function emitQueriesModule(queries, hash, irVersion) {
472
474
  ' readonly sql: string;',
473
475
  ' readonly mapRow: (row: Readonly<Record<string, unknown>>) => Row;',
474
476
  ' readonly tables: readonly string[];',
477
+ ' readonly resultColumns: readonly QueryResultColumn[];',
475
478
  ' readonly bind: (params: Params) => readonly QueryValue[];',
476
479
  ' readonly sqlFor?: (params: Params) => string;',
477
480
  ' readonly dependencies: (params: Params) => readonly QueryDependency[];',
@@ -486,6 +489,12 @@ export function emitQueriesModule(queries, hash, irVersion) {
486
489
  ' readonly scopeKeys?: readonly string[];',
487
490
  '}',
488
491
  '',
492
+ 'export interface QueryResultColumn {',
493
+ ' readonly name: string;',
494
+ " readonly type: 'string' | 'integer' | 'float' | 'boolean' | 'json' | 'bytes' | 'blob_ref' | 'crdt';",
495
+ ' readonly nullable: boolean;',
496
+ '}',
497
+ '',
489
498
  'export interface WindowCoverage {',
490
499
  ' readonly base: {',
491
500
  ' readonly table: string;',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/typegen",
3
- "version": "0.15.45",
3
+ "version": "0.15.46",
4
4
  "description": "Syncular schema-to-TypeScript type generator and the `syncular` CLI",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -56,9 +56,9 @@
56
56
  "!dist/**/*.test.d.ts"
57
57
  ],
58
58
  "dependencies": {
59
- "@syncular/core": "0.15.45"
59
+ "@syncular/core": "0.15.46"
60
60
  },
61
61
  "devDependencies": {
62
- "@syncular/server": "0.15.45"
62
+ "@syncular/server": "0.15.46"
63
63
  }
64
64
  }
@@ -399,6 +399,9 @@ function emitSyqlQuery(query: AnalyzedQuery, hash: string): string {
399
399
  );
400
400
  }
401
401
  lines.push(` tables: ${query.name}Tables,`);
402
+ lines.push(
403
+ ` resultColumns: [${query.columns.map((column) => `{ name: ${quote(column.langName)}, type: ${quote(column.type)}, nullable: ${column.nullable} }`).join(', ')}],`,
404
+ );
402
405
  const reactiveUsesParams = query.reactive.dependencies.some((dependency) =>
403
406
  dependency.scopes.some((scope) => scope.params.length > 0),
404
407
  );
@@ -537,6 +540,9 @@ function emitQuery(query: AnalyzedQuery, hash: string): string {
537
540
  lines.push(` sql: ${sqlConst},`);
538
541
  lines.push(` mapRow: ${query.name}MapRow,`);
539
542
  lines.push(` tables: ${query.name}Tables,`);
543
+ lines.push(
544
+ ` resultColumns: [${query.columns.map((column) => `{ name: ${quote(column.langName)}, type: ${quote(column.type)}, nullable: ${column.nullable} }`).join(', ')}],`,
545
+ );
540
546
  const reactiveUsesParams = query.reactive.dependencies.some((dependency) =>
541
547
  dependency.scopes.some((scope) => scope.params.length > 0),
542
548
  );
@@ -683,6 +689,7 @@ export function emitQueriesModule(
683
689
  ' readonly sql: string;',
684
690
  ' readonly mapRow: (row: Readonly<Record<string, unknown>>) => Row;',
685
691
  ' readonly tables: readonly string[];',
692
+ ' readonly resultColumns: readonly QueryResultColumn[];',
686
693
  ' readonly bind: (params: Params) => readonly QueryValue[];',
687
694
  ' readonly sqlFor?: (params: Params) => string;',
688
695
  ' readonly dependencies: (params: Params) => readonly QueryDependency[];',
@@ -697,6 +704,12 @@ export function emitQueriesModule(
697
704
  ' readonly scopeKeys?: readonly string[];',
698
705
  '}',
699
706
  '',
707
+ 'export interface QueryResultColumn {',
708
+ ' readonly name: string;',
709
+ " readonly type: 'string' | 'integer' | 'float' | 'boolean' | 'json' | 'bytes' | 'blob_ref' | 'crdt';",
710
+ ' readonly nullable: boolean;',
711
+ '}',
712
+ '',
700
713
  'export interface WindowCoverage {',
701
714
  ' readonly base: {',
702
715
  ' readonly table: string;',