cloesce 0.0.3-fix.2 → 0.0.3-fix.5

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/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
@@ -1,15 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { WASI } from "node:wasi";
3
3
  import fs from "node:fs";
4
+ import { readFile } from "fs/promises";
4
5
  import path from "node:path";
5
- import { fileURLToPath } from "node:url";
6
6
  import { command, run, subcommands, flag, option, optional, string, } from "cmd-ts";
7
7
  import { Project } from "ts-morph";
8
- import { CidlExtractor } from "./extract.js";
9
- import { ExtractorError, ExtractorErrorCode, getErrorInfo } from "../common.js";
10
- const __filename = fileURLToPath(import.meta.url);
11
- const __dirname = path.dirname(__filename);
12
- const GENERATOR_WASM_PATH = path.join(__dirname, "cli.wasm");
8
+ import { CidlExtractor } from "./extractor/extract.js";
9
+ import { ExtractorError, ExtractorErrorCode, getErrorInfo } from "./common.js";
13
10
  const cmds = subcommands({
14
11
  name: "cloesce",
15
12
  cmds: {
@@ -31,7 +28,6 @@ const cmds = subcommands({
31
28
  }
32
29
  // Creates a `cidl.json` file. Exits the process on failure.
33
30
  await extract({ debug: args.debug });
34
- const root = process.cwd();
35
31
  const outputDir = config.outputDir ?? ".generated";
36
32
  const allConfig = {
37
33
  name: "all",
@@ -40,8 +36,8 @@ const cmds = subcommands({
40
36
  "generate",
41
37
  "all",
42
38
  path.join(outputDir, "cidl.json"),
43
- path.join(root, "wrangler.toml"),
44
- path.join(outputDir, "migrations.sql"),
39
+ "wrangler.toml",
40
+ "migrations/migrations.sql",
45
41
  path.join(outputDir, "workers.ts"),
46
42
  path.join(outputDir, "client.ts"),
47
43
  config.clientUrl,
@@ -57,11 +53,10 @@ const cmds = subcommands({
57
53
  description: "Generate wrangler.toml configuration",
58
54
  args: {},
59
55
  handler: async () => {
60
- const root = process.cwd();
61
56
  await generate({
62
57
  name: "wrangler",
63
58
  wasmFile: "generator.wasm",
64
- args: ["generate", "wrangler", path.join(root, "wrangler.toml")],
59
+ args: ["generate", "wrangler", "wrangler.toml"],
65
60
  });
66
61
  },
67
62
  }),
@@ -79,7 +74,7 @@ const cmds = subcommands({
79
74
  "generate",
80
75
  "d1",
81
76
  path.join(outputDir, "cidl.json"),
82
- path.join(outputDir, "migrations.sql"),
77
+ "migrations/migrations.sql",
83
78
  ],
84
79
  });
85
80
  },
@@ -90,10 +85,9 @@ const cmds = subcommands({
90
85
  args: {},
91
86
  handler: async () => {
92
87
  const config = loadCloesceConfig(process.cwd());
93
- const root = process.cwd();
94
88
  const outputDir = config.outputDir ?? ".generated";
95
89
  if (!config.workersUrl) {
96
- console.error("Error: workersUrl must be defined in cloesce-config.json");
90
+ console.error("Error: workersUrl must be defined in cloesce.config.json");
97
91
  process.exit(1);
98
92
  }
99
93
  await generate({
@@ -104,7 +98,7 @@ const cmds = subcommands({
104
98
  "workers",
105
99
  path.join(outputDir, "cidl.json"),
106
100
  path.join(outputDir, "workers.ts"),
107
- path.join(root, "wrangler.toml"),
101
+ "wrangler.toml",
108
102
  config.workersUrl,
109
103
  ],
110
104
  });
@@ -240,32 +234,15 @@ async function generate(config) {
240
234
  if (!fs.existsSync(wranglerPath)) {
241
235
  fs.writeFileSync(wranglerPath, "");
242
236
  }
243
- const wasiArgs = config.args.map((arg) => {
244
- // Skip URLs for http:// and stuff
245
- if (/^[a-zA-Z]+:\/\//.test(arg)) {
246
- return arg;
247
- }
248
- // If it looks like a file path, convert it to Unix style beause WASI expects that
249
- if (arg.includes(path.sep) || arg.includes("/")) {
250
- // Convert to relative path from root
251
- const relativePath = path.isAbsolute(arg)
252
- ? path.relative(root, arg)
253
- : arg;
254
- // Convert Windows separators to Unix and ensure leading slash
255
- const unixPath = relativePath.replace(/\\/g, "/");
256
- return unixPath.startsWith("/") ? unixPath : "/" + unixPath;
257
- }
258
- return arg;
259
- });
260
237
  const wasi = new WASI({
261
238
  version: "preview1",
262
- args: [path.basename(GENERATOR_WASM_PATH), ...wasiArgs],
239
+ args: ["generate", ...config.args],
263
240
  env: { ...process.env, ...config.env },
264
- preopens: { "/": root },
241
+ preopens: { ".": root },
265
242
  });
266
- const bytes = fs.readFileSync(GENERATOR_WASM_PATH);
267
- const mod = await WebAssembly.compile(bytes);
268
- const instance = await WebAssembly.instantiate(mod, {
243
+ const wasm = await readFile(new URL("./generator.wasm", import.meta.url));
244
+ const mod = await WebAssembly.compile(new Uint8Array(wasm));
245
+ let instance = await WebAssembly.instantiate(mod, {
269
246
  wasi_snapshot_preview1: wasi.wasiImport,
270
247
  });
271
248
  try {
@@ -336,9 +313,9 @@ function formatErr(e) {
336
313
  const { description, suggestion } = getErrorInfo(e.code);
337
314
  const contextLine = e.context ? `Context: ${e.context}\n` : "";
338
315
  const snippetLine = e.snippet ? `${e.snippet}\n\n` : "";
339
- return `==== CLOESCE ERROR ====
340
- Error [${ExtractorErrorCode[e.code]}]: ${description}
341
- Phase: TypeScript IDL Extraction
316
+ return `==== CLOESCE ERROR ====
317
+ Error [${ExtractorErrorCode[e.code]}]: ${description}
318
+ Phase: TypeScript IDL Extraction
342
319
  ${contextLine}${snippetLine}Suggested fix: ${suggestion}`;
343
320
  }
344
321
  run(cmds, process.argv.slice(2)).catch((err) => {
@@ -0,0 +1,126 @@
1
+ export type Either<L, R> = {
2
+ ok: false;
3
+ value: L;
4
+ } | {
5
+ ok: true;
6
+ value: R;
7
+ };
8
+ export declare function left<L>(value: L): Either<L, never>;
9
+ export declare function right<R>(value: R): Either<never, R>;
10
+ export declare enum ExtractorErrorCode {
11
+ UnknownType = 0,
12
+ MultipleGenericType = 1,
13
+ InvalidIncludeTree = 2,
14
+ UnknownNavigationPropertyReference = 3,
15
+ InvalidNavigationPropertyReference = 4,
16
+ MissingNavigationPropertyReference = 5,
17
+ MissingManyToManyUniqueId = 6,
18
+ MissingPrimaryKey = 7,
19
+ MissingWranglerEnv = 8,
20
+ TooManyWranglerEnvs = 9,
21
+ MissingFile = 10
22
+ }
23
+ export declare function getErrorInfo(code: ExtractorErrorCode): {
24
+ description: string;
25
+ suggestion: string;
26
+ };
27
+ export declare class ExtractorError {
28
+ code: ExtractorErrorCode;
29
+ context?: string;
30
+ snippet?: string;
31
+ constructor(code: ExtractorErrorCode);
32
+ addContext(fn: (val: string | undefined) => string | undefined): void;
33
+ }
34
+ export type HttpResult<T = unknown> = {
35
+ ok: boolean;
36
+ status: number;
37
+ data?: T;
38
+ message?: string;
39
+ };
40
+ export type CidlType = "Void" | "Integer" | "Real" | "Text" | "Blob" | {
41
+ Inject: string;
42
+ } | {
43
+ Object: string;
44
+ } | {
45
+ Nullable: CidlType;
46
+ } | {
47
+ Array: CidlType;
48
+ } | {
49
+ HttpResult: CidlType;
50
+ };
51
+ export declare function isNullableType(ty: CidlType): boolean;
52
+ export declare enum HttpVerb {
53
+ GET = "GET",
54
+ POST = "POST",
55
+ PUT = "PUT",
56
+ PATCH = "PATCH",
57
+ DELETE = "DELETE"
58
+ }
59
+ export interface NamedTypedValue {
60
+ name: string;
61
+ cidl_type: CidlType;
62
+ }
63
+ export interface ModelAttribute {
64
+ value: NamedTypedValue;
65
+ foreign_key_reference: string | null;
66
+ }
67
+ export interface ModelMethod {
68
+ name: string;
69
+ is_static: boolean;
70
+ http_verb: HttpVerb;
71
+ return_type: CidlType | null;
72
+ parameters: NamedTypedValue[];
73
+ }
74
+ export type NavigationPropertyKind = {
75
+ OneToOne: {
76
+ reference: string;
77
+ };
78
+ } | {
79
+ OneToMany: {
80
+ reference: string;
81
+ };
82
+ } | {
83
+ ManyToMany: {
84
+ unique_id: string;
85
+ };
86
+ };
87
+ export interface NavigationProperty {
88
+ var_name: string;
89
+ model_name: string;
90
+ kind: NavigationPropertyKind;
91
+ }
92
+ export declare function getNavigationPropertyCidlType(nav: NavigationProperty): CidlType;
93
+ export interface Model {
94
+ name: string;
95
+ primary_key: NamedTypedValue;
96
+ attributes: ModelAttribute[];
97
+ navigation_properties: NavigationProperty[];
98
+ methods: Record<string, ModelMethod>;
99
+ data_sources: Record<string, DataSource>;
100
+ source_path: string;
101
+ }
102
+ export interface PlainOldObject {
103
+ name: string;
104
+ attributes: NamedTypedValue[];
105
+ source_path: string;
106
+ }
107
+ export interface CidlIncludeTree {
108
+ [key: string]: CidlIncludeTree;
109
+ }
110
+ export interface DataSource {
111
+ name: string;
112
+ tree: CidlIncludeTree;
113
+ }
114
+ export interface WranglerEnv {
115
+ name: string;
116
+ source_path: string;
117
+ }
118
+ export interface CloesceAst {
119
+ version: string;
120
+ project_name: string;
121
+ language: "TypeScript";
122
+ wrangler_env: WranglerEnv;
123
+ models: Record<string, Model>;
124
+ poos: Record<string, PlainOldObject>;
125
+ }
126
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAC5E,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAElD;AACD,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAEnD;AAED,oBAAY,kBAAkB;IAC5B,WAAW,IAAA;IACX,mBAAmB,IAAA;IACnB,kBAAkB,IAAA;IAClB,kCAAkC,IAAA;IAClC,kCAAkC,IAAA;IAClC,kCAAkC,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,eAAe,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,YAAY,EAAE,WAAW,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACtC"}
@@ -0,0 +1,15 @@
1
+ import { Project } from "ts-morph";
2
+ import { CloesceAst, Either, ExtractorError } from "../common.js";
3
+ export declare class CidlExtractor {
4
+ projectName: string;
5
+ version: string;
6
+ constructor(projectName: string, version: string);
7
+ extract(project: Project): Either<ExtractorError, CloesceAst>;
8
+ private static model;
9
+ private static poo;
10
+ private static readonly primTypeMap;
11
+ private static cidlType;
12
+ private static includeTree;
13
+ private static method;
14
+ }
15
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/extractor/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EASR,MAAM,UAAU,CAAC;AAElB,OAAO,EAEL,UAAU,EAGV,MAAM,EAUN,cAAc,EAGf,MAAM,cAAc,CAAC;AAsBtB,qBAAa,aAAa;IAEf,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,MAAM;gBADf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM;IAGxB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC;IAuE7D,OAAO,CAAC,MAAM,CAAC,KAAK;IA6MpB,OAAO,CAAC,MAAM,CAAC,GAAG;IAgClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAQjC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ;IAoGvB,OAAO,CAAC,MAAM,CAAC,WAAW;IAqF1B,OAAO,CAAC,MAAM,CAAC,MAAM;CA+DtB"}
Binary file
@@ -0,0 +1,22 @@
1
+ export { cloesce, modelsFromSql } from "../runtime/runtime.js";
2
+ export type { HttpResult, Either } from "../common.js";
3
+ export declare const D1: ClassDecorator;
4
+ export declare const PlainOldObject: ClassDecorator;
5
+ export declare const WranglerEnv: ClassDecorator;
6
+ export declare const PrimaryKey: PropertyDecorator;
7
+ export declare const GET: MethodDecorator;
8
+ export declare const POST: MethodDecorator;
9
+ export declare const PUT: MethodDecorator;
10
+ export declare const PATCH: MethodDecorator;
11
+ export declare const DELETE: MethodDecorator;
12
+ export declare const DataSource: PropertyDecorator;
13
+ export declare const OneToMany: (_: string) => PropertyDecorator;
14
+ export declare const OneToOne: (_: string) => PropertyDecorator;
15
+ export declare const ManyToMany: (_: string) => PropertyDecorator;
16
+ export declare const ForeignKey: <T>(_: T) => PropertyDecorator;
17
+ export declare const Inject: ParameterDecorator;
18
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined;
19
+ export type IncludeTree<T> = T extends Primitive ? never : {
20
+ [K in keyof T]?: T[K] extends (infer U)[] ? IncludeTree<NonNullable<U>> : IncludeTree<NonNullable<T[K]>>;
21
+ };
22
+ //# sourceMappingURL=backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/index/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGvD,eAAO,MAAM,EAAE,EAAE,cAAyB,CAAC;AAC3C,eAAO,MAAM,cAAc,EAAE,cAAyB,CAAC;AACvD,eAAO,MAAM,WAAW,EAAE,cAAyB,CAAC;AACpD,eAAO,MAAM,UAAU,EAAE,iBAA4B,CAAC;AACtD,eAAO,MAAM,GAAG,EAAE,eAA0B,CAAC;AAC7C,eAAO,MAAM,IAAI,EAAE,eAA0B,CAAC;AAC9C,eAAO,MAAM,GAAG,EAAE,eAA0B,CAAC;AAC7C,eAAO,MAAM,KAAK,EAAE,eAA0B,CAAC;AAC/C,eAAO,MAAM,MAAM,EAAE,eAA0B,CAAC;AAChD,eAAO,MAAM,UAAU,EAAE,iBAA4B,CAAC;AACtD,eAAO,MAAM,SAAS,GACnB,GAAG,MAAM,KAAG,iBACL,CAAC;AACX,eAAO,MAAM,QAAQ,GAClB,GAAG,MAAM,KAAG,iBACL,CAAC;AACX,eAAO,MAAM,UAAU,GACpB,GAAG,MAAM,KAAG,iBACL,CAAC;AACX,eAAO,MAAM,UAAU,GACpB,CAAC,EAAE,GAAG,CAAC,KAAG,iBACH,CAAC;AACX,eAAO,MAAM,MAAM,EAAE,kBAA6B,CAAC;AAGnD,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAC5C,KAAK,GACL;KACG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACrC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC3B,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACnC,CAAC"}
@@ -1,4 +1,4 @@
1
- export { cloesce, modelsFromSql } from "./runtime/runtime.js";
1
+ export { cloesce, modelsFromSql } from "../runtime/runtime.js";
2
2
  // Compiler hints
3
3
  export const D1 = () => { };
4
4
  export const PlainOldObject = () => { };
@@ -15,10 +15,3 @@ export const OneToOne = (_) => () => { };
15
15
  export const ManyToMany = (_) => () => { };
16
16
  export const ForeignKey = (_) => () => { };
17
17
  export const Inject = () => { };
18
- // Helpers
19
- export function instantiateObjectArray(data, ctor) {
20
- if (Array.isArray(data)) {
21
- return data.map((x) => instantiateObjectArray(x, ctor)).flat();
22
- }
23
- return [Object.assign(new ctor(), data)];
24
- }
@@ -0,0 +1,5 @@
1
+ export type { HttpResult, Either } from "../common.js";
2
+ export declare function instantiateObjectArray<T extends object>(data: any, ctor: {
3
+ new (): T;
4
+ }): T[];
5
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/index/client.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGvD,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EACrD,IAAI,EAAE,GAAG,EACT,IAAI,EAAE;IAAE,QAAQ,CAAC,CAAA;CAAE,GAClB,CAAC,EAAE,CAKL"}
@@ -0,0 +1,7 @@
1
+ // Helpers
2
+ export function instantiateObjectArray(data, ctor) {
3
+ if (Array.isArray(data)) {
4
+ return data.map((x) => instantiateObjectArray(x, ctor)).flat();
5
+ }
6
+ return [Object.assign(new ctor(), data)];
7
+ }
@@ -0,0 +1,112 @@
1
+ import { HttpResult, Either, ModelMethod, CloesceAst, Model } from "../common.js";
2
+ import { IncludeTree } from "../index/backend.js";
3
+ /**
4
+ * Map of model names to their respective constructor.
5
+ *
6
+ * The value accepted into the `cloesce` function is generated by the Cloesce compiler, and
7
+ * is guaranteed to contain all model definitions.
8
+ */
9
+ type ModelConstructorRegistry = Record<string, new () => UserDefinedModel>;
10
+ /**
11
+ * Dependency injection container, mapping an object type name to an instance of that object.
12
+ *
13
+ * The value accepted into the `cloesce` function is generated by the Cloesce compiler, and is
14
+ * guaranteed to contain all injected model method parameters.
15
+ */
16
+ type InstanceRegistry = Map<string, any>;
17
+ /**
18
+ * Users will create Cloesce models, which have metadata for them in the ast.
19
+ * For TypeScript's purposes, these models can be anything. We can assume any
20
+ * `UserDefinedModel` has been verified by the compiler.
21
+ */
22
+ type UserDefinedModel = any;
23
+ /**
24
+ * Given a request, this represents a map of each body / url param name to
25
+ * its actual value. Unknown, as the a request can be anything.
26
+ */
27
+ type RequestParamMap = Record<string, unknown>;
28
+ /**
29
+ * Meta information on the wrangler env and db bindings
30
+ */
31
+ interface MetaWranglerEnv {
32
+ envName: string;
33
+ dbName: string;
34
+ }
35
+ /**
36
+ * WASM ABI
37
+ */
38
+ interface RuntimeWasmExports {
39
+ memory: WebAssembly.Memory;
40
+ get_return_len(): number;
41
+ set_meta_ptr(ptr: number, len: number): number;
42
+ alloc(len: number): number;
43
+ dealloc(ptr: number, len: number): void;
44
+ object_relational_mapping(model_name_ptr: number, model_name_len: number, sql_rows_ptr: number, sql_rows_len: number, include_tree_ptr: number, include_tree_len: number): number;
45
+ }
46
+ /**
47
+ * Singleton instances of the cidl, constructor registry, and wasm binary.
48
+ * These values are guaranteed to never change throughout a program lifetime.
49
+ */
50
+ declare class RuntimeContainer {
51
+ readonly ast: CloesceAst;
52
+ readonly constructorRegistry: ModelConstructorRegistry;
53
+ readonly wasm: RuntimeWasmExports;
54
+ private static instance;
55
+ private constructor();
56
+ static init(ast: CloesceAst, constructorRegistry: ModelConstructorRegistry, wasm?: WebAssembly.Instance): Promise<void>;
57
+ static get(): RuntimeContainer;
58
+ }
59
+ /**
60
+ * Runtime entry point. Given a request, undergoes: routing, validating,
61
+ * hydrating, and method dispatch.
62
+ *
63
+ * @returns A Response with an `HttpResult` JSON body.
64
+ */
65
+ export declare function cloesce(request: Request, ast: CloesceAst, constructorRegistry: ModelConstructorRegistry, instanceRegistry: InstanceRegistry, envMeta: MetaWranglerEnv, api_route: string): Promise<Response>;
66
+ /**
67
+ * Matches a request to a method on a model.
68
+ * @param api_route The route from the domain to the actual API, ie https://foo.com/route/to/api => route/to/api/
69
+ * @returns 404 or a `MatchedRoute`
70
+ */
71
+ declare function matchRoute(request: Request, ast: CloesceAst, api_route: string): Either<HttpResult, {
72
+ model: Model;
73
+ method: ModelMethod;
74
+ id: string | null;
75
+ }>;
76
+ /**
77
+ * Validates the request's body/search params against a ModelMethod
78
+ * @returns 400 or a `RequestParamMap` consisting of each parameters name mapped to its value, and
79
+ * a data source
80
+ */
81
+ declare function validateRequest(request: Request, ast: CloesceAst, model: Model, method: ModelMethod, id: string | null): Promise<Either<HttpResult, {
82
+ params: RequestParamMap;
83
+ dataSource: string | null;
84
+ }>>;
85
+ /**
86
+ * Calls a method on a model given a list of parameters.
87
+ * @returns 500 on an uncaught client error, 200 with a result body on success
88
+ */
89
+ declare function methodDispatch(instance: object, instanceRegistry: InstanceRegistry, envMeta: MetaWranglerEnv, method: ModelMethod, params: Record<string, unknown>): Promise<HttpResult<unknown>>;
90
+ /**
91
+ * Creates model instances given a properly formatted SQL record, being either:
92
+ *
93
+ * 1. Flat, relationship-less (ex: id, name, location, ...)
94
+ * 2. `DataSource` formatted (ex: Horse.id, Horse.name, Horse.rider, ...)
95
+ *
96
+ * @param ctor The type of the model
97
+ * @param records SQL records
98
+ * @param includeTree The include tree to use when parsing the records
99
+ * @returns An instantiated array of `T`, containing one or more objects.
100
+ */
101
+ export declare function modelsFromSql<T extends object>(ctor: new () => T, records: Record<string, any>[], includeTree: IncludeTree<T> | null): T[];
102
+ /**
103
+ * For testing purposes
104
+ */
105
+ export declare const _cloesceInternal: {
106
+ matchRoute: typeof matchRoute;
107
+ validateRequest: typeof validateRequest;
108
+ methodDispatch: typeof methodDispatch;
109
+ RuntimeContainer: typeof RuntimeContainer;
110
+ };
111
+ export {};
112
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,MA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,IAAI,EAAE,UAAU,CAAC,EACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAC9B,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,GACjC,CAAC,EAAE,CAoFL;AAaD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { left, right, isNullableType, getNavigationPropertyCidlType, } from "../common.js";
2
2
  // Requires the rust runtime binary to have been built
3
- import mod from "../../dist/runtime.wasm";
3
+ import mod from "../runtime.wasm";
4
4
  /**
5
5
  * RAII for wasm memory
6
6
  */
Binary file
package/package.json CHANGED
@@ -1,61 +1,63 @@
1
- {
2
- "name": "cloesce",
3
- "version": "0.0.3-fix.2",
4
- "description": "A tool to extract and compile TypeScript code into something wrangler can consume and deploy for D1 Databases and Cloudflare Workers",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "license": "Apache-2.0",
9
- "scripts": {
10
- "test": "vitest",
11
- "format:fix": "prettier --write .",
12
- "format": "prettier --check .",
13
- "typecheck": "tsc --noEmit",
14
- "build": "tsc -p tsconfig.json"
15
- },
16
- "dependencies": {
17
- "cmd-ts": "^0.14.1",
18
- "prettier": "^3.6.2",
19
- "ts-morph": "^22.0.0",
20
- "ts-node": "^10.9.2",
21
- "typescript": "^5.6.0",
22
- "wrangler": "^4.34.0"
23
- },
24
- "devDependencies": {
25
- "@cloudflare/workers-types": "^4.20250906.0",
26
- "prettier": "^3.6.2",
27
- "vitest": "^3.2.4",
28
- "vite-plugin-wasm": "^3.5.0"
29
- },
30
- "exports": {
31
- ".": {
32
- "types": "./dist/index.d.ts",
33
- "import": "./dist/index.js"
34
- },
35
- "./cli": "./dist/cli.js"
36
- },
37
- "bin": {
38
- "cloesce": "./dist/extractor/cli.js"
39
- },
40
- "files": [
41
- "dist/**/*",
42
- "README.md",
43
- "LICENSE"
44
- ],
45
- "sideEffects": false,
46
- "engines": {
47
- "node": ">=18.17"
48
- },
49
- "repository": {
50
- "type": "git",
51
- "url": "git+https://github.com/bens-schreiber/cloesce.git"
52
- },
53
- "homepage": "https://github.com/bens-schreiber/cloesce",
54
- "keywords": [
55
- "cloudflare",
56
- "workers",
57
- "d1",
58
- "orm",
59
- "cli"
60
- ]
61
- }
1
+ {
2
+ "name": "cloesce",
3
+ "version": "0.0.3-fix.5",
4
+ "description": "A tool to extract and compile TypeScript code into something wrangler can consume and deploy for D1 Databases and Cloudflare Workers",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "scripts": {
8
+ "test": "vitest",
9
+ "format:fix": "prettier --write .",
10
+ "format": "prettier --check .",
11
+ "typecheck": "tsc --noEmit",
12
+ "build": "tsc -p tsconfig.json && npm run copy-rs-runtime-wasm && npm run copy-generator-wasm",
13
+ "copy-rs-runtime-wasm": "cp ../../runtime/target/wasm32-unknown-unknown/release/runtime.wasm ./dist/runtime.wasm",
14
+ "copy-generator-wasm": "cp ../../generator/target/wasm32-wasip1/release/cli.wasm ./dist/generator.wasm"
15
+ },
16
+ "dependencies": {
17
+ "cmd-ts": "^0.14.1",
18
+ "ts-morph": "^22.0.0",
19
+ "wrangler": "^4.34.0"
20
+ },
21
+ "devDependencies": {
22
+ "@cloudflare/workers-types": "^4.20250906.0",
23
+ "ts-node": "^10.9.2",
24
+ "typescript": "^5.6.0",
25
+ "prettier": "^3.6.2",
26
+ "vitest": "^3.2.4",
27
+ "vite-plugin-wasm": "^3.5.0"
28
+ },
29
+ "exports": {
30
+ "./client": {
31
+ "types": "./dist/index/client.d.ts",
32
+ "import": "./dist/index/client.js"
33
+ },
34
+ "./backend": {
35
+ "types": "./dist/index/backend.d.ts",
36
+ "import": "./dist/index/backend.js"
37
+ }
38
+ },
39
+ "bin": {
40
+ "cloesce": "dist/cli.js"
41
+ },
42
+ "files": [
43
+ "dist/**/*",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "sideEffects": false,
48
+ "engines": {
49
+ "node": ">=18.17"
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/bens-schreiber/cloesce.git"
54
+ },
55
+ "homepage": "https://github.com/bens-schreiber/cloesce",
56
+ "keywords": [
57
+ "cloudflare",
58
+ "workers",
59
+ "d1",
60
+ "orm",
61
+ "cli"
62
+ ]
63
+ }
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
package/README.md DELETED
@@ -1,23 +0,0 @@
1
- # cloesce
2
-
3
- View the [internal documentation](https://cloesce.pages.dev)
4
-
5
- ### Unit Tests
6
-
7
- - `src/extractor/ts` run `npm test`
8
- - `src/generator` run `cargo test`
9
-
10
- ### Integration Tests
11
-
12
- - To run the regression tests: `cargo run --bin test regression`
13
- - To run the pass fail extractor tests: `cargo run --bin test run-fail`
14
-
15
- Optionally, pass `--check` if new snapshots should not be created.
16
-
17
- ### E2E
18
-
19
- - `tests/e2e` run `npm test`
20
-
21
- ### Code Formatting
22
-
23
- - `cargo fmt`, `cargo clippy`, `npm run format:fix`
Binary file
Binary file