@syncular/typegen 0.95.0 → 0.97.0
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/README.md +1 -1
- package/dist/generate.js +2 -2
- package/dist/ir.d.ts +1 -1
- package/dist/manifest.d.ts +1 -1
- package/package.json +3 -3
- package/src/generate.ts +2 -2
- package/src/ir.ts +1 -1
- package/src/manifest.ts +1 -1
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ schema guide and suggests `syncular init`.
|
|
|
92
92
|
| `tables` | yes, non-empty | Synced tables. **Array order is the handler-declared bootstrap order (§4.7)** and flows unchanged into the IR and `schema.tables`. |
|
|
93
93
|
| `tables[].name` | yes | Must be created by a migration. |
|
|
94
94
|
| `tables[].scopes` | yes, ≥ 1 | §3.1 scope patterns: `'prefix:{variable}'` (column = variable) or `{ "pattern", "column" }`. The column must exist on the table; one variable must not map to two different columns. |
|
|
95
|
-
| `tables[].serverColumns` | no (default `[]`) | Columns the server sets inside the push transaction (§6.
|
|
95
|
+
| `tables[].serverColumns` | no (default `[]`) | Columns the server sets inside the push transaction (§6.7). The IR marks each `serverOwned: true`; the TS insert and update types omit it. Unknown, primary key, `NOT NULL`, crdt and encrypted columns fail with `typegen.server_column_unknown`, `_primary_key`, `_not_null`, `_crdt` and `_encrypted`. See [Server-owned columns](../../apps/docs/src/content/guide-server.md#server-owned-columns). |
|
|
96
96
|
| `tables[].extensions` | no (default `{}`) | Opaque passthrough into the IR table's `extensions` slot. |
|
|
97
97
|
| `subscriptions` | no (default `[]`) | Unit templates (SPEC §4.1). `name` must be a valid JS identifier and unique. A template names no table: its unit covers every table that declares all of its scope variables. A template whose variables no single table declares fails with `typegen.subscription_uncovered`. |
|
|
98
98
|
| `subscriptions[].scopes` | yes, non-empty | Map of variable → one value. The value is **either** a literal **or** exactly `"{param}"`. Partial templates (`"p-{x}"`) and `"*"` (§3.2 rejects requested wildcards) fail with `typegen.subscription_invalid_value`. Several values of one variable are several templates. An entry with a `table` key or a value list (the wire version 3 shape) fails with `typegen.subscription_legacy_shape`, whose message names this shape. |
|
package/dist/generate.js
CHANGED
|
@@ -121,7 +121,7 @@ function applyEncryption(parsed, scopes, encryptedColumns) {
|
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* §6.
|
|
124
|
+
* §6.7: mark each `serverColumns` entry `serverOwned`. Hard errors: unknown
|
|
125
125
|
* column, primary key, non-nullable column (a client's optimistic row holds
|
|
126
126
|
* NULL until the server row arrives), crdt column, encrypted column.
|
|
127
127
|
*/
|
|
@@ -150,7 +150,7 @@ function applyServerColumns(parsed, serverColumns, columns) {
|
|
|
150
150
|
fail('an encrypted column cannot be a server column', 'typegen.server_column_encrypted');
|
|
151
151
|
}
|
|
152
152
|
else if (!column.nullable) {
|
|
153
|
-
fail('a server column must be nullable (§6.
|
|
153
|
+
fail('a server column must be nullable (§6.7)', 'typegen.server_column_not_null');
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
return columns.map((column) => owned.has(column.name) ? { ...column, serverOwned: true } : column);
|
package/dist/ir.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface IrColumn {
|
|
|
16
16
|
readonly encrypted?: boolean;
|
|
17
17
|
/** §5.11: the app-side type of an encrypted column. Present iff `encrypted`. */
|
|
18
18
|
readonly declaredType?: IrColumnType;
|
|
19
|
-
/** §6.
|
|
19
|
+
/** §6.7: the server sets this column inside the push transaction and a
|
|
20
20
|
* client never authors it. IR metadata only (never on the wire). Present
|
|
21
21
|
* only for server-owned columns, so other columns stay byte-identical. */
|
|
22
22
|
readonly serverOwned?: boolean;
|
package/dist/manifest.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface ManifestTable {
|
|
|
20
20
|
*/
|
|
21
21
|
readonly encryptedColumns: readonly string[];
|
|
22
22
|
/**
|
|
23
|
-
* §6.
|
|
23
|
+
* §6.7: columns the server sets inside the push transaction. The IR marks
|
|
24
24
|
* each `serverOwned`. Hard errors (unknown, pk, non-nullable, crdt or
|
|
25
25
|
* encrypted column) are enforced at generate time.
|
|
26
26
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/typegen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
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.
|
|
59
|
+
"@syncular/core": "0.97.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@syncular/server": "0.
|
|
62
|
+
"@syncular/server": "0.97.0"
|
|
63
63
|
}
|
|
64
64
|
}
|
package/src/generate.ts
CHANGED
|
@@ -229,7 +229,7 @@ function applyEncryption(
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
|
-
* §6.
|
|
232
|
+
* §6.7: mark each `serverColumns` entry `serverOwned`. Hard errors: unknown
|
|
233
233
|
* column, primary key, non-nullable column (a client's optimistic row holds
|
|
234
234
|
* NULL until the server row arrives), crdt column, encrypted column.
|
|
235
235
|
*/
|
|
@@ -270,7 +270,7 @@ function applyServerColumns(
|
|
|
270
270
|
);
|
|
271
271
|
} else if (!column.nullable) {
|
|
272
272
|
fail(
|
|
273
|
-
'a server column must be nullable (§6.
|
|
273
|
+
'a server column must be nullable (§6.7)',
|
|
274
274
|
'typegen.server_column_not_null',
|
|
275
275
|
);
|
|
276
276
|
}
|
package/src/ir.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface IrColumn {
|
|
|
40
40
|
readonly encrypted?: boolean;
|
|
41
41
|
/** §5.11: the app-side type of an encrypted column. Present iff `encrypted`. */
|
|
42
42
|
readonly declaredType?: IrColumnType;
|
|
43
|
-
/** §6.
|
|
43
|
+
/** §6.7: the server sets this column inside the push transaction and a
|
|
44
44
|
* client never authors it. IR metadata only (never on the wire). Present
|
|
45
45
|
* only for server-owned columns, so other columns stay byte-identical. */
|
|
46
46
|
readonly serverOwned?: boolean;
|
package/src/manifest.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface ManifestTable {
|
|
|
67
67
|
*/
|
|
68
68
|
readonly encryptedColumns: readonly string[];
|
|
69
69
|
/**
|
|
70
|
-
* §6.
|
|
70
|
+
* §6.7: columns the server sets inside the push transaction. The IR marks
|
|
71
71
|
* each `serverOwned`. Hard errors (unknown, pk, non-nullable, crdt or
|
|
72
72
|
* encrypted column) are enforced at generate time.
|
|
73
73
|
*/
|