Skip to content

Commit c6a194d

Browse files
committed
generate ts module def
1 parent ae8c325 commit c6a194d

8 files changed

Lines changed: 78 additions & 7 deletions

File tree

crates/bindings-typescript/src/lib/autogen/case_conversion_policy_type.ts

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bindings-typescript/src/lib/autogen/explicit_name_entry_type.ts

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bindings-typescript/src/lib/autogen/explicit_names_type.ts

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bindings-typescript/src/lib/autogen/raw_index_def_v_10_type.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_section_type.ts

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bindings-typescript/src/lib/schema.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function tableToSchema<T extends UntypedTableSchema>(
100100
? [idx.algorithm.value]
101101
: idx.algorithm.value;
102102
return {
103-
name: idx.accessorName!,
103+
name: idx.name!,
104104
unique: tableDef.constraints.some(c =>
105105
c.data.value.columns.every(col => columnIds.includes(col))
106106
),
@@ -140,6 +140,11 @@ export class ModuleContext {
140140
procedures: [],
141141
views: [],
142142
lifeCycleReducers: [],
143+
caseConversionPolicy: { tag: 'SnakeCase' },
144+
explicitNames: {
145+
tables: [],
146+
funcs: [],
147+
},
143148
};
144149

145150
get moduleDef(): ModuleDef {

crates/bindings-typescript/src/lib/table.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export function table<Row extends RowObj, const Opts extends TableOpts<Row>>(
350350
}
351351
indexes.push({
352352
sourceName: undefined, // Unnamed indexes will be assigned a globally unique name
353-
accessorName: name, // The name of this column will be used as the accessor name
353+
name, // The name of this column will be used as the accessor name
354354
algorithm,
355355
});
356356
}
@@ -420,7 +420,7 @@ export function table<Row extends RowObj, const Opts extends TableOpts<Row>>(
420420
// the name and accessor name of an index across all SDKs.
421421
indexes.push({
422422
sourceName: undefined,
423-
accessorName: indexOpts.name,
423+
name: indexOpts.name,
424424
algorithm,
425425
});
426426
}

crates/bindings-typescript/src/server/runtime.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,10 @@ function makeTableView(
783783
} as RangedIndex<any, any>;
784784
}
785785

786-
if (Object.hasOwn(tableView, indexDef.accessorName!)) {
787-
freeze(Object.assign(tableView[indexDef.accessorName!], index));
786+
if (Object.hasOwn(tableView, indexDef.name!)) {
787+
freeze(Object.assign(tableView[indexDef.name!], index));
788788
} else {
789-
tableView[indexDef.accessorName!] = freeze(index) as any;
789+
tableView[indexDef.name!] = freeze(index) as any;
790790
}
791791
}
792792

0 commit comments

Comments
 (0)