spacetimedb 0.0.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 (61) hide show
  1. package/package.json +61 -0
  2. package/src/algebraic_type.ts +460 -0
  3. package/src/algebraic_value.ts +10 -0
  4. package/src/autogen/algebraic_type_type.ts +176 -0
  5. package/src/autogen/algebraic_type_variants.ts +47 -0
  6. package/src/autogen/index_type_type.ts +65 -0
  7. package/src/autogen/index_type_variants.ts +20 -0
  8. package/src/autogen/lifecycle_type.ts +73 -0
  9. package/src/autogen/lifecycle_variants.ts +21 -0
  10. package/src/autogen/misc_module_export_type.ts +67 -0
  11. package/src/autogen/misc_module_export_variants.ts +22 -0
  12. package/src/autogen/product_type_element_type.ts +67 -0
  13. package/src/autogen/product_type_type.ts +62 -0
  14. package/src/autogen/raw_column_def_v_8_type.ts +62 -0
  15. package/src/autogen/raw_column_default_value_v_9_type.ts +61 -0
  16. package/src/autogen/raw_constraint_data_v_9_type.ts +67 -0
  17. package/src/autogen/raw_constraint_data_v_9_variants.ts +23 -0
  18. package/src/autogen/raw_constraint_def_v_8_type.ts +61 -0
  19. package/src/autogen/raw_constraint_def_v_9_type.ts +67 -0
  20. package/src/autogen/raw_index_algorithm_type.ts +70 -0
  21. package/src/autogen/raw_index_algorithm_variants.ts +21 -0
  22. package/src/autogen/raw_index_def_v_8_type.ts +69 -0
  23. package/src/autogen/raw_index_def_v_9_type.ts +74 -0
  24. package/src/autogen/raw_misc_module_export_v_9_type.ts +67 -0
  25. package/src/autogen/raw_misc_module_export_v_9_variants.ts +25 -0
  26. package/src/autogen/raw_module_def_type.ts +77 -0
  27. package/src/autogen/raw_module_def_v_8_type.ts +90 -0
  28. package/src/autogen/raw_module_def_v_9_type.ts +110 -0
  29. package/src/autogen/raw_module_def_variants.ts +26 -0
  30. package/src/autogen/raw_reducer_def_v_9_type.ts +72 -0
  31. package/src/autogen/raw_row_level_security_def_v_9_type.ts +52 -0
  32. package/src/autogen/raw_schedule_def_v_9_type.ts +63 -0
  33. package/src/autogen/raw_scoped_type_name_v_9_type.ts +61 -0
  34. package/src/autogen/raw_sequence_def_v_8_type.ts +81 -0
  35. package/src/autogen/raw_sequence_def_v_9_type.ts +84 -0
  36. package/src/autogen/raw_table_def_v_8_type.ts +105 -0
  37. package/src/autogen/raw_table_def_v_9_type.ts +117 -0
  38. package/src/autogen/raw_type_def_v_9_type.ts +64 -0
  39. package/src/autogen/raw_unique_constraint_data_v_9_type.ts +57 -0
  40. package/src/autogen/reducer_def_type.ts +64 -0
  41. package/src/autogen/sum_type_type.ts +62 -0
  42. package/src/autogen/sum_type_variant_type.ts +67 -0
  43. package/src/autogen/table_access_type.ts +67 -0
  44. package/src/autogen/table_access_variants.ts +20 -0
  45. package/src/autogen/table_desc_type.ts +62 -0
  46. package/src/autogen/table_type_type.ts +65 -0
  47. package/src/autogen/table_type_variants.ts +20 -0
  48. package/src/autogen/type_alias_type.ts +56 -0
  49. package/src/autogen/typespace_type.ts +62 -0
  50. package/src/binary_reader.ts +167 -0
  51. package/src/binary_writer.ts +169 -0
  52. package/src/connection_id.ts +88 -0
  53. package/src/identity.ts +58 -0
  54. package/src/index.ts +11 -0
  55. package/src/schedule_at.ts +43 -0
  56. package/src/server/type_builders.test-d.ts +112 -0
  57. package/src/server/type_builders.ts +1851 -0
  58. package/src/server/type_util.ts +24 -0
  59. package/src/time_duration.ts +41 -0
  60. package/src/timestamp.ts +74 -0
  61. package/src/utils.ts +103 -0
@@ -0,0 +1,61 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+
19
+ export type RawConstraintDefV8 = {
20
+ constraintName: string;
21
+ constraints: number;
22
+ columns: number[];
23
+ };
24
+ /**
25
+ * An object for generated helper functions.
26
+ */
27
+ export const RawConstraintDefV8 = {
28
+ /**
29
+ * A function which returns this type represented as an AlgebraicType.
30
+ * This function is derived from the AlgebraicType used to generate this type.
31
+ */
32
+ getTypeScriptAlgebraicType(): __AlgebraicTypeType {
33
+ return __AlgebraicTypeValue.Product({
34
+ elements: [
35
+ { name: 'constraintName', algebraicType: __AlgebraicTypeValue.String },
36
+ { name: 'constraints', algebraicType: __AlgebraicTypeValue.U8 },
37
+ {
38
+ name: 'columns',
39
+ algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U16),
40
+ },
41
+ ],
42
+ });
43
+ },
44
+
45
+ serialize(writer: __BinaryWriter, value: RawConstraintDefV8): void {
46
+ __AlgebraicTypeValue.serializeValue(
47
+ writer,
48
+ RawConstraintDefV8.getTypeScriptAlgebraicType(),
49
+ value
50
+ );
51
+ },
52
+
53
+ deserialize(reader: __BinaryReader): RawConstraintDefV8 {
54
+ return __AlgebraicTypeValue.deserializeValue(
55
+ reader,
56
+ RawConstraintDefV8.getTypeScriptAlgebraicType()
57
+ );
58
+ },
59
+ };
60
+
61
+ export default RawConstraintDefV8;
@@ -0,0 +1,67 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+ import { RawConstraintDataV9 } from './raw_constraint_data_v_9_type';
19
+ // Mark import as potentially unused
20
+ declare type __keep_RawConstraintDataV9 = RawConstraintDataV9;
21
+
22
+ export type RawConstraintDefV9 = {
23
+ name: string | undefined;
24
+ data: RawConstraintDataV9;
25
+ };
26
+ /**
27
+ * An object for generated helper functions.
28
+ */
29
+ export const RawConstraintDefV9 = {
30
+ /**
31
+ * A function which returns this type represented as an AlgebraicType.
32
+ * This function is derived from the AlgebraicType used to generate this type.
33
+ */
34
+ getTypeScriptAlgebraicType(): __AlgebraicTypeType {
35
+ return __AlgebraicTypeValue.Product({
36
+ elements: [
37
+ {
38
+ name: 'name',
39
+ algebraicType: __AlgebraicTypeValue.createOptionType(
40
+ __AlgebraicTypeValue.String
41
+ ),
42
+ },
43
+ {
44
+ name: 'data',
45
+ algebraicType: RawConstraintDataV9.getTypeScriptAlgebraicType(),
46
+ },
47
+ ],
48
+ });
49
+ },
50
+
51
+ serialize(writer: __BinaryWriter, value: RawConstraintDefV9): void {
52
+ __AlgebraicTypeValue.serializeValue(
53
+ writer,
54
+ RawConstraintDefV9.getTypeScriptAlgebraicType(),
55
+ value
56
+ );
57
+ },
58
+
59
+ deserialize(reader: __BinaryReader): RawConstraintDefV9 {
60
+ return __AlgebraicTypeValue.deserializeValue(
61
+ reader,
62
+ RawConstraintDefV9.getTypeScriptAlgebraicType()
63
+ );
64
+ },
65
+ };
66
+
67
+ export default RawConstraintDefV9;
@@ -0,0 +1,70 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+ import * as RawIndexAlgorithmVariants from './raw_index_algorithm_variants';
19
+
20
+ // The tagged union or sum type for the algebraic type `RawIndexAlgorithm`.
21
+ export type RawIndexAlgorithm =
22
+ | RawIndexAlgorithmVariants.BTree
23
+ | RawIndexAlgorithmVariants.Hash
24
+ | RawIndexAlgorithmVariants.Direct;
25
+
26
+ // A value with helper functions to construct the type.
27
+ export const RawIndexAlgorithm = {
28
+ // Helper functions for constructing each variant of the tagged union.
29
+ // ```
30
+ // const foo = Foo.A(42);
31
+ // assert!(foo.tag === "A");
32
+ // assert!(foo.value === 42);
33
+ // ```
34
+ BTree: (value: number[]): RawIndexAlgorithm => ({ tag: 'BTree', value }),
35
+ Hash: (value: number[]): RawIndexAlgorithm => ({ tag: 'Hash', value }),
36
+ Direct: (value: number): RawIndexAlgorithm => ({ tag: 'Direct', value }),
37
+
38
+ getTypeScriptAlgebraicType(): __AlgebraicTypeType {
39
+ return __AlgebraicTypeValue.Sum({
40
+ variants: [
41
+ {
42
+ name: 'BTree',
43
+ algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U16),
44
+ },
45
+ {
46
+ name: 'Hash',
47
+ algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U16),
48
+ },
49
+ { name: 'Direct', algebraicType: __AlgebraicTypeValue.U16 },
50
+ ],
51
+ });
52
+ },
53
+
54
+ serialize(writer: __BinaryWriter, value: RawIndexAlgorithm): void {
55
+ __AlgebraicTypeValue.serializeValue(
56
+ writer,
57
+ RawIndexAlgorithm.getTypeScriptAlgebraicType(),
58
+ value
59
+ );
60
+ },
61
+
62
+ deserialize(reader: __BinaryReader): RawIndexAlgorithm {
63
+ return __AlgebraicTypeValue.deserializeValue(
64
+ reader,
65
+ RawIndexAlgorithm.getTypeScriptAlgebraicType()
66
+ );
67
+ },
68
+ };
69
+
70
+ export default RawIndexAlgorithm;
@@ -0,0 +1,21 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+
19
+ export type BTree = { tag: 'BTree'; value: number[] };
20
+ export type Hash = { tag: 'Hash'; value: number[] };
21
+ export type Direct = { tag: 'Direct'; value: number };
@@ -0,0 +1,69 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+ import { IndexType } from './index_type_type';
19
+ // Mark import as potentially unused
20
+ declare type __keep_IndexType = IndexType;
21
+
22
+ export type RawIndexDefV8 = {
23
+ indexName: string;
24
+ isUnique: boolean;
25
+ indexType: IndexType;
26
+ columns: number[];
27
+ };
28
+ /**
29
+ * An object for generated helper functions.
30
+ */
31
+ export const RawIndexDefV8 = {
32
+ /**
33
+ * A function which returns this type represented as an AlgebraicType.
34
+ * This function is derived from the AlgebraicType used to generate this type.
35
+ */
36
+ getTypeScriptAlgebraicType(): __AlgebraicTypeType {
37
+ return __AlgebraicTypeValue.Product({
38
+ elements: [
39
+ { name: 'indexName', algebraicType: __AlgebraicTypeValue.String },
40
+ { name: 'isUnique', algebraicType: __AlgebraicTypeValue.Bool },
41
+ {
42
+ name: 'indexType',
43
+ algebraicType: IndexType.getTypeScriptAlgebraicType(),
44
+ },
45
+ {
46
+ name: 'columns',
47
+ algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U16),
48
+ },
49
+ ],
50
+ });
51
+ },
52
+
53
+ serialize(writer: __BinaryWriter, value: RawIndexDefV8): void {
54
+ __AlgebraicTypeValue.serializeValue(
55
+ writer,
56
+ RawIndexDefV8.getTypeScriptAlgebraicType(),
57
+ value
58
+ );
59
+ },
60
+
61
+ deserialize(reader: __BinaryReader): RawIndexDefV8 {
62
+ return __AlgebraicTypeValue.deserializeValue(
63
+ reader,
64
+ RawIndexDefV8.getTypeScriptAlgebraicType()
65
+ );
66
+ },
67
+ };
68
+
69
+ export default RawIndexDefV8;
@@ -0,0 +1,74 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+ import { RawIndexAlgorithm } from './raw_index_algorithm_type';
19
+ // Mark import as potentially unused
20
+ declare type __keep_RawIndexAlgorithm = RawIndexAlgorithm;
21
+
22
+ export type RawIndexDefV9 = {
23
+ name: string | undefined;
24
+ accessorName: string | undefined;
25
+ algorithm: RawIndexAlgorithm;
26
+ };
27
+ /**
28
+ * An object for generated helper functions.
29
+ */
30
+ export const RawIndexDefV9 = {
31
+ /**
32
+ * A function which returns this type represented as an AlgebraicType.
33
+ * This function is derived from the AlgebraicType used to generate this type.
34
+ */
35
+ getTypeScriptAlgebraicType(): __AlgebraicTypeType {
36
+ return __AlgebraicTypeValue.Product({
37
+ elements: [
38
+ {
39
+ name: 'name',
40
+ algebraicType: __AlgebraicTypeValue.createOptionType(
41
+ __AlgebraicTypeValue.String
42
+ ),
43
+ },
44
+ {
45
+ name: 'accessorName',
46
+ algebraicType: __AlgebraicTypeValue.createOptionType(
47
+ __AlgebraicTypeValue.String
48
+ ),
49
+ },
50
+ {
51
+ name: 'algorithm',
52
+ algebraicType: RawIndexAlgorithm.getTypeScriptAlgebraicType(),
53
+ },
54
+ ],
55
+ });
56
+ },
57
+
58
+ serialize(writer: __BinaryWriter, value: RawIndexDefV9): void {
59
+ __AlgebraicTypeValue.serializeValue(
60
+ writer,
61
+ RawIndexDefV9.getTypeScriptAlgebraicType(),
62
+ value
63
+ );
64
+ },
65
+
66
+ deserialize(reader: __BinaryReader): RawIndexDefV9 {
67
+ return __AlgebraicTypeValue.deserializeValue(
68
+ reader,
69
+ RawIndexDefV9.getTypeScriptAlgebraicType()
70
+ );
71
+ },
72
+ };
73
+
74
+ export default RawIndexDefV9;
@@ -0,0 +1,67 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+ import { RawColumnDefaultValueV9 } from './raw_column_default_value_v_9_type';
19
+ // Mark import as potentially unused
20
+ declare type __keep_RawColumnDefaultValueV9 = RawColumnDefaultValueV9;
21
+
22
+ import * as RawMiscModuleExportV9Variants from './raw_misc_module_export_v_9_variants';
23
+
24
+ // The tagged union or sum type for the algebraic type `RawMiscModuleExportV9`.
25
+ export type RawMiscModuleExportV9 =
26
+ RawMiscModuleExportV9Variants.ColumnDefaultValue;
27
+
28
+ // A value with helper functions to construct the type.
29
+ export const RawMiscModuleExportV9 = {
30
+ // Helper functions for constructing each variant of the tagged union.
31
+ // ```
32
+ // const foo = Foo.A(42);
33
+ // assert!(foo.tag === "A");
34
+ // assert!(foo.value === 42);
35
+ // ```
36
+ ColumnDefaultValue: (
37
+ value: RawColumnDefaultValueV9
38
+ ): RawMiscModuleExportV9 => ({ tag: 'ColumnDefaultValue', value }),
39
+
40
+ getTypeScriptAlgebraicType(): __AlgebraicTypeType {
41
+ return __AlgebraicTypeValue.Sum({
42
+ variants: [
43
+ {
44
+ name: 'ColumnDefaultValue',
45
+ algebraicType: RawColumnDefaultValueV9.getTypeScriptAlgebraicType(),
46
+ },
47
+ ],
48
+ });
49
+ },
50
+
51
+ serialize(writer: __BinaryWriter, value: RawMiscModuleExportV9): void {
52
+ __AlgebraicTypeValue.serializeValue(
53
+ writer,
54
+ RawMiscModuleExportV9.getTypeScriptAlgebraicType(),
55
+ value
56
+ );
57
+ },
58
+
59
+ deserialize(reader: __BinaryReader): RawMiscModuleExportV9 {
60
+ return __AlgebraicTypeValue.deserializeValue(
61
+ reader,
62
+ RawMiscModuleExportV9.getTypeScriptAlgebraicType()
63
+ );
64
+ },
65
+ };
66
+
67
+ export default RawMiscModuleExportV9;
@@ -0,0 +1,25 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+ import { RawColumnDefaultValueV9 as RawColumnDefaultValueV9Type } from './raw_column_default_value_v_9_type';
19
+ // Mark import as potentially unused
20
+ declare type __keep_RawColumnDefaultValueV9Type = RawColumnDefaultValueV9Type;
21
+
22
+ export type ColumnDefaultValue = {
23
+ tag: 'ColumnDefaultValue';
24
+ value: RawColumnDefaultValueV9Type;
25
+ };
@@ -0,0 +1,77 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+ import { RawModuleDefV8 } from './raw_module_def_v_8_type';
19
+ // Mark import as potentially unused
20
+ declare type __keep_RawModuleDefV8 = RawModuleDefV8;
21
+ import { RawModuleDefV9 } from './raw_module_def_v_9_type';
22
+ // Mark import as potentially unused
23
+ declare type __keep_RawModuleDefV9 = RawModuleDefV9;
24
+
25
+ import * as RawModuleDefVariants from './raw_module_def_variants';
26
+
27
+ // The tagged union or sum type for the algebraic type `RawModuleDef`.
28
+ export type RawModuleDef =
29
+ | RawModuleDefVariants.V8BackCompat
30
+ | RawModuleDefVariants.V9;
31
+
32
+ // A value with helper functions to construct the type.
33
+ export const RawModuleDef = {
34
+ // Helper functions for constructing each variant of the tagged union.
35
+ // ```
36
+ // const foo = Foo.A(42);
37
+ // assert!(foo.tag === "A");
38
+ // assert!(foo.value === 42);
39
+ // ```
40
+ V8BackCompat: (value: RawModuleDefV8): RawModuleDef => ({
41
+ tag: 'V8BackCompat',
42
+ value,
43
+ }),
44
+ V9: (value: RawModuleDefV9): RawModuleDef => ({ tag: 'V9', value }),
45
+
46
+ getTypeScriptAlgebraicType(): __AlgebraicTypeType {
47
+ return __AlgebraicTypeValue.Sum({
48
+ variants: [
49
+ {
50
+ name: 'V8BackCompat',
51
+ algebraicType: RawModuleDefV8.getTypeScriptAlgebraicType(),
52
+ },
53
+ {
54
+ name: 'V9',
55
+ algebraicType: RawModuleDefV9.getTypeScriptAlgebraicType(),
56
+ },
57
+ ],
58
+ });
59
+ },
60
+
61
+ serialize(writer: __BinaryWriter, value: RawModuleDef): void {
62
+ __AlgebraicTypeValue.serializeValue(
63
+ writer,
64
+ RawModuleDef.getTypeScriptAlgebraicType(),
65
+ value
66
+ );
67
+ },
68
+
69
+ deserialize(reader: __BinaryReader): RawModuleDef {
70
+ return __AlgebraicTypeValue.deserializeValue(
71
+ reader,
72
+ RawModuleDef.getTypeScriptAlgebraicType()
73
+ );
74
+ },
75
+ };
76
+
77
+ export default RawModuleDef;
@@ -0,0 +1,90 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ AlgebraicType as __AlgebraicTypeValue,
8
+ BinaryReader as __BinaryReader,
9
+ BinaryWriter as __BinaryWriter,
10
+ ConnectionId as __ConnectionId,
11
+ Identity as __Identity,
12
+ TimeDuration as __TimeDuration,
13
+ Timestamp as __Timestamp,
14
+ deepEqual as __deepEqual,
15
+ type AlgebraicType as __AlgebraicTypeType,
16
+ type AlgebraicTypeVariants as __AlgebraicTypeVariants,
17
+ } from '../index';
18
+ import { Typespace } from './typespace_type';
19
+ // Mark import as potentially unused
20
+ declare type __keep_Typespace = Typespace;
21
+ import { TableDesc } from './table_desc_type';
22
+ // Mark import as potentially unused
23
+ declare type __keep_TableDesc = TableDesc;
24
+ import { ReducerDef } from './reducer_def_type';
25
+ // Mark import as potentially unused
26
+ declare type __keep_ReducerDef = ReducerDef;
27
+ import { MiscModuleExport } from './misc_module_export_type';
28
+ // Mark import as potentially unused
29
+ declare type __keep_MiscModuleExport = MiscModuleExport;
30
+
31
+ export type RawModuleDefV8 = {
32
+ typespace: Typespace;
33
+ tables: TableDesc[];
34
+ reducers: ReducerDef[];
35
+ miscExports: MiscModuleExport[];
36
+ };
37
+ /**
38
+ * An object for generated helper functions.
39
+ */
40
+ export const RawModuleDefV8 = {
41
+ /**
42
+ * A function which returns this type represented as an AlgebraicType.
43
+ * This function is derived from the AlgebraicType used to generate this type.
44
+ */
45
+ getTypeScriptAlgebraicType(): __AlgebraicTypeType {
46
+ return __AlgebraicTypeValue.Product({
47
+ elements: [
48
+ {
49
+ name: 'typespace',
50
+ algebraicType: Typespace.getTypeScriptAlgebraicType(),
51
+ },
52
+ {
53
+ name: 'tables',
54
+ algebraicType: __AlgebraicTypeValue.Array(
55
+ TableDesc.getTypeScriptAlgebraicType()
56
+ ),
57
+ },
58
+ {
59
+ name: 'reducers',
60
+ algebraicType: __AlgebraicTypeValue.Array(
61
+ ReducerDef.getTypeScriptAlgebraicType()
62
+ ),
63
+ },
64
+ {
65
+ name: 'miscExports',
66
+ algebraicType: __AlgebraicTypeValue.Array(
67
+ MiscModuleExport.getTypeScriptAlgebraicType()
68
+ ),
69
+ },
70
+ ],
71
+ });
72
+ },
73
+
74
+ serialize(writer: __BinaryWriter, value: RawModuleDefV8): void {
75
+ __AlgebraicTypeValue.serializeValue(
76
+ writer,
77
+ RawModuleDefV8.getTypeScriptAlgebraicType(),
78
+ value
79
+ );
80
+ },
81
+
82
+ deserialize(reader: __BinaryReader): RawModuleDefV8 {
83
+ return __AlgebraicTypeValue.deserializeValue(
84
+ reader,
85
+ RawModuleDefV8.getTypeScriptAlgebraicType()
86
+ );
87
+ },
88
+ };
89
+
90
+ export default RawModuleDefV8;