@liminalfunctions/framework 1.0.62 → 1.0.63
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/code_generation/generate_client_library.js +1 -0
- package/dist/code_generation/generate_client_library.js.map +1 -1
- package/dist/code_generation/templates/collection.mustache +8 -36
- package/dist/code_generation/templates/main.mustache +1 -1
- package/dist/code_generation/templates/root_types.ts.mustache +69 -0
- package/package.json +1 -1
- package/src/code_generation/generate_client_library.ts +1 -0
- package/src/code_generation/templates/collection.mustache +8 -36
- package/src/code_generation/templates/main.mustache +1 -1
- package/src/code_generation/templates/root_types.ts.mustache +69 -0
- package/test/2_1_client_library_generation.test.ts +1 -1
- package/test/tmp/dist/Brief_News_Category.d.ts +4 -12
- package/test/tmp/dist/Brief_News_Category.js +6 -21
- package/test/tmp/dist/Brief_News_Category.js.map +1 -1
- package/test/tmp/dist/Client.d.ts +4 -12
- package/test/tmp/dist/Client.js +6 -21
- package/test/tmp/dist/Client.js.map +1 -1
- package/test/tmp/dist/Institution.d.ts +4 -12
- package/test/tmp/dist/Institution.js +6 -21
- package/test/tmp/dist/Institution.js.map +1 -1
- package/test/tmp/dist/Project.d.ts +5 -18
- package/test/tmp/dist/Project.js +8 -32
- package/test/tmp/dist/Project.js.map +1 -1
- package/test/tmp/dist/index.d.ts +1 -2
- package/test/tmp/dist/index.js +1 -1
- package/test/tmp/dist/index.js.map +1 -1
- package/test/tmp/dist/root_types.d.ts +41 -0
- package/test/tmp/dist/root_types.js +41 -0
- package/test/tmp/dist/root_types.js.map +1 -0
- package/test/tmp/src/Brief_News_Category.ts +6 -25
- package/test/tmp/src/Client.ts +6 -25
- package/test/tmp/src/Institution.ts +6 -25
- package/test/tmp/src/Project.ts +8 -36
- package/test/tmp/src/index.ts +1 -1
- package/test/tmp/src/root_types.ts +69 -0
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import ky from "ky";
|
|
2
2
|
import { encode_search_params } from "./utils/utils.js";
|
|
3
|
+
import { Collection, Bare_Document } from "./root_types.js";
|
|
3
4
|
import { Collection_Client } from "./Client.js";
|
|
4
|
-
export class Collection_Institution {
|
|
5
|
-
path;
|
|
6
|
-
get_auth;
|
|
7
|
-
collection_id;
|
|
8
|
-
collection_name_plural;
|
|
5
|
+
export class Collection_Institution extends Collection {
|
|
9
6
|
constructor(path, get_auth) {
|
|
10
|
-
|
|
11
|
-
this.get_auth = get_auth;
|
|
12
|
-
this.collection_id = "institution";
|
|
13
|
-
this.collection_name_plural = "institutions";
|
|
7
|
+
super(path, get_auth, "institution", "institutions");
|
|
14
8
|
}
|
|
15
9
|
async query(query) {
|
|
16
10
|
try {
|
|
@@ -45,21 +39,12 @@ export class Collection_Institution {
|
|
|
45
39
|
let get_auth = this.get_auth;
|
|
46
40
|
let collection_id = this.collection_id;
|
|
47
41
|
let collection_name_plural = this.collection_name_plural;
|
|
48
|
-
return new
|
|
42
|
+
return new Document_Institution(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
49
43
|
}
|
|
50
44
|
}
|
|
51
|
-
class
|
|
52
|
-
path;
|
|
53
|
-
collection_id;
|
|
54
|
-
document_id;
|
|
55
|
-
collection_name_plural;
|
|
56
|
-
get_auth;
|
|
45
|
+
class Document_Institution extends Bare_Document {
|
|
57
46
|
constructor(path, collection_id, document_id, collection_name_plural, get_auth) {
|
|
58
|
-
|
|
59
|
-
this.collection_id = collection_id;
|
|
60
|
-
this.document_id = document_id;
|
|
61
|
-
this.collection_name_plural = collection_name_plural;
|
|
62
|
-
this.get_auth = get_auth;
|
|
47
|
+
super(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
63
48
|
}
|
|
64
49
|
async get() {
|
|
65
50
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Institution.js","sourceRoot":"","sources":["../src/Institution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAA+B,MAAM,k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
|
|
1
|
+
import { Collection, Bare_Document, Document_Array, _Base_Document, _With_Array } from "./root_types.js";
|
|
1
2
|
import { project } from "./types/project.js";
|
|
2
3
|
import { project_query } from "./types/project_query.js";
|
|
3
4
|
import { project_put } from "./types/project_put.js";
|
|
4
5
|
import { project_post } from "./types/project_post.js";
|
|
5
|
-
export declare class Collection_Project {
|
|
6
|
-
path: string[];
|
|
7
|
-
get_auth: () => Promise<any>;
|
|
8
|
-
collection_id: string;
|
|
9
|
-
collection_name_plural: string;
|
|
6
|
+
export declare class Collection_Project extends Collection {
|
|
10
7
|
constructor(path: string[], get_auth: () => Promise<any>);
|
|
11
8
|
query(query: project_query): Promise<project[]>;
|
|
12
9
|
post(document: project_post): Promise<project>;
|
|
13
|
-
document(document_id: string):
|
|
10
|
+
document(document_id: string): Document_Project;
|
|
14
11
|
}
|
|
15
|
-
declare class
|
|
16
|
-
path: string[];
|
|
17
|
-
collection_id: string;
|
|
18
|
-
document_id: string;
|
|
19
|
-
collection_name_plural: string;
|
|
20
|
-
get_auth: () => Promise<any>;
|
|
12
|
+
declare class Document_Project extends Bare_Document implements _Base_Document, _With_Array {
|
|
21
13
|
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>);
|
|
22
14
|
get(): Promise<project>;
|
|
23
15
|
put(update: project_put): Promise<project>;
|
|
@@ -32,12 +24,7 @@ export type project_steps_post = {
|
|
|
32
24
|
"_id"?: string;
|
|
33
25
|
"name": string;
|
|
34
26
|
};
|
|
35
|
-
export declare class Collection_Project_Array_steps {
|
|
36
|
-
path: string[];
|
|
37
|
-
get_auth: () => Promise<any>;
|
|
38
|
-
collection_id: string;
|
|
39
|
-
collection_name_plural: string;
|
|
40
|
-
array_key: string;
|
|
27
|
+
export declare class Collection_Project_Array_steps extends Document_Array {
|
|
41
28
|
constructor(path: string[], get_auth: () => Promise<any>);
|
|
42
29
|
push(document: project_steps_post): Promise<project>;
|
|
43
30
|
replace(document: project_steps_put): Promise<project>;
|
package/test/tmp/dist/Project.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import ky from "ky";
|
|
2
2
|
import { encode_search_params } from "./utils/utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
get_auth;
|
|
6
|
-
collection_id;
|
|
7
|
-
collection_name_plural;
|
|
3
|
+
import { Collection, Bare_Document, Document_Array } from "./root_types.js";
|
|
4
|
+
export class Collection_Project extends Collection {
|
|
8
5
|
constructor(path, get_auth) {
|
|
9
|
-
|
|
10
|
-
this.get_auth = get_auth;
|
|
11
|
-
this.collection_id = "project";
|
|
12
|
-
this.collection_name_plural = "projects";
|
|
6
|
+
super(path, get_auth, "project", "projects");
|
|
13
7
|
}
|
|
14
8
|
async query(query) {
|
|
15
9
|
try {
|
|
@@ -44,21 +38,12 @@ export class Collection_Project {
|
|
|
44
38
|
let get_auth = this.get_auth;
|
|
45
39
|
let collection_id = this.collection_id;
|
|
46
40
|
let collection_name_plural = this.collection_name_plural;
|
|
47
|
-
return new
|
|
41
|
+
return new Document_Project(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
48
42
|
}
|
|
49
43
|
}
|
|
50
|
-
class
|
|
51
|
-
path;
|
|
52
|
-
collection_id;
|
|
53
|
-
document_id;
|
|
54
|
-
collection_name_plural;
|
|
55
|
-
get_auth;
|
|
44
|
+
class Document_Project extends Bare_Document {
|
|
56
45
|
constructor(path, collection_id, document_id, collection_name_plural, get_auth) {
|
|
57
|
-
|
|
58
|
-
this.collection_id = collection_id;
|
|
59
|
-
this.document_id = document_id;
|
|
60
|
-
this.collection_name_plural = collection_name_plural;
|
|
61
|
-
this.get_auth = get_auth;
|
|
46
|
+
super(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
62
47
|
}
|
|
63
48
|
async get() {
|
|
64
49
|
try {
|
|
@@ -109,18 +94,9 @@ class Document {
|
|
|
109
94
|
}
|
|
110
95
|
}
|
|
111
96
|
}
|
|
112
|
-
export class Collection_Project_Array_steps {
|
|
113
|
-
path;
|
|
114
|
-
get_auth;
|
|
115
|
-
collection_id;
|
|
116
|
-
collection_name_plural;
|
|
117
|
-
array_key;
|
|
97
|
+
export class Collection_Project_Array_steps extends Document_Array {
|
|
118
98
|
constructor(path, get_auth) {
|
|
119
|
-
|
|
120
|
-
this.get_auth = get_auth;
|
|
121
|
-
this.collection_id = "project";
|
|
122
|
-
this.collection_name_plural = "projects";
|
|
123
|
-
this.array_key = "steps";
|
|
99
|
+
super(path, get_auth, "project", "projects", "steps");
|
|
124
100
|
}
|
|
125
101
|
async push(document) {
|
|
126
102
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Project.js","sourceRoot":"","sources":["../src/Project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAA+B,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Project.js","sourceRoot":"","sources":["../src/Project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAA+B,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAA+C,MAAM,iBAAiB,CAAA;AAQxH,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAC9C,YAAY,IAAc,EAAE,QAA4B;QACpD,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACjD,CAAC;IAGD,KAAK,CAAC,KAAK,CAAC,KAAoB;QAC5B,IAAI,CAAC;YACD,IAAI,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAC3C,OAAO,EAAE;oBACL,aAAa,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE;iBACvC;gBACD,YAAY,EAAE,oBAAoB,CAAC,KAAK,CAAC;aA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I,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAC9D,OAAO,EAAE;oBACL,aAAa,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE;iBACvC;gBACD,IAAI,EAAE,QAAQ;aACjB,CAAC,CAAC,IAAI,EAAuB,CAAC;YAC/B,OAAO,MAAM,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAM,GAAG,EAAC,CAAC;YACT,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC9B,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC5B,IAAI,CAAC;YACD,IAAI,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAChE,OAAO,EAAE;oBACL,aAAa,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE;iBACvC;aACJ,CAAC,CAAC,IAAI,EAAuB,CAAC;YAC/B,OAAO,MAAM,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAM,GAAG,EAAC,CAAC;YACT,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC9B,CAAC;IACL,CAAC;CACJ"}
|
package/test/tmp/dist/index.d.ts
CHANGED
|
@@ -14,11 +14,10 @@ export type Auth_Data = {
|
|
|
14
14
|
metadata?: any;
|
|
15
15
|
};
|
|
16
16
|
export declare function api(base_url: string, get_auth: () => Promise<any>): Api;
|
|
17
|
-
declare class Api {
|
|
17
|
+
export declare class Api {
|
|
18
18
|
base_url: string;
|
|
19
19
|
get_auth: () => Promise<any>;
|
|
20
20
|
constructor(base_url: string, get_auth: () => Promise<any>);
|
|
21
21
|
collection(collection_id: "institution"): Collection_Institution;
|
|
22
22
|
me(): Promise<Auth_Data>;
|
|
23
23
|
}
|
|
24
|
-
export {};
|
package/test/tmp/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAczD,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,QAA4B;IAC9D,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,GAAG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAczD,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,QAA4B;IAC9D,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,OAAO,GAAG;IACZ,QAAQ,CAAS;IACjB,QAAQ,CAAoB;IAE5B,YAAY,QAAgB,EAAE,QAA4B;QACtD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC5B,CAAC;IAGD,UAAU,CAAC,aAAqB;QAC5B,QAAO,aAAa,EAAE,CAAC;YACnB,KAAK,aAAa;gBACd,OAAO,IAAI,sBAAsB,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACrF;gBACI,MAAM,IAAI,KAAK,CAAC,oCAAoC,aAAa,EAAE,CAAC,CAAA;QAC5E,CAAC;IACL,CAAC;IAED,KAAK,CAAC,EAAE;QACJ,IAAI,CAAC;YACD,IAAI,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACvD,OAAO,EAAE;oBACL,aAAa,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE;iBACvC;aACJ,CAAC,CAAC,IAAI,EAAe,CAAC;YACvB,OAAO,MAAM,CAAC;QAClB,CAAC;QAAC,OAAM,GAAG,EAAC,CAAC;YACT,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC9B,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare abstract class Collection {
|
|
2
|
+
path: string[];
|
|
3
|
+
get_auth: () => Promise<any>;
|
|
4
|
+
collection_id: string;
|
|
5
|
+
collection_name_plural: string;
|
|
6
|
+
constructor(path: string[], get_auth: () => Promise<any>, collection_id: string, collection_name_plural: string);
|
|
7
|
+
abstract query(query: any): Promise<any[]>;
|
|
8
|
+
abstract post(document: any): Promise<any>;
|
|
9
|
+
abstract document(document_id: string): Document;
|
|
10
|
+
}
|
|
11
|
+
export type Document = (Bare_Document & _Base_Document) | (Bare_Document & _Base_Document & _With_Children) | (Bare_Document & _Base_Document & _With_Array) | (Bare_Document & _Base_Document & _With_Array & _With_Children);
|
|
12
|
+
export declare abstract class Bare_Document {
|
|
13
|
+
path: string[];
|
|
14
|
+
collection_id: string;
|
|
15
|
+
document_id: string;
|
|
16
|
+
collection_name_plural: string;
|
|
17
|
+
get_auth: () => Promise<any>;
|
|
18
|
+
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>);
|
|
19
|
+
}
|
|
20
|
+
export interface _Base_Document {
|
|
21
|
+
get(): any;
|
|
22
|
+
put(update: any): Promise<any>;
|
|
23
|
+
remove(): Promise<any>;
|
|
24
|
+
}
|
|
25
|
+
export interface _With_Children {
|
|
26
|
+
collection(collection_id: string): Collection;
|
|
27
|
+
}
|
|
28
|
+
export interface _With_Array {
|
|
29
|
+
array(key: string): Document_Array;
|
|
30
|
+
}
|
|
31
|
+
export declare abstract class Document_Array {
|
|
32
|
+
path: string[];
|
|
33
|
+
collection_id: string;
|
|
34
|
+
collection_name_plural: string;
|
|
35
|
+
array_key: string;
|
|
36
|
+
get_auth: () => Promise<any>;
|
|
37
|
+
constructor(path: string[], get_auth: () => Promise<any>, collection_id: string, collection_name_plural: string, array_key: string);
|
|
38
|
+
abstract push(document: any): Promise<any>;
|
|
39
|
+
abstract replace(document: any): Promise<any>;
|
|
40
|
+
abstract delete(document_id: string): Promise<any>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export class Collection {
|
|
2
|
+
path;
|
|
3
|
+
get_auth;
|
|
4
|
+
collection_id;
|
|
5
|
+
collection_name_plural;
|
|
6
|
+
constructor(path, get_auth, collection_id, collection_name_plural) {
|
|
7
|
+
this.path = path;
|
|
8
|
+
this.get_auth = get_auth;
|
|
9
|
+
this.collection_id = collection_id;
|
|
10
|
+
this.collection_name_plural = collection_name_plural;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export class Bare_Document {
|
|
14
|
+
path;
|
|
15
|
+
collection_id;
|
|
16
|
+
document_id;
|
|
17
|
+
collection_name_plural;
|
|
18
|
+
get_auth;
|
|
19
|
+
constructor(path, collection_id, document_id, collection_name_plural, get_auth) {
|
|
20
|
+
this.path = path;
|
|
21
|
+
this.collection_id = collection_id;
|
|
22
|
+
this.document_id = document_id;
|
|
23
|
+
this.collection_name_plural = collection_name_plural;
|
|
24
|
+
this.get_auth = get_auth;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class Document_Array {
|
|
28
|
+
path;
|
|
29
|
+
collection_id;
|
|
30
|
+
collection_name_plural;
|
|
31
|
+
array_key;
|
|
32
|
+
get_auth;
|
|
33
|
+
constructor(path, get_auth, collection_id, collection_name_plural, array_key) {
|
|
34
|
+
this.path = path;
|
|
35
|
+
this.get_auth = get_auth;
|
|
36
|
+
this.collection_id = collection_id;
|
|
37
|
+
this.collection_name_plural = collection_name_plural;
|
|
38
|
+
this.array_key = array_key;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=root_types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root_types.js","sourceRoot":"","sources":["../src/root_types.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,UAAU;IAC5B,IAAI,CAAU;IACd,QAAQ,CAAoB;IAC5B,aAAa,CAAQ;IACrB,sBAAsB,CAAQ;IAE9B,YAAY,IAAc,EAAE,QAA4B,EAAE,aAAqB,EAAE,sBAA8B;QAC3G,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;IACzD,CAAC;CAKJ;AAID,MAAM,OAAgB,aAAa;IAC/B,IAAI,CAAW;IACf,aAAa,CAAS;IACtB,WAAW,CAAS;IACpB,sBAAsB,CAAS;IAC/B,QAAQ,CAAqB;IAE7B,YAAY,IAAc,EAAE,aAAqB,EAAE,WAAmB,EAAE,sBAA8B,EAAE,QAA4B;QAChI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QACrD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAgBD,MAAM,OAAgB,cAAc;IAChC,IAAI,CAAU;IACd,aAAa,CAAQ;IACrB,sBAAsB,CAAQ;IAC9B,SAAS,CAAQ;IACjB,QAAQ,CAAoB;IAE5B,YAAY,IAAc,EAAE,QAA4B,EAAE,aAAqB,EAAE,sBAA8B,EAAE,SAAiB;QAC9H,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAA;QACpD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC9B,CAAC;CAKJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ky from "ky";
|
|
2
2
|
import { encode_search_params, Response, Response_Multiple } from "./utils/utils.js";
|
|
3
|
+
import { Collection, Bare_Document, Document_Array, _Base_Document, _With_Children, _With_Array } from "./root_types.js"
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
import { brief_news_category } from "./types/brief_news_category.js";
|
|
@@ -7,17 +8,9 @@ import { brief_news_category_query } from "./types/brief_news_category_query.js"
|
|
|
7
8
|
import { brief_news_category_put } from "./types/brief_news_category_put.js";
|
|
8
9
|
import { brief_news_category_post } from "./types/brief_news_category_post.js";
|
|
9
10
|
|
|
10
|
-
export class Collection_Brief_News_Category {
|
|
11
|
-
path: string[]
|
|
12
|
-
get_auth: () => Promise<any>
|
|
13
|
-
collection_id: string
|
|
14
|
-
collection_name_plural: string
|
|
15
|
-
|
|
11
|
+
export class Collection_Brief_News_Category extends Collection {
|
|
16
12
|
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
17
|
-
|
|
18
|
-
this.get_auth = get_auth;
|
|
19
|
-
this.collection_id = "brief_news_category";
|
|
20
|
-
this.collection_name_plural = "brief_news_categories"
|
|
13
|
+
super(path, get_auth, "brief_news_category", "brief_news_categories");
|
|
21
14
|
}
|
|
22
15
|
|
|
23
16
|
|
|
@@ -54,25 +47,13 @@ export class Collection_Brief_News_Category {
|
|
|
54
47
|
let get_auth = this.get_auth;
|
|
55
48
|
let collection_id = this.collection_id;
|
|
56
49
|
let collection_name_plural = this.collection_name_plural;
|
|
57
|
-
return new
|
|
50
|
+
return new Document_Brief_News_Category(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
58
51
|
}
|
|
59
52
|
}
|
|
60
53
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class Document {
|
|
64
|
-
path: string[];
|
|
65
|
-
collection_id: string;
|
|
66
|
-
document_id: string;
|
|
67
|
-
collection_name_plural: string;
|
|
68
|
-
get_auth: () => Promise<any>;
|
|
69
|
-
|
|
54
|
+
class Document_Brief_News_Category extends Bare_Document implements _Base_Document {
|
|
70
55
|
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>) {
|
|
71
|
-
|
|
72
|
-
this.collection_id = collection_id;
|
|
73
|
-
this.document_id = document_id;
|
|
74
|
-
this.collection_name_plural = collection_name_plural;
|
|
75
|
-
this.get_auth = get_auth;
|
|
56
|
+
super(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
76
57
|
}
|
|
77
58
|
|
|
78
59
|
async get(): Promise<brief_news_category>{
|
package/test/tmp/src/Client.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ky from "ky";
|
|
2
2
|
import { encode_search_params, Response, Response_Multiple } from "./utils/utils.js";
|
|
3
|
+
import { Collection, Bare_Document, Document_Array, _Base_Document, _With_Children, _With_Array } from "./root_types.js"
|
|
3
4
|
|
|
4
5
|
import { Collection_Project } from "./Project.js"
|
|
5
6
|
import { Collection_Brief_News_Category } from "./Brief_News_Category.js"
|
|
@@ -9,17 +10,9 @@ import { client_query } from "./types/client_query.js";
|
|
|
9
10
|
import { client_put } from "./types/client_put.js";
|
|
10
11
|
import { client_post } from "./types/client_post.js";
|
|
11
12
|
|
|
12
|
-
export class Collection_Client {
|
|
13
|
-
path: string[]
|
|
14
|
-
get_auth: () => Promise<any>
|
|
15
|
-
collection_id: string
|
|
16
|
-
collection_name_plural: string
|
|
17
|
-
|
|
13
|
+
export class Collection_Client extends Collection {
|
|
18
14
|
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
19
|
-
|
|
20
|
-
this.get_auth = get_auth;
|
|
21
|
-
this.collection_id = "client";
|
|
22
|
-
this.collection_name_plural = "clients"
|
|
15
|
+
super(path, get_auth, "client", "clients");
|
|
23
16
|
}
|
|
24
17
|
|
|
25
18
|
|
|
@@ -56,25 +49,13 @@ export class Collection_Client {
|
|
|
56
49
|
let get_auth = this.get_auth;
|
|
57
50
|
let collection_id = this.collection_id;
|
|
58
51
|
let collection_name_plural = this.collection_name_plural;
|
|
59
|
-
return new
|
|
52
|
+
return new Document_Client(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
60
53
|
}
|
|
61
54
|
}
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
class Document {
|
|
66
|
-
path: string[];
|
|
67
|
-
collection_id: string;
|
|
68
|
-
document_id: string;
|
|
69
|
-
collection_name_plural: string;
|
|
70
|
-
get_auth: () => Promise<any>;
|
|
71
|
-
|
|
56
|
+
class Document_Client extends Bare_Document implements _Base_Document, _With_Children {
|
|
72
57
|
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>) {
|
|
73
|
-
|
|
74
|
-
this.collection_id = collection_id;
|
|
75
|
-
this.document_id = document_id;
|
|
76
|
-
this.collection_name_plural = collection_name_plural;
|
|
77
|
-
this.get_auth = get_auth;
|
|
58
|
+
super(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
78
59
|
}
|
|
79
60
|
|
|
80
61
|
async get(): Promise<client>{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ky from "ky";
|
|
2
2
|
import { encode_search_params, Response, Response_Multiple } from "./utils/utils.js";
|
|
3
|
+
import { Collection, Bare_Document, Document_Array, _Base_Document, _With_Children, _With_Array } from "./root_types.js"
|
|
3
4
|
|
|
4
5
|
import { Collection_Client } from "./Client.js"
|
|
5
6
|
|
|
@@ -8,17 +9,9 @@ import { institution_query } from "./types/institution_query.js";
|
|
|
8
9
|
import { institution_put } from "./types/institution_put.js";
|
|
9
10
|
import { institution_post } from "./types/institution_post.js";
|
|
10
11
|
|
|
11
|
-
export class Collection_Institution {
|
|
12
|
-
path: string[]
|
|
13
|
-
get_auth: () => Promise<any>
|
|
14
|
-
collection_id: string
|
|
15
|
-
collection_name_plural: string
|
|
16
|
-
|
|
12
|
+
export class Collection_Institution extends Collection {
|
|
17
13
|
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
18
|
-
|
|
19
|
-
this.get_auth = get_auth;
|
|
20
|
-
this.collection_id = "institution";
|
|
21
|
-
this.collection_name_plural = "institutions"
|
|
14
|
+
super(path, get_auth, "institution", "institutions");
|
|
22
15
|
}
|
|
23
16
|
|
|
24
17
|
|
|
@@ -55,25 +48,13 @@ export class Collection_Institution {
|
|
|
55
48
|
let get_auth = this.get_auth;
|
|
56
49
|
let collection_id = this.collection_id;
|
|
57
50
|
let collection_name_plural = this.collection_name_plural;
|
|
58
|
-
return new
|
|
51
|
+
return new Document_Institution(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
54
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
class Document {
|
|
65
|
-
path: string[];
|
|
66
|
-
collection_id: string;
|
|
67
|
-
document_id: string;
|
|
68
|
-
collection_name_plural: string;
|
|
69
|
-
get_auth: () => Promise<any>;
|
|
70
|
-
|
|
55
|
+
class Document_Institution extends Bare_Document implements _Base_Document, _With_Children {
|
|
71
56
|
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>) {
|
|
72
|
-
|
|
73
|
-
this.collection_id = collection_id;
|
|
74
|
-
this.document_id = document_id;
|
|
75
|
-
this.collection_name_plural = collection_name_plural;
|
|
76
|
-
this.get_auth = get_auth;
|
|
57
|
+
super(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
77
58
|
}
|
|
78
59
|
|
|
79
60
|
async get(): Promise<institution>{
|
package/test/tmp/src/Project.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ky from "ky";
|
|
2
2
|
import { encode_search_params, Response, Response_Multiple } from "./utils/utils.js";
|
|
3
|
+
import { Collection, Bare_Document, Document_Array, _Base_Document, _With_Children, _With_Array } from "./root_types.js"
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
import { project } from "./types/project.js";
|
|
@@ -7,17 +8,9 @@ import { project_query } from "./types/project_query.js";
|
|
|
7
8
|
import { project_put } from "./types/project_put.js";
|
|
8
9
|
import { project_post } from "./types/project_post.js";
|
|
9
10
|
|
|
10
|
-
export class Collection_Project {
|
|
11
|
-
path: string[]
|
|
12
|
-
get_auth: () => Promise<any>
|
|
13
|
-
collection_id: string
|
|
14
|
-
collection_name_plural: string
|
|
15
|
-
|
|
11
|
+
export class Collection_Project extends Collection {
|
|
16
12
|
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
17
|
-
|
|
18
|
-
this.get_auth = get_auth;
|
|
19
|
-
this.collection_id = "project";
|
|
20
|
-
this.collection_name_plural = "projects"
|
|
13
|
+
super(path, get_auth, "project", "projects");
|
|
21
14
|
}
|
|
22
15
|
|
|
23
16
|
|
|
@@ -54,25 +47,13 @@ export class Collection_Project {
|
|
|
54
47
|
let get_auth = this.get_auth;
|
|
55
48
|
let collection_id = this.collection_id;
|
|
56
49
|
let collection_name_plural = this.collection_name_plural;
|
|
57
|
-
return new
|
|
50
|
+
return new Document_Project(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
58
51
|
}
|
|
59
52
|
}
|
|
60
53
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class Document {
|
|
64
|
-
path: string[];
|
|
65
|
-
collection_id: string;
|
|
66
|
-
document_id: string;
|
|
67
|
-
collection_name_plural: string;
|
|
68
|
-
get_auth: () => Promise<any>;
|
|
69
|
-
|
|
54
|
+
class Document_Project extends Bare_Document implements _Base_Document, _With_Array {
|
|
70
55
|
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>) {
|
|
71
|
-
|
|
72
|
-
this.collection_id = collection_id;
|
|
73
|
-
this.document_id = document_id;
|
|
74
|
-
this.collection_name_plural = collection_name_plural;
|
|
75
|
-
this.get_auth = get_auth;
|
|
56
|
+
super(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
76
57
|
}
|
|
77
58
|
|
|
78
59
|
async get(): Promise<project>{
|
|
@@ -136,19 +117,10 @@ export type project_steps_post = {
|
|
|
136
117
|
"name": string
|
|
137
118
|
}
|
|
138
119
|
|
|
139
|
-
export class Collection_Project_Array_steps {
|
|
140
|
-
path: string[]
|
|
141
|
-
get_auth: () => Promise<any>
|
|
142
|
-
collection_id: string
|
|
143
|
-
collection_name_plural: string
|
|
144
|
-
array_key: string
|
|
120
|
+
export class Collection_Project_Array_steps extends Document_Array {
|
|
145
121
|
|
|
146
122
|
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
147
|
-
|
|
148
|
-
this.get_auth = get_auth;
|
|
149
|
-
this.collection_id = "project";
|
|
150
|
-
this.collection_name_plural = "projects"
|
|
151
|
-
this.array_key = "steps"
|
|
123
|
+
super(path, get_auth, "project", "projects", "steps")
|
|
152
124
|
}
|
|
153
125
|
|
|
154
126
|
async push(document: project_steps_post): Promise<project>{
|
package/test/tmp/src/index.ts
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export abstract class Collection {
|
|
2
|
+
path: string[]
|
|
3
|
+
get_auth: () => Promise<any>
|
|
4
|
+
collection_id: string
|
|
5
|
+
collection_name_plural: string
|
|
6
|
+
|
|
7
|
+
constructor(path: string[], get_auth: () => Promise<any>, collection_id: string, collection_name_plural: string) {
|
|
8
|
+
this.path = path;
|
|
9
|
+
this.get_auth = get_auth;
|
|
10
|
+
this.collection_id = collection_id;
|
|
11
|
+
this.collection_name_plural = collection_name_plural;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
abstract query(query: any): Promise<any[]>;
|
|
15
|
+
abstract post(document: any): Promise<any>;
|
|
16
|
+
abstract document(document_id: string): Document
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type Document = (Bare_Document & _Base_Document) | (Bare_Document & _Base_Document & _With_Children) | (Bare_Document & _Base_Document & _With_Array) | (Bare_Document & _Base_Document & _With_Array & _With_Children);
|
|
20
|
+
|
|
21
|
+
export abstract class Bare_Document {
|
|
22
|
+
path: string[];
|
|
23
|
+
collection_id: string;
|
|
24
|
+
document_id: string;
|
|
25
|
+
collection_name_plural: string;
|
|
26
|
+
get_auth: () => Promise<any>;
|
|
27
|
+
|
|
28
|
+
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>) {
|
|
29
|
+
this.path = path;
|
|
30
|
+
this.collection_id = collection_id;
|
|
31
|
+
this.document_id = document_id;
|
|
32
|
+
this.collection_name_plural = collection_name_plural;
|
|
33
|
+
this.get_auth = get_auth;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface _Base_Document {
|
|
38
|
+
get(): any
|
|
39
|
+
put(update: any): Promise<any>
|
|
40
|
+
remove(): Promise<any>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface _With_Children {
|
|
44
|
+
collection(collection_id: string): Collection
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface _With_Array {
|
|
48
|
+
array(key: string): Document_Array
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export abstract class Document_Array {
|
|
52
|
+
path: string[]
|
|
53
|
+
collection_id: string
|
|
54
|
+
collection_name_plural: string
|
|
55
|
+
array_key: string
|
|
56
|
+
get_auth: () => Promise<any>
|
|
57
|
+
|
|
58
|
+
constructor(path: string[], get_auth: () => Promise<any>, collection_id: string, collection_name_plural: string, array_key: string) {
|
|
59
|
+
this.path = path;
|
|
60
|
+
this.get_auth = get_auth;
|
|
61
|
+
this.collection_id = collection_id;
|
|
62
|
+
this.collection_name_plural = collection_name_plural
|
|
63
|
+
this.array_key = array_key
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
abstract push(document: any): Promise<any>
|
|
67
|
+
abstract replace(document: any): Promise<any>
|
|
68
|
+
abstract delete(document_id: string): Promise<any>
|
|
69
|
+
}
|