@liminalfunctions/framework 1.0.8 → 1.0.9
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/utils/type_from_zod.js +4 -5
- package/dist/code_generation/utils/type_from_zod.js.map +1 -1
- package/dist/utils/mongoose_from_zod.d.ts +0 -3
- package/dist/utils/mongoose_from_zod.js +6 -7
- package/dist/utils/mongoose_from_zod.js.map +1 -1
- package/dist/utils/pretty_print_zod.js +4 -5
- package/dist/utils/pretty_print_zod.js.map +1 -1
- package/dist/utils/query_validator_from_zod.js +8 -8
- package/dist/utils/query_validator_from_zod.js.map +1 -1
- package/package.json +1 -1
- package/src/code_generation/utils/type_from_zod.ts +4 -5
- package/src/utils/mongoose_from_zod.ts +6 -10
- package/src/utils/pretty_print_zod.ts +4 -5
- package/src/utils/query_validator_from_zod.ts +11 -9
- package/test/tmp/dist/Brief_News_Category.d.ts +16 -0
- package/test/tmp/dist/Brief_News_Category.js +85 -0
- package/test/tmp/dist/Brief_News_Category.js.map +1 -0
- package/test/tmp/dist/Client.d.ts +19 -0
- package/test/tmp/dist/Client.js +97 -0
- package/test/tmp/dist/Client.js.map +1 -0
- package/test/tmp/dist/Institution.d.ts +18 -0
- package/test/tmp/dist/Institution.js +94 -0
- package/test/tmp/dist/Institution.js.map +1 -0
- package/test/tmp/dist/Project.d.ts +16 -0
- package/test/tmp/dist/Project.js +85 -0
- package/test/tmp/dist/Project.js.map +1 -0
- package/test/tmp/dist/index.d.ts +4 -0
- package/test/tmp/dist/index.js +14 -0
- package/test/tmp/dist/index.js.map +1 -0
- package/test/tmp/dist/types/brief_news_category.d.ts +7 -0
- package/test/tmp/dist/types/brief_news_category.js +2 -0
- package/test/tmp/dist/types/brief_news_category.js.map +1 -0
- package/test/tmp/dist/types/brief_news_category_post.d.ts +7 -0
- package/test/tmp/dist/types/brief_news_category_post.js +2 -0
- package/test/tmp/dist/types/brief_news_category_post.js.map +1 -0
- package/test/tmp/dist/types/brief_news_category_put.d.ts +7 -0
- package/test/tmp/dist/types/brief_news_category_put.js +2 -0
- package/test/tmp/dist/types/brief_news_category_put.js.map +1 -0
- package/test/tmp/dist/types/brief_news_category_query.d.ts +26 -0
- package/test/tmp/dist/types/brief_news_category_query.js +2 -0
- package/test/tmp/dist/types/brief_news_category_query.js.map +1 -0
- package/test/tmp/dist/types/client.d.ts +5 -0
- package/test/tmp/dist/types/client.js +2 -0
- package/test/tmp/dist/types/client.js.map +1 -0
- package/test/tmp/dist/types/client_post.d.ts +5 -0
- package/test/tmp/dist/types/client_post.js +2 -0
- package/test/tmp/dist/types/client_post.js.map +1 -0
- package/test/tmp/dist/types/client_put.d.ts +5 -0
- package/test/tmp/dist/types/client_put.js +2 -0
- package/test/tmp/dist/types/client_put.js.map +1 -0
- package/test/tmp/dist/types/client_query.d.ts +18 -0
- package/test/tmp/dist/types/client_query.js +2 -0
- package/test/tmp/dist/types/client_query.js.map +1 -0
- package/test/tmp/dist/types/institution.d.ts +4 -0
- package/test/tmp/dist/types/institution.js +2 -0
- package/test/tmp/dist/types/institution.js.map +1 -0
- package/test/tmp/dist/types/institution_post.d.ts +4 -0
- package/test/tmp/dist/types/institution_post.js +2 -0
- package/test/tmp/dist/types/institution_post.js.map +1 -0
- package/test/tmp/dist/types/institution_put.d.ts +4 -0
- package/test/tmp/dist/types/institution_put.js +2 -0
- package/test/tmp/dist/types/institution_put.js.map +1 -0
- package/test/tmp/dist/types/institution_query.d.ts +14 -0
- package/test/tmp/dist/types/institution_query.js +2 -0
- package/test/tmp/dist/types/institution_query.js.map +1 -0
- package/test/tmp/dist/types/project.d.ts +7 -0
- package/test/tmp/dist/types/project.js +2 -0
- package/test/tmp/dist/types/project.js.map +1 -0
- package/test/tmp/dist/types/project_post.d.ts +7 -0
- package/test/tmp/dist/types/project_post.js +2 -0
- package/test/tmp/dist/types/project_post.js.map +1 -0
- package/test/tmp/dist/types/project_put.d.ts +7 -0
- package/test/tmp/dist/types/project_put.js +2 -0
- package/test/tmp/dist/types/project_put.js.map +1 -0
- package/test/tmp/dist/types/project_query.d.ts +27 -0
- package/test/tmp/dist/types/project_query.js +2 -0
- package/test/tmp/dist/types/project_query.js.map +1 -0
- package/test/tmp/dist/utils/utils.d.ts +11 -0
- package/test/tmp/dist/utils/utils.js +13 -0
- package/test/tmp/dist/utils/utils.js.map +1 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import ky from "ky";
|
|
2
|
+
import { encode_search_params } from "./utils/utils.js";
|
|
3
|
+
import { Collection_Project } from "./Project.js";
|
|
4
|
+
import { Collection_Brief_News_Category } from "./Brief_News_Category.js";
|
|
5
|
+
export class Collection_Client {
|
|
6
|
+
path;
|
|
7
|
+
get_auth;
|
|
8
|
+
constructor(path, get_auth) {
|
|
9
|
+
this.path = path;
|
|
10
|
+
this.get_auth = get_auth;
|
|
11
|
+
}
|
|
12
|
+
async query(query) {
|
|
13
|
+
try {
|
|
14
|
+
let result = await ky.get(this.path.join('/'), {
|
|
15
|
+
headers: {
|
|
16
|
+
authorization: await this.get_auth()
|
|
17
|
+
},
|
|
18
|
+
searchParams: encode_search_params(query)
|
|
19
|
+
}).json();
|
|
20
|
+
return result.data;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
return Promise.reject(err);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async post(document) {
|
|
27
|
+
try {
|
|
28
|
+
let result = await ky.post(this.path.join('/'), {
|
|
29
|
+
headers: {
|
|
30
|
+
authorization: await this.get_auth()
|
|
31
|
+
},
|
|
32
|
+
json: document
|
|
33
|
+
}).json();
|
|
34
|
+
return result.data;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return Promise.reject(err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
document(document_id) {
|
|
41
|
+
let path = this.path;
|
|
42
|
+
let get_auth = this.get_auth;
|
|
43
|
+
return {
|
|
44
|
+
async get() {
|
|
45
|
+
try {
|
|
46
|
+
let result = await ky.get([...path, document_id].join('/'), {
|
|
47
|
+
headers: {
|
|
48
|
+
authorization: await get_auth()
|
|
49
|
+
},
|
|
50
|
+
}).json();
|
|
51
|
+
return result.data;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
return Promise.reject(err);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
async put(update) {
|
|
58
|
+
try {
|
|
59
|
+
let result = await ky.put([...path, document_id].join('/'), {
|
|
60
|
+
headers: {
|
|
61
|
+
authorization: await get_auth()
|
|
62
|
+
},
|
|
63
|
+
json: update
|
|
64
|
+
}).json();
|
|
65
|
+
return result.data;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
return Promise.reject(err);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
async remove() {
|
|
72
|
+
try {
|
|
73
|
+
let result = await ky.delete([...path, document_id].join('/'), {
|
|
74
|
+
headers: {
|
|
75
|
+
authorization: await get_auth()
|
|
76
|
+
},
|
|
77
|
+
}).json();
|
|
78
|
+
return result.data;
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
return Promise.reject(err);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
collection(collection_id) {
|
|
85
|
+
switch (collection_id) {
|
|
86
|
+
case "project":
|
|
87
|
+
return new Collection_Project([...path, document_id, "project"], get_auth);
|
|
88
|
+
case "brief_news_category":
|
|
89
|
+
return new Collection_Brief_News_Category([...path, document_id, "brief_news_category"], get_auth);
|
|
90
|
+
default:
|
|
91
|
+
throw new Error(`Api does not have the collection ${collection_id}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=Client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Client.js","sourceRoot":"","sources":["../src/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM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WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;wBAC3D,OAAO,EAAE;4BACL,aAAa,EAAE,MAAM,QAAQ,EAAE;yBAClC;qBACJ,CAAC,CAAC,IAAI,EAAsB,CAAC;oBAC9B,OAAO,MAAM,CAAC,IAAI,CAAC;gBACvB,CAAC;gBAAC,OAAM,GAAG,EAAC,CAAC;oBACT,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;gBAC9B,CAAC;YACL,CAAC;YAED,UAAU,CAAC,aAAgD;gBACvD,QAAO,aAAa,EAAE,CAAC;oBACnB,KAAK,SAAS;wBACV,OAAO,IAAI,kBAAkB,CAAC,CAAC,GAAG,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;oBAC/E,KAAK,qBAAqB;wBACtB,OAAO,IAAI,8BAA8B,CAAC,CAAC,GAAG,IAAI,EAAE,WAAW,EAAE,qBAAqB,CAAC,EAAE,QAAQ,CAAC,CAAC;oBACvG;wBACI,MAAM,IAAI,KAAK,CAAC,oCAAoC,aAAa,EAAE,CAAC,CAAA;gBAC5E,CAAC;YACL,CAAC;SACJ,CAAA;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Collection_Client } from "./Client.js";
|
|
2
|
+
import { institution } from "./types/institution.js";
|
|
3
|
+
import { institution_query } from "./types/institution_query.js";
|
|
4
|
+
import { institution_put } from "./types/institution_put.js";
|
|
5
|
+
import { institution_post } from "./types/institution_post.js";
|
|
6
|
+
export declare class Collection_Institution {
|
|
7
|
+
path: string[];
|
|
8
|
+
get_auth: () => Promise<any>;
|
|
9
|
+
constructor(path: string[], get_auth: () => Promise<any>);
|
|
10
|
+
query(query: institution_query): Promise<institution[]>;
|
|
11
|
+
post(document: institution_post): Promise<institution>;
|
|
12
|
+
document(document_id: string): {
|
|
13
|
+
get(): Promise<institution>;
|
|
14
|
+
put(update: institution_put): Promise<institution>;
|
|
15
|
+
remove(): Promise<institution>;
|
|
16
|
+
collection(collection_id: "client"): Collection_Client;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import ky from "ky";
|
|
2
|
+
import { encode_search_params } from "./utils/utils.js";
|
|
3
|
+
import { Collection_Client } from "./Client.js";
|
|
4
|
+
export class Collection_Institution {
|
|
5
|
+
path;
|
|
6
|
+
get_auth;
|
|
7
|
+
constructor(path, get_auth) {
|
|
8
|
+
this.path = path;
|
|
9
|
+
this.get_auth = get_auth;
|
|
10
|
+
}
|
|
11
|
+
async query(query) {
|
|
12
|
+
try {
|
|
13
|
+
let result = await ky.get(this.path.join('/'), {
|
|
14
|
+
headers: {
|
|
15
|
+
authorization: await this.get_auth()
|
|
16
|
+
},
|
|
17
|
+
searchParams: encode_search_params(query)
|
|
18
|
+
}).json();
|
|
19
|
+
return result.data;
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
return Promise.reject(err);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async post(document) {
|
|
26
|
+
try {
|
|
27
|
+
let result = await ky.post(this.path.join('/'), {
|
|
28
|
+
headers: {
|
|
29
|
+
authorization: await this.get_auth()
|
|
30
|
+
},
|
|
31
|
+
json: document
|
|
32
|
+
}).json();
|
|
33
|
+
return result.data;
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
return Promise.reject(err);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
document(document_id) {
|
|
40
|
+
let path = this.path;
|
|
41
|
+
let get_auth = this.get_auth;
|
|
42
|
+
return {
|
|
43
|
+
async get() {
|
|
44
|
+
try {
|
|
45
|
+
let result = await ky.get([...path, document_id].join('/'), {
|
|
46
|
+
headers: {
|
|
47
|
+
authorization: await get_auth()
|
|
48
|
+
},
|
|
49
|
+
}).json();
|
|
50
|
+
return result.data;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
return Promise.reject(err);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
async put(update) {
|
|
57
|
+
try {
|
|
58
|
+
let result = await ky.put([...path, document_id].join('/'), {
|
|
59
|
+
headers: {
|
|
60
|
+
authorization: await get_auth()
|
|
61
|
+
},
|
|
62
|
+
json: update
|
|
63
|
+
}).json();
|
|
64
|
+
return result.data;
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return Promise.reject(err);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
async remove() {
|
|
71
|
+
try {
|
|
72
|
+
let result = await ky.delete([...path, document_id].join('/'), {
|
|
73
|
+
headers: {
|
|
74
|
+
authorization: await get_auth()
|
|
75
|
+
},
|
|
76
|
+
}).json();
|
|
77
|
+
return result.data;
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return Promise.reject(err);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
collection(collection_id) {
|
|
84
|
+
switch (collection_id) {
|
|
85
|
+
case "client":
|
|
86
|
+
return new Collection_Client([...path, document_id, "client"], get_auth);
|
|
87
|
+
default:
|
|
88
|
+
throw new Error(`Api does not have the collection ${collection_id}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=Institution.js.map
|
|
@@ -0,0 +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,kBAAkB,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAO/C,MAAM,OAAO,sBAAsB;IAC/B,IAAI,CAAU;IACd,QAAQ,CAAoB;IAE5B,YAAY,IAAc,EAAE,QAA4B;QACpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IA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CAAC,aAAuB;gBAC9B,QAAO,aAAa,EAAE,CAAC;oBACnB,KAAK,QAAQ;wBACT,OAAO,IAAI,iBAAiB,CAAC,CAAC,GAAG,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;oBAC7E;wBACI,MAAM,IAAI,KAAK,CAAC,oCAAoC,aAAa,EAAE,CAAC,CAAA;gBAC5E,CAAC;YACL,CAAC;SACJ,CAAA;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { project } from "./types/project.js";
|
|
2
|
+
import { project_query } from "./types/project_query.js";
|
|
3
|
+
import { project_put } from "./types/project_put.js";
|
|
4
|
+
import { project_post } from "./types/project_post.js";
|
|
5
|
+
export declare class Collection_Project {
|
|
6
|
+
path: string[];
|
|
7
|
+
get_auth: () => Promise<any>;
|
|
8
|
+
constructor(path: string[], get_auth: () => Promise<any>);
|
|
9
|
+
query(query: project_query): Promise<project[]>;
|
|
10
|
+
post(document: project_post): Promise<project>;
|
|
11
|
+
document(document_id: string): {
|
|
12
|
+
get(): Promise<project>;
|
|
13
|
+
put(update: project_put): Promise<project>;
|
|
14
|
+
remove(): Promise<project>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import ky from "ky";
|
|
2
|
+
import { encode_search_params } from "./utils/utils.js";
|
|
3
|
+
export class Collection_Project {
|
|
4
|
+
path;
|
|
5
|
+
get_auth;
|
|
6
|
+
constructor(path, get_auth) {
|
|
7
|
+
this.path = path;
|
|
8
|
+
this.get_auth = get_auth;
|
|
9
|
+
}
|
|
10
|
+
async query(query) {
|
|
11
|
+
try {
|
|
12
|
+
let result = await ky.get(this.path.join('/'), {
|
|
13
|
+
headers: {
|
|
14
|
+
authorization: await this.get_auth()
|
|
15
|
+
},
|
|
16
|
+
searchParams: encode_search_params(query)
|
|
17
|
+
}).json();
|
|
18
|
+
return result.data;
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
return Promise.reject(err);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async post(document) {
|
|
25
|
+
try {
|
|
26
|
+
let result = await ky.post(this.path.join('/'), {
|
|
27
|
+
headers: {
|
|
28
|
+
authorization: await this.get_auth()
|
|
29
|
+
},
|
|
30
|
+
json: document
|
|
31
|
+
}).json();
|
|
32
|
+
return result.data;
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
return Promise.reject(err);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
document(document_id) {
|
|
39
|
+
let path = this.path;
|
|
40
|
+
let get_auth = this.get_auth;
|
|
41
|
+
return {
|
|
42
|
+
async get() {
|
|
43
|
+
try {
|
|
44
|
+
let result = await ky.get([...path, document_id].join('/'), {
|
|
45
|
+
headers: {
|
|
46
|
+
authorization: await get_auth()
|
|
47
|
+
},
|
|
48
|
+
}).json();
|
|
49
|
+
return result.data;
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
return Promise.reject(err);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
async put(update) {
|
|
56
|
+
try {
|
|
57
|
+
let result = await ky.put([...path, document_id].join('/'), {
|
|
58
|
+
headers: {
|
|
59
|
+
authorization: await get_auth()
|
|
60
|
+
},
|
|
61
|
+
json: update
|
|
62
|
+
}).json();
|
|
63
|
+
return result.data;
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return Promise.reject(err);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
async remove() {
|
|
70
|
+
try {
|
|
71
|
+
let result = await ky.delete([...path, document_id].join('/'), {
|
|
72
|
+
headers: {
|
|
73
|
+
authorization: await get_auth()
|
|
74
|
+
},
|
|
75
|
+
}).json();
|
|
76
|
+
return result.data;
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
return Promise.reject(err);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
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CAAC;oBACD,IAAI,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;wBAC3D,OAAO,EAAE;4BACL,aAAa,EAAE,MAAM,QAAQ,EAAE;yBAClC;qBACJ,CAAC,CAAC,IAAI,EAAuB,CAAC;oBAC/B,OAAO,MAAM,CAAC,IAAI,CAAC;gBACvB,CAAC;gBAAC,OAAM,GAAG,EAAC,CAAC;oBACT,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;gBAC9B,CAAC;YACL,CAAC;SAEJ,CAAA;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Collection_Institution } from "./Institution.js";
|
|
2
|
+
export function api(base_url, get_auth) {
|
|
3
|
+
return {
|
|
4
|
+
collection(collection_id) {
|
|
5
|
+
switch (collection_id) {
|
|
6
|
+
case "institution":
|
|
7
|
+
return new Collection_Institution([base_url, "institution"], get_auth);
|
|
8
|
+
default:
|
|
9
|
+
throw new Error(`Api does not have the collection ${collection_id}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAGzD,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,QAA4B;IAC9D,OAAO;QACH,UAAU,CAAC,aAA4B;YACnC,QAAO,aAAa,EAAE,CAAC;gBACnB,KAAK,aAAa;oBACd,OAAO,IAAI,sBAAsB,CAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC;gBAC3E;oBACI,MAAM,IAAI,KAAK,CAAC,oCAAoC,aAAa,EAAE,CAAC,CAAA;YAC5E,CAAC;QACL,CAAC;KACJ,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief_news_category.js","sourceRoot":"","sources":["../../src/types/brief_news_category.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief_news_category_post.js","sourceRoot":"","sources":["../../src/types/brief_news_category_post.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief_news_category_put.js","sourceRoot":"","sources":["../../src/types/brief_news_category_put.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type brief_news_category_query = {
|
|
2
|
+
"limit"?: number;
|
|
3
|
+
"cursor"?: string;
|
|
4
|
+
"sort_order"?: ("ascending" | "descending");
|
|
5
|
+
"_id"?: string;
|
|
6
|
+
"_id_gt"?: string;
|
|
7
|
+
"_id_lt"?: string;
|
|
8
|
+
"_id_in"?: string[];
|
|
9
|
+
"name"?: string;
|
|
10
|
+
"name_gt"?: string;
|
|
11
|
+
"name_lt"?: string;
|
|
12
|
+
"name_in"?: string[];
|
|
13
|
+
"slug"?: string;
|
|
14
|
+
"slug_gt"?: string;
|
|
15
|
+
"slug_lt"?: string;
|
|
16
|
+
"slug_in"?: string[];
|
|
17
|
+
"institution_id"?: string;
|
|
18
|
+
"institution_id_gt"?: string;
|
|
19
|
+
"institution_id_lt"?: string;
|
|
20
|
+
"institution_id_in"?: string[];
|
|
21
|
+
"client_id"?: string;
|
|
22
|
+
"client_id_gt"?: string;
|
|
23
|
+
"client_id_lt"?: string;
|
|
24
|
+
"client_id_in"?: string[];
|
|
25
|
+
"sort"?: ("_id" | "name" | "slug" | "institution_id" | "client_id");
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief_news_category_query.js","sourceRoot":"","sources":["../../src/types/brief_news_category_query.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client_post.js","sourceRoot":"","sources":["../../src/types/client_post.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client_put.js","sourceRoot":"","sources":["../../src/types/client_put.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type client_query = {
|
|
2
|
+
"limit"?: number;
|
|
3
|
+
"cursor"?: string;
|
|
4
|
+
"sort_order"?: ("ascending" | "descending");
|
|
5
|
+
"_id"?: string;
|
|
6
|
+
"_id_gt"?: string;
|
|
7
|
+
"_id_lt"?: string;
|
|
8
|
+
"_id_in"?: string[];
|
|
9
|
+
"name"?: string;
|
|
10
|
+
"name_gt"?: string;
|
|
11
|
+
"name_lt"?: string;
|
|
12
|
+
"name_in"?: string[];
|
|
13
|
+
"institution_id"?: string;
|
|
14
|
+
"institution_id_gt"?: string;
|
|
15
|
+
"institution_id_lt"?: string;
|
|
16
|
+
"institution_id_in"?: string[];
|
|
17
|
+
"sort"?: ("_id" | "name" | "institution_id");
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client_query.js","sourceRoot":"","sources":["../../src/types/client_query.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"institution.js","sourceRoot":"","sources":["../../src/types/institution.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"institution_post.js","sourceRoot":"","sources":["../../src/types/institution_post.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"institution_put.js","sourceRoot":"","sources":["../../src/types/institution_put.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type institution_query = {
|
|
2
|
+
"limit"?: number;
|
|
3
|
+
"cursor"?: string;
|
|
4
|
+
"sort_order"?: ("ascending" | "descending");
|
|
5
|
+
"_id"?: string;
|
|
6
|
+
"_id_gt"?: string;
|
|
7
|
+
"_id_lt"?: string;
|
|
8
|
+
"_id_in"?: string[];
|
|
9
|
+
"name"?: string;
|
|
10
|
+
"name_gt"?: string;
|
|
11
|
+
"name_lt"?: string;
|
|
12
|
+
"name_in"?: string[];
|
|
13
|
+
"sort"?: ("_id" | "name");
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"institution_query.js","sourceRoot":"","sources":["../../src/types/institution_query.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/types/project.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project_post.js","sourceRoot":"","sources":["../../src/types/project_post.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project_put.js","sourceRoot":"","sources":["../../src/types/project_put.ts"],"names":[],"mappings":""}
|