instant-cli 1.0.39 → 1.0.40-branch-python-sdk-v1.26482536960.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.
@@ -1,4 +1,4 @@
1
1
 
2
- > instant-cli@1.0.39 build /home/runner/work/instant/instant/client/packages/cli
2
+ > instant-cli@1.0.40-branch-python-sdk-v1.26482536960.1 build /home/runner/work/instant/instant/client/packages/cli
3
3
  > rm -rf dist; tsc -p tsconfig.build.json
4
4
 
@@ -0,0 +1,40 @@
1
+ import { FileSystem, Path } from '@effect/platform';
2
+ import { Effect, Schema } from 'effect';
3
+ import { ReadSchemaFileError, SchemaValidationError } from '../lib/pushSchema.ts';
4
+ declare const GenpyWriteError_base: Schema.TaggedErrorClass<GenpyWriteError, "GenpyWriteError", {
5
+ readonly _tag: Schema.tag<"GenpyWriteError">;
6
+ } & {
7
+ message: typeof Schema.String;
8
+ }>;
9
+ export declare class GenpyWriteError extends GenpyWriteError_base {
10
+ }
11
+ export declare const genpyCommand: ({ outDir }: {
12
+ outDir?: string;
13
+ }) => Effect.Effect<undefined, ReadSchemaFileError | SchemaValidationError | GenpyWriteError, FileSystem.FileSystem | Path.Path>;
14
+ type SchemaLike = {
15
+ entities: Record<string, EntityDefLike>;
16
+ links: Record<string, LinkDefLike>;
17
+ };
18
+ type EntityDefLike = {
19
+ attrs: Record<string, DataAttrDefLike>;
20
+ };
21
+ type DataAttrDefLike = {
22
+ valueType: 'string' | 'number' | 'boolean' | 'date' | 'json';
23
+ required: boolean;
24
+ };
25
+ type LinkDefLike = {
26
+ forward: {
27
+ on: string;
28
+ label: string;
29
+ has: 'one' | 'many';
30
+ };
31
+ reverse: {
32
+ on: string;
33
+ label: string;
34
+ has: 'one' | 'many';
35
+ };
36
+ };
37
+ export declare function buildEntityModelsPy(schema: SchemaLike): string;
38
+ export declare function buildTxStubPyi(schema: SchemaLike): string;
39
+ export {};
40
+ //# sourceMappingURL=genpy.d.ts.map
@@ -0,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UAAU,GAAG,MAAM,CA0GzD"}
@@ -0,0 +1,376 @@
1
+ import { FileSystem, Path } from '@effect/platform';
2
+ import chalk from 'chalk';
3
+ import { Effect, Schema } from 'effect';
4
+ import { readLocalSchemaFile } from '../old.js';
5
+ import { ReadSchemaFileError, SchemaValidationError, } from "../lib/pushSchema.js";
6
+ export class GenpyWriteError extends Schema.TaggedError('GenpyWriteError')('GenpyWriteError', {
7
+ message: Schema.String,
8
+ }) {
9
+ }
10
+ const PY_HEADER = `# AUTOGENERATED by \`instant-cli genpy\`. DO NOT EDIT THIS FILE BY HAND.
11
+ # Re-run \`npx instant-cli genpy\` after schema changes.
12
+ `;
13
+ export const genpyCommand = ({ outDir }) => Effect.gen(function* () {
14
+ const localSchemaFile = yield* Effect.tryPromise({
15
+ try: readLocalSchemaFile,
16
+ catch: (e) => e instanceof Error
17
+ ? ReadSchemaFileError.make({ message: e.message })
18
+ : ReadSchemaFileError.make({ message: String(e) }),
19
+ });
20
+ if (!localSchemaFile || !localSchemaFile.schema) {
21
+ return yield* ReadSchemaFileError.make({
22
+ message: `We couldn't find your ${chalk.yellow('`instant.schema.ts`')} file. Make sure it's in the project root or under \`src/\`. (Hint: set INSTANT_SCHEMA_FILE_PATH to override.)`,
23
+ });
24
+ }
25
+ if (localSchemaFile.schema.constructor?.name !== 'InstantSchemaDef') {
26
+ return yield* SchemaValidationError.make({
27
+ message: `We couldn't find your schema export.\nIn your ${chalk.yellow('`instant.schema.ts`')} file, make sure you ${chalk.green('`export default schema`')}`,
28
+ });
29
+ }
30
+ const path = yield* Path.Path;
31
+ const fs = yield* FileSystem.FileSystem;
32
+ // Default: write alongside the schema file. `--out-dir` overrides for
33
+ // monorepos where Python lives elsewhere, or for our own sandbox where
34
+ // the schema is shared with the JS CLI tests.
35
+ const targetDir = outDir ? path.resolve(outDir) : path.dirname(localSchemaFile.path);
36
+ yield* fs.makeDirectory(targetDir, { recursive: true }).pipe(Effect.mapError((e) => GenpyWriteError.make({ message: `Failed to create ${targetDir}: ${e}` })));
37
+ const pyPath = path.join(targetDir, 'instant_types.py');
38
+ const pyiPath = path.join(targetDir, 'instant_types.pyi');
39
+ const pyContent = buildEntityModelsPy(localSchemaFile.schema);
40
+ const pyiContent = buildTxStubPyi(localSchemaFile.schema);
41
+ yield* fs.writeFileString(pyPath, pyContent).pipe(Effect.mapError((e) => GenpyWriteError.make({ message: `Failed to write ${pyPath}: ${e}` })));
42
+ yield* fs.writeFileString(pyiPath, pyiContent).pipe(Effect.mapError((e) => GenpyWriteError.make({ message: `Failed to write ${pyiPath}: ${e}` })));
43
+ yield* Effect.log(`✅ Wrote ${pyPath} and ${pyiPath}`);
44
+ });
45
+ function className(entName) {
46
+ // Strip a leading `$` (system entities like `$users`, `$files`), then
47
+ // PascalCase across word separators (`-`, `_`, whitespace) so non-identifier
48
+ // characters in entity names don't produce invalid Python class names.
49
+ const stripped = entName.startsWith('$') ? entName.slice(1) : entName;
50
+ return stripped
51
+ .split(/[-_\s]+/)
52
+ .filter(Boolean)
53
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
54
+ .join('');
55
+ }
56
+ function mapValueType(vt) {
57
+ switch (vt) {
58
+ case 'string':
59
+ return 'str';
60
+ case 'number':
61
+ return 'float';
62
+ case 'boolean':
63
+ return 'bool';
64
+ case 'date':
65
+ return 'datetime';
66
+ case 'json':
67
+ return 'Any';
68
+ default:
69
+ // Defensive: if a new valueType ever lands in the schema without a
70
+ // genpy update, fall back to Any so generated code stays valid Python.
71
+ return 'Any';
72
+ }
73
+ }
74
+ export function buildEntityModelsPy(schema) {
75
+ const entityNames = Object.keys(schema.entities).sort();
76
+ const fieldsByEntity = {};
77
+ const linkFieldsByEntity = {};
78
+ let usesDatetime = false;
79
+ for (const entName of entityNames) {
80
+ fieldsByEntity[entName] = [{ name: 'id', type: 'str', hasDefault: false }];
81
+ linkFieldsByEntity[entName] = [];
82
+ for (const [attrName, attrDef] of Object.entries(schema.entities[entName].attrs)) {
83
+ const baseType = mapValueType(attrDef.valueType);
84
+ if (baseType === 'datetime')
85
+ usesDatetime = true;
86
+ const type = attrDef.required ? baseType : `${baseType} | None`;
87
+ fieldsByEntity[entName].push({
88
+ name: attrName,
89
+ type,
90
+ hasDefault: !attrDef.required,
91
+ });
92
+ }
93
+ }
94
+ for (const link of Object.values(schema.links)) {
95
+ const fwd = link.forward;
96
+ const rev = link.reverse;
97
+ if (linkFieldsByEntity[fwd.on]) {
98
+ linkFieldsByEntity[fwd.on].push({
99
+ name: fwd.label,
100
+ type: fwd.has === 'one'
101
+ ? `${className(rev.on)} | None`
102
+ : `list[${className(rev.on)}] | None`,
103
+ hasDefault: true,
104
+ });
105
+ }
106
+ if (linkFieldsByEntity[rev.on]) {
107
+ linkFieldsByEntity[rev.on].push({
108
+ name: rev.label,
109
+ type: rev.has === 'one'
110
+ ? `${className(fwd.on)} | None`
111
+ : `list[${className(fwd.on)}] | None`,
112
+ hasDefault: true,
113
+ });
114
+ }
115
+ }
116
+ // Sort link fields alphabetically for stable output across schema rewrites.
117
+ for (const entName of entityNames) {
118
+ linkFieldsByEntity[entName].sort((a, b) => a.name.localeCompare(b.name));
119
+ }
120
+ const classBlocks = entityNames.map((entName) => {
121
+ const lines = [
122
+ `class ${className(entName)}(BaseModel):`,
123
+ ` model_config = ConfigDict(extra="ignore")`,
124
+ ];
125
+ for (const f of [
126
+ ...fieldsByEntity[entName],
127
+ ...linkFieldsByEntity[entName],
128
+ ]) {
129
+ const decl = f.hasDefault
130
+ ? ` ${f.name}: ${f.type} = None`
131
+ : ` ${f.name}: ${f.type}`;
132
+ lines.push(decl);
133
+ }
134
+ return lines.join('\n');
135
+ });
136
+ const rebuilds = entityNames.map((entName) => `${className(entName)}.model_rebuild()`);
137
+ // Webhook record / handler types live in the same .py so users get one
138
+ // import point (`from instant_types import ...`) for both query results
139
+ // and webhook handler type-checking.
140
+ const webhookSection = buildWebhookSection(schema, entityNames);
141
+ const typingImports = ['Any', 'Callable', 'Literal', 'TypedDict'];
142
+ const stdlibImports = [];
143
+ if (usesDatetime)
144
+ stdlibImports.push('from datetime import datetime');
145
+ stdlibImports.push(`from typing import ${typingImports.join(', ')}`);
146
+ const importBlock = stdlibImports.join('\n') + '\n\n' +
147
+ 'from pydantic import BaseModel, ConfigDict';
148
+ // Add record-model rebuilds so forward-string annotations to entity
149
+ // types resolve under `from __future__ import annotations`.
150
+ const recordRebuilds = [];
151
+ for (const entName of entityNames) {
152
+ const cls = className(entName);
153
+ for (const action of ['Create', 'Update', 'Delete']) {
154
+ recordRebuilds.push(`${cls}${action}Record.model_rebuild()`);
155
+ }
156
+ }
157
+ // Registry consumed by `Instant(schema=schema)`.
158
+ const entityMapLines = [' "entities": {'];
159
+ for (const entName of entityNames) {
160
+ entityMapLines.push(` ${JSON.stringify(entName)}: ${className(entName)},`);
161
+ }
162
+ entityMapLines.push(' },');
163
+ const recordMapLines = [' "records": {'];
164
+ for (const entName of entityNames) {
165
+ const cls = className(entName);
166
+ for (const action of ['create', 'update', 'delete']) {
167
+ const capAction = action.charAt(0).toUpperCase() + action.slice(1);
168
+ recordMapLines.push(` (${JSON.stringify(entName)}, ${JSON.stringify(action)}): ${cls}${capAction}Record,`);
169
+ }
170
+ }
171
+ recordMapLines.push(' },');
172
+ const schemaLiteral = [
173
+ 'schema = {',
174
+ ...entityMapLines,
175
+ ...recordMapLines,
176
+ '}',
177
+ ].join('\n');
178
+ return [
179
+ PY_HEADER + '"""Generated Pydantic models for Instant schema."""',
180
+ '',
181
+ 'from __future__ import annotations',
182
+ '',
183
+ importBlock,
184
+ '',
185
+ '',
186
+ classBlocks.join('\n\n\n'),
187
+ '',
188
+ '',
189
+ '# Resolve forward references introduced by `from __future__ import annotations`.',
190
+ rebuilds.join('\n'),
191
+ '',
192
+ '',
193
+ webhookSection,
194
+ '',
195
+ '',
196
+ '# Rebuild webhook records so `before` / `after` annotations resolve to entity classes.',
197
+ recordRebuilds.join('\n'),
198
+ '',
199
+ '',
200
+ '# Registry consumed by `Instant(schema=schema)` for query-result + webhook validation.',
201
+ schemaLiteral,
202
+ '',
203
+ ].join('\n');
204
+ }
205
+ // ---------- webhook record / handler codegen ----------
206
+ function buildWebhookSection(schema, entityNames) {
207
+ // Schemas with zero entities would produce `WebhookRecord = ` (no RHS).
208
+ if (entityNames.length === 0)
209
+ return '';
210
+ const recordClasses = [];
211
+ const namespaceUnions = [];
212
+ const namespaceHandlerDicts = [];
213
+ // `before`/`after` shape varies by action.
214
+ const RECORD_VARIANTS = [
215
+ { action: 'create', before: 'None = None', afterTpl: (c) => c },
216
+ { action: 'update', before: 'CLS', afterTpl: (c) => c },
217
+ { action: 'delete', before: 'CLS', afterTpl: () => 'None = None' },
218
+ ];
219
+ for (const entName of entityNames) {
220
+ const cls = className(entName);
221
+ for (const { action, before, afterTpl } of RECORD_VARIANTS) {
222
+ const cap = action.charAt(0).toUpperCase() + action.slice(1);
223
+ recordClasses.push([
224
+ `class ${cls}${cap}Record(BaseModel):`,
225
+ ` model_config = ConfigDict(extra="ignore")`,
226
+ ` namespace: Literal[${JSON.stringify(entName)}] = ${JSON.stringify(entName)}`,
227
+ ` id: str`,
228
+ ` action: Literal[${JSON.stringify(action)}] = ${JSON.stringify(action)}`,
229
+ ` before: ${before === 'CLS' ? cls : before}`,
230
+ ` after: ${afterTpl(cls)}`,
231
+ ` idempotencyKey: str`,
232
+ ].join('\n'));
233
+ }
234
+ namespaceUnions.push(`${cls}Record = ${cls}CreateRecord | ${cls}UpdateRecord | ${cls}DeleteRecord`);
235
+ // Per-namespace handler TypedDict. Functional syntax so the `$default`
236
+ // key is expressible.
237
+ namespaceHandlerDicts.push([
238
+ `_${cls}Handlers = TypedDict(`,
239
+ ` "_${cls}Handlers",`,
240
+ ' {',
241
+ ` "create": Callable[[${cls}CreateRecord], Any],`,
242
+ ` "update": Callable[[${cls}UpdateRecord], Any],`,
243
+ ` "delete": Callable[[${cls}DeleteRecord], Any],`,
244
+ ` "$default": Callable[[${cls}Record], Any],`,
245
+ ' },',
246
+ ' total=False,',
247
+ ')',
248
+ ].join('\n'));
249
+ }
250
+ const rootUnionTerms = entityNames.map((n) => `${className(n)}Record`);
251
+ const rootUnion = `WebhookRecord = ${rootUnionTerms.join(' | ')}`;
252
+ const handlerDictLines = ['WebhookHandlers = TypedDict(', ' "WebhookHandlers",', ' {'];
253
+ for (const entName of entityNames) {
254
+ handlerDictLines.push(` ${JSON.stringify(entName)}: _${className(entName)}Handlers,`);
255
+ }
256
+ handlerDictLines.push(` "$default": Callable[[WebhookRecord], Any],`);
257
+ handlerDictLines.push(' },', ' total=False,', ')');
258
+ return [
259
+ '# ---------- webhook record models ----------',
260
+ '',
261
+ recordClasses.join('\n\n\n'),
262
+ '',
263
+ '',
264
+ '# ---------- webhook handler types ----------',
265
+ '',
266
+ namespaceUnions.join('\n'),
267
+ '',
268
+ rootUnion,
269
+ '',
270
+ '',
271
+ namespaceHandlerDicts.join('\n\n\n'),
272
+ '',
273
+ '',
274
+ handlerDictLines.join('\n'),
275
+ ].join('\n');
276
+ }
277
+ // ---------- tx builder .pyi stub ----------
278
+ export function buildTxStubPyi(schema) {
279
+ const entityNames = Object.keys(schema.entities).sort();
280
+ let usesDatetime = false;
281
+ // Per-entity link fields (label + arg type for link/unlink TypedDict).
282
+ const linkFieldsByEntity = {};
283
+ for (const entName of entityNames) {
284
+ linkFieldsByEntity[entName] = [];
285
+ }
286
+ for (const link of Object.values(schema.links)) {
287
+ const fwdArgType = link.forward.has === 'one' ? 'str' : 'str | list[str]';
288
+ const revArgType = link.reverse.has === 'one' ? 'str' : 'str | list[str]';
289
+ if (linkFieldsByEntity[link.forward.on]) {
290
+ linkFieldsByEntity[link.forward.on].push({
291
+ label: link.forward.label,
292
+ type: fwdArgType,
293
+ });
294
+ }
295
+ if (linkFieldsByEntity[link.reverse.on]) {
296
+ linkFieldsByEntity[link.reverse.on].push({
297
+ label: link.reverse.label,
298
+ type: revArgType,
299
+ });
300
+ }
301
+ }
302
+ for (const entName of entityNames) {
303
+ linkFieldsByEntity[entName].sort((a, b) => a.label.localeCompare(b.label));
304
+ }
305
+ const perEntityBlocks = [];
306
+ for (const entName of entityNames) {
307
+ const cls = className(entName);
308
+ const argsLines = [`class ${cls}Args(TypedDict, total=False):`];
309
+ for (const [attrName, attrDef] of Object.entries(schema.entities[entName].attrs)) {
310
+ const t = mapValueType(attrDef.valueType);
311
+ if (t === 'datetime')
312
+ usesDatetime = true;
313
+ argsLines.push(` ${attrName}: ${t}`);
314
+ }
315
+ if (argsLines.length === 1)
316
+ argsLines.push(' pass');
317
+ perEntityBlocks.push(argsLines.join('\n'));
318
+ const linkLines = [`class ${cls}Links(TypedDict, total=False):`];
319
+ for (const link of linkFieldsByEntity[entName]) {
320
+ linkLines.push(` ${link.label}: ${link.type}`);
321
+ }
322
+ if (linkLines.length === 1)
323
+ linkLines.push(' pass');
324
+ perEntityBlocks.push(linkLines.join('\n'));
325
+ perEntityBlocks.push([
326
+ `class _${cls}Chunk:`,
327
+ ` def update(self, args: ${cls}Args) -> _${cls}Chunk: ...`,
328
+ ` def create(self, args: ${cls}Args) -> _${cls}Chunk: ...`,
329
+ ` def link(self, args: ${cls}Links) -> _${cls}Chunk: ...`,
330
+ ` def unlink(self, args: ${cls}Links) -> _${cls}Chunk: ...`,
331
+ ` def delete(self) -> _${cls}Chunk: ...`,
332
+ ` def merge(self, args: ${cls}Args) -> _${cls}Chunk: ...`,
333
+ ].join('\n'));
334
+ }
335
+ const builderBlock = [
336
+ 'class _NamespaceBuilder(Generic[ChunkT]):',
337
+ ' def __getitem__(self, eid: str) -> ChunkT: ...',
338
+ ' def lookup(self, attr: str, value: Any) -> ChunkT: ...',
339
+ ].join('\n');
340
+ // `$`-prefixed entities can't be reached via attribute syntax, so omit
341
+ // them from `_TxBuilder` attrs. Subscript form (`db.tx["$users"]`) still works.
342
+ const identifierEntities = entityNames.filter((n) => !n.startsWith('$'));
343
+ const txLines = ['class _TxBuilder:'];
344
+ if (identifierEntities.length === 0) {
345
+ txLines.push(' pass');
346
+ }
347
+ else {
348
+ for (const entName of identifierEntities) {
349
+ txLines.push(` ${entName}: _NamespaceBuilder[_${className(entName)}Chunk]`);
350
+ }
351
+ }
352
+ const stdlibImports = ['from typing import Any, Generic, TypedDict, TypeVar'];
353
+ if (usesDatetime)
354
+ stdlibImports.unshift('from datetime import datetime');
355
+ return [
356
+ PY_HEADER + '"""Tx builder typing stub. Applied via `Instant(schema=...)`."""',
357
+ '',
358
+ 'from __future__ import annotations',
359
+ '',
360
+ stdlibImports.join('\n'),
361
+ '',
362
+ '',
363
+ 'ChunkT = TypeVar("ChunkT")',
364
+ '',
365
+ '',
366
+ perEntityBlocks.join('\n\n\n'),
367
+ '',
368
+ '',
369
+ builderBlock,
370
+ '',
371
+ '',
372
+ txLines.join('\n'),
373
+ '',
374
+ ].join('\n');
375
+ }
376
+ //# sourceMappingURL=genpy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genpy.js","sourceRoot":"","sources":["../../src/commands/genpy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,WAAW,CACrD,iBAAiB,CAClB,CAAC,iBAAiB,EAAE;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC;CAAG;AAEL,MAAM,SAAS,GAAG;;CAEjB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,MAAM,EAAuB,EAAE,EAAE,CAC9D,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,eAAe,GAAG,KAAK,CAA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C,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,OAAO,IAAI,kBAAkB,EAAE,CAAC;YACzC,OAAO,CAAC,IAAI,CAAC,OAAO,OAAO,wBAAwB,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED,MAAM,aAAa,GAAG,CAAC,qDAAqD,CAAC,CAAC;IAC9E,IAAI,YAAY;QAAE,aAAa,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAEzE,OAAO;QACL,SAAS,GAAG,kEAAkE;QAC9E,EAAE;QACF,oCAAoC;QACpC,EAAE;QACF,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;QACxB,EAAE;QACF,EAAE;QACF,4BAA4B;QAC5B,EAAE;QACF,EAAE;QACF,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC9B,EAAE;QACF,EAAE;QACF,YAAY;QACZ,EAAE;QACF,EAAE;QACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QAClB,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { FileSystem, Path } from '@effect/platform';\nimport chalk from 'chalk';\nimport { Effect, Schema } from 'effect';\nimport { readLocalSchemaFile } from '../old.js';\nimport {\n ReadSchemaFileError,\n SchemaValidationError,\n} from '../lib/pushSchema.ts';\n\nexport class GenpyWriteError extends Schema.TaggedError<GenpyWriteError>(\n 'GenpyWriteError',\n)('GenpyWriteError', {\n message: Schema.String,\n}) {}\n\nconst PY_HEADER = `# AUTOGENERATED by \\`instant-cli genpy\\`. DO NOT EDIT THIS FILE BY HAND.\n# Re-run \\`npx instant-cli genpy\\` after schema changes.\n`;\n\nexport const genpyCommand = ({ outDir }: { outDir?: string }) =>\n Effect.gen(function* () {\n const localSchemaFile = yield* Effect.tryPromise({\n try: readLocalSchemaFile,\n catch: (e) =>\n e instanceof Error\n ? ReadSchemaFileError.make({ message: e.message })\n : ReadSchemaFileError.make({ message: String(e) }),\n });\n if (!localSchemaFile || !localSchemaFile.schema) {\n return yield* ReadSchemaFileError.make({\n message: `We couldn't find your ${chalk.yellow('`instant.schema.ts`')} file. Make sure it's in the project root or under \\`src/\\`. (Hint: set INSTANT_SCHEMA_FILE_PATH to override.)`,\n });\n }\n if (localSchemaFile.schema.constructor?.name !== 'InstantSchemaDef') {\n return yield* SchemaValidationError.make({\n message: `We couldn't find your schema export.\\nIn your ${chalk.yellow('`instant.schema.ts`')} file, make sure you ${chalk.green('`export default schema`')}`,\n });\n }\n\n const path = yield* Path.Path;\n const fs = yield* FileSystem.FileSystem;\n // Default: write alongside the schema file. `--out-dir` overrides for\n // monorepos where Python lives elsewhere, or for our own sandbox where\n // the schema is shared with the JS CLI tests.\n const targetDir = outDir ? path.resolve(outDir) : path.dirname(localSchemaFile.path);\n yield* fs.makeDirectory(targetDir, { recursive: true }).pipe(\n Effect.mapError((e) =>\n GenpyWriteError.make({ message: `Failed to create ${targetDir}: ${e}` }),\n ),\n );\n const pyPath = path.join(targetDir, 'instant_types.py');\n const pyiPath = path.join(targetDir, 'instant_types.pyi');\n\n const pyContent = buildEntityModelsPy(localSchemaFile.schema);\n const pyiContent = buildTxStubPyi(localSchemaFile.schema);\n yield* fs.writeFileString(pyPath, pyContent).pipe(\n Effect.mapError((e) =>\n GenpyWriteError.make({ message: `Failed to write ${pyPath}: ${e}` }),\n ),\n );\n yield* fs.writeFileString(pyiPath, pyiContent).pipe(\n Effect.mapError((e) =>\n GenpyWriteError.make({ message: `Failed to write ${pyiPath}: ${e}` }),\n ),\n );\n\n yield* Effect.log(`✅ Wrote ${pyPath} and ${pyiPath}`);\n });\n\n// ---------- entity model codegen ----------\n\ntype SchemaLike = {\n entities: Record<string, EntityDefLike>;\n links: Record<string, LinkDefLike>;\n};\n\ntype EntityDefLike = {\n attrs: Record<string, DataAttrDefLike>;\n};\n\ntype DataAttrDefLike = {\n valueType: 'string' | 'number' | 'boolean' | 'date' | 'json';\n required: boolean;\n};\n\ntype LinkDefLike = {\n forward: { on: string; label: string; has: 'one' | 'many' };\n reverse: { on: string; label: string; has: 'one' | 'many' };\n};\n\ntype Field = { name: string; type: string; hasDefault: boolean };\n\nfunction className(entName: string): string {\n // Strip a leading `$` (system entities like `$users`, `$files`), then\n // PascalCase across word separators (`-`, `_`, whitespace) so non-identifier\n // characters in entity names don't produce invalid Python class names.\n const stripped = entName.startsWith('$') ? entName.slice(1) : entName;\n return stripped\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n}\n\nfunction mapValueType(vt: DataAttrDefLike['valueType']): string {\n switch (vt) {\n case 'string':\n return 'str';\n case 'number':\n return 'float';\n case 'boolean':\n return 'bool';\n case 'date':\n return 'datetime';\n case 'json':\n return 'Any';\n default:\n // Defensive: if a new valueType ever lands in the schema without a\n // genpy update, fall back to Any so generated code stays valid Python.\n return 'Any';\n }\n}\n\nexport function buildEntityModelsPy(schema: SchemaLike): string {\n const entityNames = Object.keys(schema.entities).sort();\n const fieldsByEntity: Record<string, Field[]> = {};\n const linkFieldsByEntity: Record<string, Field[]> = {};\n let usesDatetime = false;\n\n for (const entName of entityNames) {\n fieldsByEntity[entName] = [{ name: 'id', type: 'str', hasDefault: false }];\n linkFieldsByEntity[entName] = [];\n for (const [attrName, attrDef] of Object.entries(\n schema.entities[entName].attrs,\n )) {\n const baseType = mapValueType(attrDef.valueType);\n if (baseType === 'datetime') usesDatetime = true;\n const type = attrDef.required ? baseType : `${baseType} | None`;\n fieldsByEntity[entName].push({\n name: attrName,\n type,\n hasDefault: !attrDef.required,\n });\n }\n }\n\n for (const link of Object.values(schema.links)) {\n const fwd = link.forward;\n const rev = link.reverse;\n if (linkFieldsByEntity[fwd.on]) {\n linkFieldsByEntity[fwd.on].push({\n name: fwd.label,\n type:\n fwd.has === 'one'\n ? `${className(rev.on)} | None`\n : `list[${className(rev.on)}] | None`,\n hasDefault: true,\n });\n }\n if (linkFieldsByEntity[rev.on]) {\n linkFieldsByEntity[rev.on].push({\n name: rev.label,\n type:\n rev.has === 'one'\n ? `${className(fwd.on)} | None`\n : `list[${className(fwd.on)}] | None`,\n hasDefault: true,\n });\n }\n }\n\n // Sort link fields alphabetically for stable output across schema rewrites.\n for (const entName of entityNames) {\n linkFieldsByEntity[entName].sort((a, b) => a.name.localeCompare(b.name));\n }\n\n const classBlocks = entityNames.map((entName) => {\n const lines = [\n `class ${className(entName)}(BaseModel):`,\n ` model_config = ConfigDict(extra=\"ignore\")`,\n ];\n for (const f of [\n ...fieldsByEntity[entName],\n ...linkFieldsByEntity[entName],\n ]) {\n const decl = f.hasDefault\n ? ` ${f.name}: ${f.type} = None`\n : ` ${f.name}: ${f.type}`;\n lines.push(decl);\n }\n return lines.join('\\n');\n });\n\n const rebuilds = entityNames.map(\n (entName) => `${className(entName)}.model_rebuild()`,\n );\n\n // Webhook record / handler types live in the same .py so users get one\n // import point (`from instant_types import ...`) for both query results\n // and webhook handler type-checking.\n const webhookSection = buildWebhookSection(schema, entityNames);\n\n const typingImports = ['Any', 'Callable', 'Literal', 'TypedDict'];\n\n const stdlibImports: string[] = [];\n if (usesDatetime) stdlibImports.push('from datetime import datetime');\n stdlibImports.push(`from typing import ${typingImports.join(', ')}`);\n const importBlock =\n stdlibImports.join('\\n') + '\\n\\n' +\n 'from pydantic import BaseModel, ConfigDict';\n\n // Add record-model rebuilds so forward-string annotations to entity\n // types resolve under `from __future__ import annotations`.\n const recordRebuilds: string[] = [];\n for (const entName of entityNames) {\n const cls = className(entName);\n for (const action of ['Create', 'Update', 'Delete']) {\n recordRebuilds.push(`${cls}${action}Record.model_rebuild()`);\n }\n }\n\n // Registry consumed by `Instant(schema=schema)`.\n const entityMapLines = [' \"entities\": {'];\n for (const entName of entityNames) {\n entityMapLines.push(` ${JSON.stringify(entName)}: ${className(entName)},`);\n }\n entityMapLines.push(' },');\n const recordMapLines = [' \"records\": {'];\n for (const entName of entityNames) {\n const cls = className(entName);\n for (const action of ['create', 'update', 'delete']) {\n const capAction = action.charAt(0).toUpperCase() + action.slice(1);\n recordMapLines.push(\n ` (${JSON.stringify(entName)}, ${JSON.stringify(action)}): ${cls}${capAction}Record,`,\n );\n }\n }\n recordMapLines.push(' },');\n const schemaLiteral = [\n 'schema = {',\n ...entityMapLines,\n ...recordMapLines,\n '}',\n ].join('\\n');\n\n return [\n PY_HEADER + '\"\"\"Generated Pydantic models for Instant schema.\"\"\"',\n '',\n 'from __future__ import annotations',\n '',\n importBlock,\n '',\n '',\n classBlocks.join('\\n\\n\\n'),\n '',\n '',\n '# Resolve forward references introduced by `from __future__ import annotations`.',\n rebuilds.join('\\n'),\n '',\n '',\n webhookSection,\n '',\n '',\n '# Rebuild webhook records so `before` / `after` annotations resolve to entity classes.',\n recordRebuilds.join('\\n'),\n '',\n '',\n '# Registry consumed by `Instant(schema=schema)` for query-result + webhook validation.',\n schemaLiteral,\n '',\n ].join('\\n');\n}\n\n// ---------- webhook record / handler codegen ----------\n\nfunction buildWebhookSection(\n schema: SchemaLike,\n entityNames: string[],\n): string {\n // Schemas with zero entities would produce `WebhookRecord = ` (no RHS).\n if (entityNames.length === 0) return '';\n\n const recordClasses: string[] = [];\n const namespaceUnions: string[] = [];\n const namespaceHandlerDicts: string[] = [];\n\n // `before`/`after` shape varies by action.\n const RECORD_VARIANTS = [\n { action: 'create', before: 'None = None', afterTpl: (c: string) => c },\n { action: 'update', before: 'CLS', afterTpl: (c: string) => c },\n { action: 'delete', before: 'CLS', afterTpl: () => 'None = None' },\n ] as const;\n\n for (const entName of entityNames) {\n const cls = className(entName);\n for (const { action, before, afterTpl } of RECORD_VARIANTS) {\n const cap = action.charAt(0).toUpperCase() + action.slice(1);\n recordClasses.push(\n [\n `class ${cls}${cap}Record(BaseModel):`,\n ` model_config = ConfigDict(extra=\"ignore\")`,\n ` namespace: Literal[${JSON.stringify(entName)}] = ${JSON.stringify(entName)}`,\n ` id: str`,\n ` action: Literal[${JSON.stringify(action)}] = ${JSON.stringify(action)}`,\n ` before: ${before === 'CLS' ? cls : before}`,\n ` after: ${afterTpl(cls)}`,\n ` idempotencyKey: str`,\n ].join('\\n'),\n );\n }\n\n namespaceUnions.push(\n `${cls}Record = ${cls}CreateRecord | ${cls}UpdateRecord | ${cls}DeleteRecord`,\n );\n\n // Per-namespace handler TypedDict. Functional syntax so the `$default`\n // key is expressible.\n namespaceHandlerDicts.push(\n [\n `_${cls}Handlers = TypedDict(`,\n ` \"_${cls}Handlers\",`,\n ' {',\n ` \"create\": Callable[[${cls}CreateRecord], Any],`,\n ` \"update\": Callable[[${cls}UpdateRecord], Any],`,\n ` \"delete\": Callable[[${cls}DeleteRecord], Any],`,\n ` \"$default\": Callable[[${cls}Record], Any],`,\n ' },',\n ' total=False,',\n ')',\n ].join('\\n'),\n );\n }\n\n const rootUnionTerms = entityNames.map((n) => `${className(n)}Record`);\n const rootUnion = `WebhookRecord = ${rootUnionTerms.join(' | ')}`;\n\n const handlerDictLines = ['WebhookHandlers = TypedDict(', ' \"WebhookHandlers\",', ' {'];\n for (const entName of entityNames) {\n handlerDictLines.push(` ${JSON.stringify(entName)}: _${className(entName)}Handlers,`);\n }\n handlerDictLines.push(` \"$default\": Callable[[WebhookRecord], Any],`);\n handlerDictLines.push(' },', ' total=False,', ')');\n\n return [\n '# ---------- webhook record models ----------',\n '',\n recordClasses.join('\\n\\n\\n'),\n '',\n '',\n '# ---------- webhook handler types ----------',\n '',\n namespaceUnions.join('\\n'),\n '',\n rootUnion,\n '',\n '',\n namespaceHandlerDicts.join('\\n\\n\\n'),\n '',\n '',\n handlerDictLines.join('\\n'),\n ].join('\\n');\n}\n\n// ---------- tx builder .pyi stub ----------\n\nexport function buildTxStubPyi(schema: SchemaLike): string {\n const entityNames = Object.keys(schema.entities).sort();\n let usesDatetime = false;\n\n // Per-entity link fields (label + arg type for link/unlink TypedDict).\n const linkFieldsByEntity: Record<string, { label: string; type: string }[]> =\n {};\n for (const entName of entityNames) {\n linkFieldsByEntity[entName] = [];\n }\n for (const link of Object.values(schema.links)) {\n const fwdArgType = link.forward.has === 'one' ? 'str' : 'str | list[str]';\n const revArgType = link.reverse.has === 'one' ? 'str' : 'str | list[str]';\n if (linkFieldsByEntity[link.forward.on]) {\n linkFieldsByEntity[link.forward.on].push({\n label: link.forward.label,\n type: fwdArgType,\n });\n }\n if (linkFieldsByEntity[link.reverse.on]) {\n linkFieldsByEntity[link.reverse.on].push({\n label: link.reverse.label,\n type: revArgType,\n });\n }\n }\n for (const entName of entityNames) {\n linkFieldsByEntity[entName].sort((a, b) => a.label.localeCompare(b.label));\n }\n\n const perEntityBlocks: string[] = [];\n for (const entName of entityNames) {\n const cls = className(entName);\n\n const argsLines = [`class ${cls}Args(TypedDict, total=False):`];\n for (const [attrName, attrDef] of Object.entries(\n schema.entities[entName].attrs,\n )) {\n const t = mapValueType(attrDef.valueType);\n if (t === 'datetime') usesDatetime = true;\n argsLines.push(` ${attrName}: ${t}`);\n }\n if (argsLines.length === 1) argsLines.push(' pass');\n perEntityBlocks.push(argsLines.join('\\n'));\n\n const linkLines = [`class ${cls}Links(TypedDict, total=False):`];\n for (const link of linkFieldsByEntity[entName]) {\n linkLines.push(` ${link.label}: ${link.type}`);\n }\n if (linkLines.length === 1) linkLines.push(' pass');\n perEntityBlocks.push(linkLines.join('\\n'));\n\n perEntityBlocks.push(\n [\n `class _${cls}Chunk:`,\n ` def update(self, args: ${cls}Args) -> _${cls}Chunk: ...`,\n ` def create(self, args: ${cls}Args) -> _${cls}Chunk: ...`,\n ` def link(self, args: ${cls}Links) -> _${cls}Chunk: ...`,\n ` def unlink(self, args: ${cls}Links) -> _${cls}Chunk: ...`,\n ` def delete(self) -> _${cls}Chunk: ...`,\n ` def merge(self, args: ${cls}Args) -> _${cls}Chunk: ...`,\n ].join('\\n'),\n );\n }\n\n const builderBlock = [\n 'class _NamespaceBuilder(Generic[ChunkT]):',\n ' def __getitem__(self, eid: str) -> ChunkT: ...',\n ' def lookup(self, attr: str, value: Any) -> ChunkT: ...',\n ].join('\\n');\n\n // `$`-prefixed entities can't be reached via attribute syntax, so omit\n // them from `_TxBuilder` attrs. Subscript form (`db.tx[\"$users\"]`) still works.\n const identifierEntities = entityNames.filter((n) => !n.startsWith('$'));\n const txLines = ['class _TxBuilder:'];\n if (identifierEntities.length === 0) {\n txLines.push(' pass');\n } else {\n for (const entName of identifierEntities) {\n txLines.push(` ${entName}: _NamespaceBuilder[_${className(entName)}Chunk]`);\n }\n }\n\n const stdlibImports = ['from typing import Any, Generic, TypedDict, TypeVar'];\n if (usesDatetime) stdlibImports.unshift('from datetime import datetime');\n\n return [\n PY_HEADER + '\"\"\"Tx builder typing stub. Applied via `Instant(schema=...)`.\"\"\"',\n '',\n 'from __future__ import annotations',\n '',\n stdlibImports.join('\\n'),\n '',\n '',\n 'ChunkT = TypeVar(\"ChunkT\")',\n '',\n '',\n perEntityBlocks.join('\\n\\n\\n'),\n '',\n '',\n builderBlock,\n '',\n '',\n txLines.join('\\n'),\n '',\n ].join('\\n');\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -123,6 +123,9 @@ export declare const pushDef: Command<[string | undefined], {
123
123
  rename?: true | string[] | undefined;
124
124
  package?: string | undefined;
125
125
  }, {}>;
126
+ export declare const genpyDef: Command<[], {
127
+ outDir?: string | undefined;
128
+ }, {}>;
126
129
  export declare const claimDef: Command<[], {
127
130
  app?: string | undefined;
128
131
  }, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AA2C9D,MAAM,MAAM,eAAe,CAAC,CAAC,IAC3B,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAiBnD,eAAO,MAAM,OAAO;;;;;MAgChB,CAAC;AASL,eAAO,MAAM,UAAU;;MAenB,CAA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AEL,eAAO,MAAM,QAAQ;;MAoBjB,CAAC;AAEL,eAAO,MAAM,QAAQ;;MAoBjB,CAAC"}
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ import { AuthLayerLive, BaseLayerLive, runCommandEffect, WithAppLayer, } from ".
13
13
  import { infoCommand } from "./commands/info.js";
14
14
  import { pullCommand } from "./commands/pull.js";
15
15
  import { claimCommand } from "./commands/claim.js";
16
+ import { genpyCommand } from "./commands/genpy.js";
16
17
  import { pushCommand } from "./commands/push.js";
17
18
  import { explorerCmd } from "./commands/explorer.js";
18
19
  import { queryCmd } from "./commands/query.js";
@@ -489,6 +490,17 @@ Environment Variables:
489
490
  packageName: inputOpts.package,
490
491
  }))));
491
492
  });
493
+ export const genpyDef = program
494
+ .command('genpy')
495
+ .description('Generate Python types (instant_types.py + .pyi) from instant.schema.ts.')
496
+ .option('-o --out-dir <path>', 'Directory to write generated files into. Defaults to the schema file directory.')
497
+ .addHelpText('after', `
498
+ Environment Variables:
499
+ INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)
500
+ `)
501
+ .action(async (opts) => {
502
+ return runCommandEffect(genpyCommand({ outDir: opts.outDir }).pipe(Effect.provide(BaseLayerLive)));
503
+ });
492
504
  export const claimDef = program
493
505
  .command('claim')
494
506
  .description('Transfer a temporary app into your Instant account')