cloesce 0.0.3-fix.6 → 0.0.4-unstable.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/dist/README.md +154 -70
- package/dist/cli.js +65 -85
- package/dist/common.d.ts +49 -11
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +72 -11
- package/dist/extractor/extract.d.ts +2 -0
- package/dist/extractor/extract.d.ts.map +1 -1
- package/dist/extractor/extract.js +242 -43
- package/dist/generator.wasm +0 -0
- package/dist/orm.wasm +0 -0
- package/dist/router/crud.d.ts +22 -0
- package/dist/router/crud.d.ts.map +1 -0
- package/dist/router/crud.js +65 -0
- package/dist/router/router.d.ts +77 -0
- package/dist/router/router.d.ts.map +1 -0
- package/dist/{runtime/runtime.js → router/router.js} +119 -161
- package/dist/router/wasm.d.ts +37 -0
- package/dist/router/wasm.d.ts.map +1 -0
- package/dist/router/wasm.js +98 -0
- package/dist/ui/backend.d.ts +124 -0
- package/dist/ui/backend.d.ts.map +1 -0
- package/dist/ui/backend.js +201 -0
- package/dist/{index → ui}/client.d.ts +1 -1
- package/dist/ui/client.d.ts.map +1 -0
- package/package.json +15 -13
- package/dist/LICENSE +0 -201
- package/dist/index/backend.d.ts +0 -22
- package/dist/index/backend.d.ts.map +0 -1
- package/dist/index/backend.js +0 -17
- package/dist/index/client.d.ts.map +0 -1
- package/dist/runtime/runtime.d.ts +0 -112
- package/dist/runtime/runtime.d.ts.map +0 -1
- package/dist/runtime.wasm +0 -0
- /package/dist/{index → ui}/client.js +0 -0
package/dist/common.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export type DeepPartial<T> = T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? {
|
|
2
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
3
|
+
} : T;
|
|
1
4
|
export type Either<L, R> = {
|
|
2
5
|
ok: false;
|
|
3
6
|
value: L;
|
|
@@ -8,17 +11,23 @@ export type Either<L, R> = {
|
|
|
8
11
|
export declare function left<L>(value: L): Either<L, never>;
|
|
9
12
|
export declare function right<R>(value: R): Either<never, R>;
|
|
10
13
|
export declare enum ExtractorErrorCode {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
MissingExport = 0,
|
|
15
|
+
AppMissingDefaultExport = 1,
|
|
16
|
+
UnknownType = 2,
|
|
17
|
+
MultipleGenericType = 3,
|
|
18
|
+
DataSourceMissingStatic = 4,
|
|
19
|
+
InvalidPartialType = 5,
|
|
20
|
+
InvalidIncludeTree = 6,
|
|
21
|
+
InvalidAttributeModifier = 7,
|
|
22
|
+
InvalidApiMethodModifier = 8,
|
|
23
|
+
UnknownNavigationPropertyReference = 9,
|
|
24
|
+
InvalidNavigationPropertyReference = 10,
|
|
25
|
+
MissingNavigationPropertyReference = 11,
|
|
26
|
+
MissingManyToManyUniqueId = 12,
|
|
27
|
+
MissingPrimaryKey = 13,
|
|
28
|
+
MissingWranglerEnv = 14,
|
|
29
|
+
TooManyWranglerEnvs = 15,
|
|
30
|
+
MissingFile = 16
|
|
22
31
|
}
|
|
23
32
|
export declare function getErrorInfo(code: ExtractorErrorCode): {
|
|
24
33
|
description: string;
|
|
@@ -37,10 +46,37 @@ export type HttpResult<T = unknown> = {
|
|
|
37
46
|
data?: T;
|
|
38
47
|
message?: string;
|
|
39
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Dependency injection container, mapping an object type name to an instance of that object.
|
|
51
|
+
*
|
|
52
|
+
* Comes with the WranglerEnv and Request by default.
|
|
53
|
+
*/
|
|
54
|
+
export type InstanceRegistry = Map<string, any>;
|
|
55
|
+
export type MiddlewareFn = (request: Request, env: any, ir: InstanceRegistry) => Promise<HttpResult | undefined>;
|
|
56
|
+
export type KeysOfType<T, U> = {
|
|
57
|
+
[K in keyof T]: T[K] extends U ? (K extends string ? K : never) : never;
|
|
58
|
+
}[keyof T];
|
|
59
|
+
/**
|
|
60
|
+
* A container for middleware. If an instance is exported from `app.cloesce.ts`, it will be used in the
|
|
61
|
+
* appropriate location, with global middleware happening before any routing occurs.
|
|
62
|
+
*/
|
|
63
|
+
export declare class CloesceApp {
|
|
64
|
+
global: MiddlewareFn[];
|
|
65
|
+
model: Map<string, MiddlewareFn[]>;
|
|
66
|
+
method: Map<string, Map<string, MiddlewareFn[]>>;
|
|
67
|
+
useGlobal(m: MiddlewareFn): void;
|
|
68
|
+
useModel<T>(ctor: new () => T, m: MiddlewareFn): void;
|
|
69
|
+
useMethod<T>(ctor: new () => T, method: KeysOfType<T, (...args: any) => any>, m: MiddlewareFn): void;
|
|
70
|
+
}
|
|
71
|
+
export type CrudKind = "POST" | "GET" | "LIST";
|
|
40
72
|
export type CidlType = "Void" | "Integer" | "Real" | "Text" | "Blob" | {
|
|
73
|
+
DataSource: string;
|
|
74
|
+
} | {
|
|
41
75
|
Inject: string;
|
|
42
76
|
} | {
|
|
43
77
|
Object: string;
|
|
78
|
+
} | {
|
|
79
|
+
Partial: string;
|
|
44
80
|
} | {
|
|
45
81
|
Nullable: CidlType;
|
|
46
82
|
} | {
|
|
@@ -107,6 +143,7 @@ export interface PlainOldObject {
|
|
|
107
143
|
export interface CidlIncludeTree {
|
|
108
144
|
[key: string]: CidlIncludeTree;
|
|
109
145
|
}
|
|
146
|
+
export declare const NO_DATA_SOURCE = "none";
|
|
110
147
|
export interface DataSource {
|
|
111
148
|
name: string;
|
|
112
149
|
tree: CidlIncludeTree;
|
|
@@ -122,5 +159,6 @@ export interface CloesceAst {
|
|
|
122
159
|
wrangler_env: WranglerEnv;
|
|
123
160
|
models: Record<string, Model>;
|
|
124
161
|
poos: Record<string, PlainOldObject>;
|
|
162
|
+
app_source: string | null;
|
|
125
163
|
}
|
|
126
164
|
//# sourceMappingURL=common.d.ts.map
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAC9C,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAER,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,aAAa,IAAA;IACb,uBAAuB,IAAA;IACvB,WAAW,IAAA;IACX,mBAAmB,IAAA;IACnB,uBAAuB,IAAA;IACvB,kBAAkB,IAAA;IAClB,kBAAkB,IAAA;IAClB,wBAAwB,IAAA;IACxB,wBAAwB,IAAA;IACxB,kCAAkC,IAAA;IAClC,kCAAkC,KAAA;IAClC,kCAAkC,KAAA;IAClC,yBAAyB,KAAA;IACzB,iBAAiB,KAAA;IACjB,kBAAkB,KAAA;IAClB,mBAAmB,KAAA;IACnB,WAAW,KAAA;CACZ;AAmFD,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBA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B;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;IACrC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
|
package/dist/common.js
CHANGED
|
@@ -6,31 +6,61 @@ export function right(value) {
|
|
|
6
6
|
}
|
|
7
7
|
export var ExtractorErrorCode;
|
|
8
8
|
(function (ExtractorErrorCode) {
|
|
9
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
10
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
11
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
12
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
13
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
14
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
15
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
16
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
17
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
18
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
19
|
-
ExtractorErrorCode[ExtractorErrorCode["
|
|
9
|
+
ExtractorErrorCode[ExtractorErrorCode["MissingExport"] = 0] = "MissingExport";
|
|
10
|
+
ExtractorErrorCode[ExtractorErrorCode["AppMissingDefaultExport"] = 1] = "AppMissingDefaultExport";
|
|
11
|
+
ExtractorErrorCode[ExtractorErrorCode["UnknownType"] = 2] = "UnknownType";
|
|
12
|
+
ExtractorErrorCode[ExtractorErrorCode["MultipleGenericType"] = 3] = "MultipleGenericType";
|
|
13
|
+
ExtractorErrorCode[ExtractorErrorCode["DataSourceMissingStatic"] = 4] = "DataSourceMissingStatic";
|
|
14
|
+
ExtractorErrorCode[ExtractorErrorCode["InvalidPartialType"] = 5] = "InvalidPartialType";
|
|
15
|
+
ExtractorErrorCode[ExtractorErrorCode["InvalidIncludeTree"] = 6] = "InvalidIncludeTree";
|
|
16
|
+
ExtractorErrorCode[ExtractorErrorCode["InvalidAttributeModifier"] = 7] = "InvalidAttributeModifier";
|
|
17
|
+
ExtractorErrorCode[ExtractorErrorCode["InvalidApiMethodModifier"] = 8] = "InvalidApiMethodModifier";
|
|
18
|
+
ExtractorErrorCode[ExtractorErrorCode["UnknownNavigationPropertyReference"] = 9] = "UnknownNavigationPropertyReference";
|
|
19
|
+
ExtractorErrorCode[ExtractorErrorCode["InvalidNavigationPropertyReference"] = 10] = "InvalidNavigationPropertyReference";
|
|
20
|
+
ExtractorErrorCode[ExtractorErrorCode["MissingNavigationPropertyReference"] = 11] = "MissingNavigationPropertyReference";
|
|
21
|
+
ExtractorErrorCode[ExtractorErrorCode["MissingManyToManyUniqueId"] = 12] = "MissingManyToManyUniqueId";
|
|
22
|
+
ExtractorErrorCode[ExtractorErrorCode["MissingPrimaryKey"] = 13] = "MissingPrimaryKey";
|
|
23
|
+
ExtractorErrorCode[ExtractorErrorCode["MissingWranglerEnv"] = 14] = "MissingWranglerEnv";
|
|
24
|
+
ExtractorErrorCode[ExtractorErrorCode["TooManyWranglerEnvs"] = 15] = "TooManyWranglerEnvs";
|
|
25
|
+
ExtractorErrorCode[ExtractorErrorCode["MissingFile"] = 16] = "MissingFile";
|
|
20
26
|
})(ExtractorErrorCode || (ExtractorErrorCode = {}));
|
|
21
27
|
const errorInfoMap = {
|
|
28
|
+
[ExtractorErrorCode.MissingExport]: {
|
|
29
|
+
description: "All Cloesce types must be exported.",
|
|
30
|
+
suggestion: "Add `export` to the class definition.",
|
|
31
|
+
},
|
|
32
|
+
[ExtractorErrorCode.AppMissingDefaultExport]: {
|
|
33
|
+
description: "app.cloesce.ts does not export a CloesceApp by default",
|
|
34
|
+
suggestion: "Export an instantiated CloesceApp in app.cloesce.ts",
|
|
35
|
+
},
|
|
22
36
|
[ExtractorErrorCode.UnknownType]: {
|
|
23
37
|
description: "Encountered an unknown or unsupported type",
|
|
24
38
|
suggestion: "Refer to the documentation on valid Cloesce TS types",
|
|
25
39
|
},
|
|
40
|
+
[ExtractorErrorCode.InvalidPartialType]: {
|
|
41
|
+
description: "Partial types must only contain a model or plain old object",
|
|
42
|
+
suggestion: "Refer to the documentation on valid Cloesce TS types",
|
|
43
|
+
},
|
|
26
44
|
[ExtractorErrorCode.MultipleGenericType]: {
|
|
27
45
|
description: "Cloesce does not yet support types with multiple generics",
|
|
28
46
|
suggestion: "Simplify your type to use only a single generic parameter, ie Foo<T>",
|
|
29
47
|
},
|
|
48
|
+
[ExtractorErrorCode.DataSourceMissingStatic]: {
|
|
49
|
+
description: "Data Sources must be declared as static",
|
|
50
|
+
suggestion: "Declare your data source as `static readonly`",
|
|
51
|
+
},
|
|
30
52
|
[ExtractorErrorCode.InvalidIncludeTree]: {
|
|
31
53
|
description: "Invalid Include Tree",
|
|
32
54
|
suggestion: "Include trees must only contain references to a model's navigation properties.",
|
|
33
55
|
},
|
|
56
|
+
[ExtractorErrorCode.InvalidAttributeModifier]: {
|
|
57
|
+
description: "Attributes can only be public on a Model, Plain Old Object or Wrangler Environment",
|
|
58
|
+
suggestion: "Change the attribute modifier to just `public`",
|
|
59
|
+
},
|
|
60
|
+
[ExtractorErrorCode.InvalidApiMethodModifier]: {
|
|
61
|
+
description: "Model methods must be public if they are decorated as GET, POST, PUT, PATCH",
|
|
62
|
+
suggestion: "Change the method modifier to just `public`",
|
|
63
|
+
},
|
|
34
64
|
[ExtractorErrorCode.UnknownNavigationPropertyReference]: {
|
|
35
65
|
description: "Unknown Navigation Property Reference",
|
|
36
66
|
suggestion: "Verify that the navigation property reference model exists, or create a model.",
|
|
@@ -78,6 +108,36 @@ export class ExtractorError {
|
|
|
78
108
|
this.context = fn(this.context ?? "");
|
|
79
109
|
}
|
|
80
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* A container for middleware. If an instance is exported from `app.cloesce.ts`, it will be used in the
|
|
113
|
+
* appropriate location, with global middleware happening before any routing occurs.
|
|
114
|
+
*/
|
|
115
|
+
export class CloesceApp {
|
|
116
|
+
global = [];
|
|
117
|
+
model = new Map();
|
|
118
|
+
method = new Map();
|
|
119
|
+
useGlobal(m) {
|
|
120
|
+
this.global.push(m);
|
|
121
|
+
}
|
|
122
|
+
useModel(ctor, m) {
|
|
123
|
+
if (this.model.has(ctor.name)) {
|
|
124
|
+
this.model.get(ctor.name).push(m);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.model.set(ctor.name, [m]);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
useMethod(ctor, method, m) {
|
|
131
|
+
if (!this.method.has(ctor.name)) {
|
|
132
|
+
this.method.set(ctor.name, new Map());
|
|
133
|
+
}
|
|
134
|
+
const methods = this.method.get(ctor.name);
|
|
135
|
+
if (!methods.has(method)) {
|
|
136
|
+
methods.set(method, []);
|
|
137
|
+
}
|
|
138
|
+
methods.get(method).push(m);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
81
141
|
export function isNullableType(ty) {
|
|
82
142
|
return typeof ty === "object" && ty !== null && "Nullable" in ty;
|
|
83
143
|
}
|
|
@@ -94,3 +154,4 @@ export function getNavigationPropertyCidlType(nav) {
|
|
|
94
154
|
? { Object: nav.model_name }
|
|
95
155
|
: { Array: { Object: nav.model_name } };
|
|
96
156
|
}
|
|
157
|
+
export const NO_DATA_SOURCE = "none";
|
|
@@ -5,11 +5,13 @@ export declare class CidlExtractor {
|
|
|
5
5
|
version: string;
|
|
6
6
|
constructor(projectName: string, version: string);
|
|
7
7
|
extract(project: Project): Either<ExtractorError, CloesceAst>;
|
|
8
|
+
private static app;
|
|
8
9
|
private static model;
|
|
9
10
|
private static poo;
|
|
10
11
|
private static readonly primTypeMap;
|
|
11
12
|
private static cidlType;
|
|
12
13
|
private static includeTree;
|
|
13
14
|
private static method;
|
|
15
|
+
private static crudMethod;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/extractor/extract.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/extractor/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EAUR,MAAM,UAAU,CAAC;AAElB,OAAO,EAEL,UAAU,EAGV,MAAM,EAUN,cAAc,EAKf,MAAM,cAAc,CAAC;AAuBtB,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;IA8F7D,OAAO,CAAC,MAAM,CAAC,GAAG;IA0BlB,OAAO,CAAC,MAAM,CAAC,KAAK;IAgQpB,OAAO,CAAC,MAAM,CAAC,GAAG;IAsClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAOjC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ;IAkJvB,OAAO,CAAC,MAAM,CAAC,WAAW;IAqF1B,OAAO,CAAC,MAAM,CAAC,MAAM;IAiFrB,OAAO,CAAC,MAAM,CAAC,UAAU;CAsD1B"}
|