@gonvex/cli 0.1.32 → 0.3.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 (36) hide show
  1. package/README.md +30 -15
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +1 -1
  4. package/dist/browser.js.map +1 -1
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +274 -555
  7. package/dist/index.js.map +1 -1
  8. package/dist/manifest-types.d.ts +261 -0
  9. package/dist/manifest-types.js +3 -0
  10. package/dist/manifest-types.js.map +1 -0
  11. package/dist/module-artifact.d.ts +26 -0
  12. package/dist/module-artifact.js +1585 -0
  13. package/dist/module-artifact.js.map +1 -0
  14. package/dist/react.d.ts +2 -2
  15. package/dist/react.js +1 -1
  16. package/dist/react.js.map +1 -1
  17. package/dist/templates/vite-react/README.md +5 -2
  18. package/dist/templates/vite-react/gonvex/_build/module.js +407 -0
  19. package/dist/templates/vite-react/gonvex/_generated/api.ts +185 -3
  20. package/dist/templates/vite-react/gonvex/_generated/client.ts +1 -1
  21. package/dist/templates/vite-react/gonvex/_generated/{landlord → control-plane}/schema.ts +2 -1
  22. package/dist/templates/vite-react/gonvex/_generated/{landlord → control-plane}/tables.ts +1 -1
  23. package/dist/templates/vite-react/gonvex/_generated/manifest.json +201 -66
  24. package/dist/templates/vite-react/gonvex/_generated/module.json +120 -0
  25. package/dist/templates/vite-react/gonvex/_generated/react.ts +2 -2
  26. package/dist/templates/vite-react/gonvex/_generated/schema.ts +4 -34
  27. package/dist/templates/vite-react/gonvex/_generated/tenant/schema.ts +1 -30
  28. package/dist/templates/vite-react/gonvex/_generated/tenant/tables.ts +0 -30
  29. package/dist/templates/vite-react/gonvex/index.ts +1 -0
  30. package/dist/templates/vite-react/gonvex/messages.ts +47 -0
  31. package/dist/templates/vite-react/migrations/0001_messages.sql +9 -0
  32. package/dist/templates/vite-react/package.json +1 -0
  33. package/dist/templates/vite-react/src/App.tsx +5 -5
  34. package/package.json +4 -3
  35. package/dist/templates/vite-react/gonvex/messages.go +0 -38
  36. package/dist/templates/vite-react/gonvex/schema.go +0 -14
@@ -0,0 +1,261 @@
1
+ export type FunctionKind = "query" | "reducer" | "action";
2
+ export type JsonValue = null | boolean | number | string | JsonValue[] | {
3
+ [key: string]: JsonValue;
4
+ };
5
+ export type FunctionEntry = {
6
+ kind: FunctionKind;
7
+ handler: string;
8
+ file: string;
9
+ /** Language-neutral argument metadata from a TypeScript module artifact. */
10
+ args?: ModuleSchema;
11
+ /** Language-neutral result metadata from a TypeScript module artifact. */
12
+ result?: ModuleSchema;
13
+ internal?: boolean;
14
+ delivery?: "oneShot" | "live" | "replica";
15
+ dependencies?: FunctionDependencies;
16
+ replica?: ReplicaCollectionDefinition;
17
+ /** Reducer delivery policy declared by a TypeScript module. */
18
+ offline?: JsonValue;
19
+ /** Ordered atomic optimistic transaction declared by a TypeScript module. */
20
+ optimistic?: JsonValue;
21
+ actionProfile?: "standard" | "agent";
22
+ actionCapabilities?: ActionCapabilities;
23
+ };
24
+ export type ActionToolBinding = {
25
+ kind: "query" | "reducer";
26
+ function: string;
27
+ };
28
+ export type ActionCapabilities = {
29
+ networkOrigins?: string[];
30
+ secrets?: string[];
31
+ tools?: Record<string, ActionToolBinding>;
32
+ scheduler?: true;
33
+ storage?: true;
34
+ sandbox?: {
35
+ duckdb?: true;
36
+ };
37
+ };
38
+ export type ReplicaCollectionDefinition = {
39
+ table: string;
40
+ key: string;
41
+ columns: string[];
42
+ equalFilters?: Record<string, string>;
43
+ excludeWhenSet?: string[];
44
+ visibilityTables?: string[];
45
+ visibilityPlanHash?: string;
46
+ orderBy?: string;
47
+ orderDirection?: "asc" | "desc";
48
+ mode?: "eager" | "progressive";
49
+ maxRows?: number;
50
+ maxBytes?: number;
51
+ };
52
+ export type FunctionDependencies = {
53
+ shareByPermissions?: boolean;
54
+ shareResultFrom?: string;
55
+ shareResultField?: string;
56
+ liveQueryPlan?: LiveQueryPlan;
57
+ nonOptimisticReason?: string;
58
+ };
59
+ export type LiveQueryPlan = {
60
+ table: string;
61
+ key: string;
62
+ columns?: string[];
63
+ resultPath?: string[];
64
+ where?: LiveExpression;
65
+ search?: {
66
+ argument: string;
67
+ columns: string[];
68
+ };
69
+ filters?: {
70
+ argument: string;
71
+ allowedColumns: string[];
72
+ allowedOperators: FilterOperator[];
73
+ };
74
+ sort?: {
75
+ columnArgument?: string;
76
+ directionArgument?: string;
77
+ defaultColumn: string;
78
+ defaultDirection: "asc" | "desc";
79
+ allowedColumns: string[];
80
+ };
81
+ window?: {
82
+ offsetArgument: string;
83
+ limitArgument: string;
84
+ defaultLimit: number;
85
+ maxLimit: number;
86
+ count?: "exact";
87
+ };
88
+ serverOnly?: boolean;
89
+ };
90
+ export type FilterOperator = "contains" | "notContains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "empty" | "notEmpty" | "oneOf" | "lessThan" | "lessThanOrEqual" | "greaterThan" | "greaterThanOrEqual" | "inRange";
91
+ export type LiveExpression = {
92
+ operator: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "containsInsensitive" | "range" | "and" | "or" | "not" | "server";
93
+ column?: string;
94
+ value?: LiveValue;
95
+ valueTo?: LiveValue;
96
+ children?: LiveExpression[];
97
+ };
98
+ export type LiveValue = {
99
+ argument?: string;
100
+ literal?: unknown;
101
+ };
102
+ export type Column = {
103
+ type: string;
104
+ nullable: boolean;
105
+ primaryKey: boolean;
106
+ };
107
+ export type Table = {
108
+ columns: Record<string, Column>;
109
+ indexes: Record<string, {
110
+ columns: string[];
111
+ unique: boolean;
112
+ kind?: string;
113
+ }>;
114
+ };
115
+ export type SchemaDefinition = {
116
+ tables: Record<string, Table>;
117
+ controlPlaneTables: Record<string, Table>;
118
+ tenantTables: Record<string, Table>;
119
+ };
120
+ export type VisibilityPlan = {
121
+ table: string;
122
+ key: string;
123
+ sets: Record<string, VisibilitySet>;
124
+ where: VisibilityExpression;
125
+ };
126
+ export type VisibilitySet = {
127
+ table: string;
128
+ select: string;
129
+ joins: VisibilityJoin[];
130
+ where: VisibilityConstraint[];
131
+ };
132
+ export type VisibilityJoin = {
133
+ table: string;
134
+ leftColumn: string;
135
+ rightColumn: string;
136
+ };
137
+ export type VisibilityConstraint = {
138
+ table: string;
139
+ column: string;
140
+ context: VisibilityContextKey;
141
+ };
142
+ export type VisibilityOperator = "public" | "permission" | "role" | "eqContext" | "inSet" | "and" | "or" | "not";
143
+ export type VisibilityContextKey = "account.id" | "member.id" | "tenant.id";
144
+ export type VisibilityExpression = {
145
+ operator: VisibilityOperator;
146
+ column?: string;
147
+ context?: VisibilityContextKey;
148
+ set?: string;
149
+ value?: string;
150
+ children?: VisibilityExpression[];
151
+ };
152
+ export type Manifest = {
153
+ project: string;
154
+ generatedAt: string;
155
+ functions: Record<string, FunctionEntry>;
156
+ schema: SchemaDefinition;
157
+ module: ModuleArtifact;
158
+ visibility?: Record<string, VisibilityPlan>;
159
+ };
160
+ export type ModuleLanguage = "typescript";
161
+ /** The recursive, language-neutral value schema used by TypeScript modules. */
162
+ export type ModuleSchema = StringSchema | NumberSchema | BooleanSchema | NullSchema | AnySchema | IdSchema | LiteralSchema | ArraySchema | ObjectSchema | RecordSchema | OptionalSchema;
163
+ export type StringSchema = {
164
+ kind: "string";
165
+ format?: "email" | "uri" | "uuid" | "datetime";
166
+ minLength?: number;
167
+ maxLength?: number;
168
+ };
169
+ export type NumberSchema = {
170
+ kind: "number";
171
+ integer?: boolean;
172
+ minimum?: number;
173
+ maximum?: number;
174
+ };
175
+ export type BooleanSchema = {
176
+ kind: "boolean";
177
+ };
178
+ export type NullSchema = {
179
+ kind: "null";
180
+ };
181
+ export type AnySchema = {
182
+ kind: "any";
183
+ };
184
+ export type IdSchema = {
185
+ kind: "id";
186
+ entity: string;
187
+ };
188
+ export type LiteralSchema = {
189
+ kind: "literal";
190
+ value: JsonValue;
191
+ };
192
+ export type ArraySchema = {
193
+ kind: "array";
194
+ items: ModuleSchema;
195
+ };
196
+ export type ObjectSchema = {
197
+ kind: "object";
198
+ fields: Record<string, ModuleSchema>;
199
+ allowUnknown?: boolean;
200
+ };
201
+ export type RecordSchema = {
202
+ kind: "record";
203
+ values: ModuleSchema;
204
+ };
205
+ export type OptionalSchema = {
206
+ kind: "optional";
207
+ value: ModuleSchema;
208
+ };
209
+ export type ModuleFunction = {
210
+ kind: FunctionKind;
211
+ /** Symbol the runtime invokes inside the module. */
212
+ handler: string;
213
+ /** Project-relative POSIX path, matching a key in `ModuleArtifact.files`. */
214
+ file: string;
215
+ /** Exported binding when the function is defined as an export. */
216
+ export?: string;
217
+ args: ModuleSchema;
218
+ result: ModuleSchema;
219
+ dependencies?: FunctionDependencies;
220
+ internal?: boolean;
221
+ delivery?: "oneShot" | "live" | "replica";
222
+ replica?: ReplicaCollectionDefinition;
223
+ offline?: JsonValue;
224
+ optimistic?: JsonValue;
225
+ actionProfile?: "standard" | "agent";
226
+ actionCapabilities?: ActionCapabilities;
227
+ };
228
+ /** Self-contained JavaScript generated by the CLI for the module runtime. */
229
+ export type ModuleJavaScript = {
230
+ /** Project-relative POSIX path written by the module bundler. */
231
+ path: string;
232
+ hash: string;
233
+ /** base64-encoded bundle contents. */
234
+ code: string;
235
+ /** base64-encoded source map when bundle generation enables one. */
236
+ sourceMap?: string;
237
+ };
238
+ export type ModuleArtifact = {
239
+ language: ModuleLanguage;
240
+ /** Artifact format generation; bumped when the layout changes. */
241
+ generation: number;
242
+ /** Deterministic content hash over the generation, language, and payload. */
243
+ hash: string;
244
+ /** Project-relative POSIX path of the module entrypoint. */
245
+ entrypoint: string;
246
+ functions: Record<string, ModuleFunction>;
247
+ /** Project-relative POSIX path to base64 contents, in sorted key order. */
248
+ files: Record<string, string>;
249
+ javascript?: ModuleJavaScript;
250
+ visibility: Record<string, VisibilityPlan>;
251
+ crons?: ModuleCron[];
252
+ invitationAcceptanceReducer?: string;
253
+ };
254
+ export type ModuleCron = {
255
+ name: string;
256
+ function: string;
257
+ args?: JsonValue;
258
+ scope: "project" | "tenant";
259
+ intervalMs?: number;
260
+ expression?: string;
261
+ };
@@ -0,0 +1,3 @@
1
+ // Manifest shapes for the language-neutral TypeScript module pipeline.
2
+ export {};
3
+ //# sourceMappingURL=manifest-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-types.js","sourceRoot":"","sources":["../src/manifest-types.ts"],"names":[],"mappings":"AAAA,uEAAuE"}
@@ -0,0 +1,26 @@
1
+ import type { FunctionEntry, ModuleArtifact, ModuleLanguage, ModuleSchema } from "./manifest-types.js";
2
+ /** Bumped whenever the artifact layout changes; mixed into the hash. */
3
+ export declare const moduleArtifactGeneration = 7;
4
+ export type ProjectLanguage = ModuleLanguage;
5
+ export type ModuleArtifactOptions = {
6
+ root: string;
7
+ backendDir: string;
8
+ /** Module sources, absolute paths. */
9
+ files: string[];
10
+ /** Versioned SQL migrations, absolute paths. */
11
+ migrations: string[];
12
+ /** gonvex.json `module.entrypoint`, project-relative. */
13
+ entrypoint?: string;
14
+ /** gonvex.json `module.bundle`, project-relative output under gonvex/_build. */
15
+ bundle?: string;
16
+ };
17
+ /**
18
+ * Gonvex v2 application modules are TypeScript-only.
19
+ */
20
+ export declare function detectProjectLanguage(backendDir: string, declared?: string): Promise<ProjectLanguage>;
21
+ export declare function moduleSourceFiles(backendDir: string): Promise<string[]>;
22
+ export declare function buildModuleArtifact(options: ModuleArtifactOptions): Promise<ModuleArtifact>;
23
+ /** Projects the artifact functions onto the language-neutral manifest shape. */
24
+ export declare function moduleManifestFunctions(artifact: ModuleArtifact): Record<string, FunctionEntry>;
25
+ /** Validate a schema after JSON transport; used by manifest projections and tests. */
26
+ export declare function isModuleSchema(value: unknown): value is ModuleSchema;