@liminalfunctions/framework 1.0.60 → 1.0.61
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 +0 -1
- package/dist/code_generation/generate_client_library.js.map +1 -1
- package/dist/utils/mongoose_from_zod.js +1 -1
- package/dist/utils/mongoose_from_zod.js.map +1 -1
- package/package.json +1 -1
- package/src/code_generation/generate_client_library.ts +0 -1
- package/src/utils/mongoose_from_zod.ts +3 -1
- package/test/tmp/dist/Brief_News_Category.d.ts +26 -0
- package/test/tmp/dist/Brief_News_Category.js +104 -0
- package/test/tmp/dist/Brief_News_Category.js.map +1 -0
- package/test/tmp/dist/Client.d.ts +30 -0
- package/test/tmp/dist/Client.js +116 -0
- package/test/tmp/dist/Client.js.map +1 -0
- package/test/tmp/dist/Institution.d.ts +28 -0
- package/test/tmp/dist/Institution.js +113 -0
- package/test/tmp/dist/Institution.js.map +1 -0
- package/test/tmp/dist/Project.d.ts +46 -0
- package/test/tmp/dist/Project.js +167 -0
- package/test/tmp/dist/Project.js.map +1 -0
- package/test/tmp/dist/index.d.ts +24 -0
- package/test/tmp/dist/index.js +35 -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 +11 -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 +11 -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 +11 -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 +16 -0
- package/test/tmp/dist/utils/utils.js.map +1 -0
- package/test/tmp/package-lock.json +573 -0
- package/test/tmp/src/Brief_News_Category.ts +120 -0
- package/test/tmp/src/Client.ts +134 -0
- package/test/tmp/src/Institution.ts +130 -0
- package/test/tmp/src/{Test_Collection.ts → Project.ts} +34 -42
- package/test/tmp/src/index.ts +4 -4
- package/test/tmp/src/types/brief_news_category.ts +7 -0
- package/test/tmp/src/types/brief_news_category_post.ts +7 -0
- package/test/tmp/src/types/brief_news_category_put.ts +7 -0
- package/test/tmp/src/types/brief_news_category_query.ts +26 -0
- package/test/tmp/src/types/client.ts +5 -0
- package/test/tmp/src/types/client_post.ts +5 -0
- package/test/tmp/src/types/client_put.ts +5 -0
- package/test/tmp/src/types/client_query.ts +18 -0
- package/test/tmp/src/types/institution.ts +4 -0
- package/test/tmp/src/types/institution_post.ts +4 -0
- package/test/tmp/src/types/institution_put.ts +4 -0
- package/test/tmp/src/types/{test_collection_query.ts → institution_query.ts} +6 -2
- package/test/tmp/src/types/project.ts +11 -0
- package/test/tmp/src/types/project_post.ts +11 -0
- package/test/tmp/src/types/project_put.ts +11 -0
- package/test/tmp/src/types/project_query.ts +27 -0
- package/test/tmp/src/types/test_collection.ts +0 -9
- package/test/tmp/src/types/test_collection_post.ts +0 -9
- package/test/tmp/src/types/test_collection_put.ts +0 -9
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import ky from "ky";
|
|
2
|
+
import { encode_search_params, Response, Response_Multiple } from "./utils/utils.js";
|
|
3
|
+
|
|
4
|
+
import { Collection_Project } from "./Project.js"
|
|
5
|
+
import { Collection_Brief_News_Category } from "./Brief_News_Category.js"
|
|
6
|
+
|
|
7
|
+
import { client } from "./types/client.js";
|
|
8
|
+
import { client_query } from "./types/client_query.js";
|
|
9
|
+
import { client_put } from "./types/client_put.js";
|
|
10
|
+
import { client_post } from "./types/client_post.js";
|
|
11
|
+
|
|
12
|
+
export class Collection_Client {
|
|
13
|
+
path: string[]
|
|
14
|
+
get_auth: () => Promise<any>
|
|
15
|
+
collection_id: string
|
|
16
|
+
collection_name_plural: string
|
|
17
|
+
|
|
18
|
+
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
19
|
+
this.path = path;
|
|
20
|
+
this.get_auth = get_auth;
|
|
21
|
+
this.collection_id = "client";
|
|
22
|
+
this.collection_name_plural = "clients"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
async query(query: client_query): Promise<client[]>{
|
|
27
|
+
try {
|
|
28
|
+
let result = await ky.get(this.path.join('/'), {
|
|
29
|
+
headers: {
|
|
30
|
+
authorization: await this.get_auth()
|
|
31
|
+
},
|
|
32
|
+
searchParams: encode_search_params(query)
|
|
33
|
+
}).json() as Response_Multiple<client>;
|
|
34
|
+
return result.data;
|
|
35
|
+
} catch(err){
|
|
36
|
+
return Promise.reject(err)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async post(document: client_post): Promise<client>{
|
|
41
|
+
try {
|
|
42
|
+
let result = await ky.post(this.path.join('/'), {
|
|
43
|
+
headers: {
|
|
44
|
+
authorization: await this.get_auth()
|
|
45
|
+
},
|
|
46
|
+
json: document
|
|
47
|
+
}).json() as Response<client>;
|
|
48
|
+
return result.data;
|
|
49
|
+
} catch(err){
|
|
50
|
+
return Promise.reject(err)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
document(document_id: string) {
|
|
55
|
+
let path = this.path;
|
|
56
|
+
let get_auth = this.get_auth;
|
|
57
|
+
let collection_id = this.collection_id;
|
|
58
|
+
let collection_name_plural = this.collection_name_plural;
|
|
59
|
+
return new Document(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
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
|
+
|
|
72
|
+
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>) {
|
|
73
|
+
this.path = path;
|
|
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;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async get(): Promise<client>{
|
|
81
|
+
try {
|
|
82
|
+
let result = await ky.get([...this.path, this.document_id].join('/'), {
|
|
83
|
+
headers: {
|
|
84
|
+
authorization: await this.get_auth()
|
|
85
|
+
},
|
|
86
|
+
}).json() as Response<client>;
|
|
87
|
+
return result.data;
|
|
88
|
+
} catch(err){
|
|
89
|
+
return Promise.reject(err)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async put(update: client_put): Promise<client>{
|
|
94
|
+
try {
|
|
95
|
+
let result = await ky.put([...this.path, this.document_id].join('/'), {
|
|
96
|
+
headers: {
|
|
97
|
+
authorization: await this.get_auth()
|
|
98
|
+
},
|
|
99
|
+
json: update
|
|
100
|
+
}).json() as Response<client>;
|
|
101
|
+
return result.data;
|
|
102
|
+
} catch(err){
|
|
103
|
+
return Promise.reject(err)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async remove(): Promise<client>{
|
|
108
|
+
try {
|
|
109
|
+
let result = await ky.delete([...this.path, this.document_id].join('/'), {
|
|
110
|
+
headers: {
|
|
111
|
+
authorization: await this.get_auth()
|
|
112
|
+
},
|
|
113
|
+
}).json() as Response<client>;
|
|
114
|
+
return result.data;
|
|
115
|
+
} catch(err){
|
|
116
|
+
return Promise.reject(err)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
collection(collection_id: "project"): Collection_Project;
|
|
121
|
+
collection(collection_id: "brief_news_category"): Collection_Brief_News_Category;
|
|
122
|
+
collection(collection_id: string) {
|
|
123
|
+
switch(collection_id) {
|
|
124
|
+
case "project":
|
|
125
|
+
return new Collection_Project([...this.path, this.document_id, "project"], this.get_auth);
|
|
126
|
+
case "brief_news_category":
|
|
127
|
+
return new Collection_Brief_News_Category([...this.path, this.document_id, "brief_news_category"], this.get_auth);
|
|
128
|
+
default:
|
|
129
|
+
throw new Error(`Api does not have the collection ${collection_id}`)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import ky from "ky";
|
|
2
|
+
import { encode_search_params, Response, Response_Multiple } from "./utils/utils.js";
|
|
3
|
+
|
|
4
|
+
import { Collection_Client } from "./Client.js"
|
|
5
|
+
|
|
6
|
+
import { institution } from "./types/institution.js";
|
|
7
|
+
import { institution_query } from "./types/institution_query.js";
|
|
8
|
+
import { institution_put } from "./types/institution_put.js";
|
|
9
|
+
import { institution_post } from "./types/institution_post.js";
|
|
10
|
+
|
|
11
|
+
export class Collection_Institution {
|
|
12
|
+
path: string[]
|
|
13
|
+
get_auth: () => Promise<any>
|
|
14
|
+
collection_id: string
|
|
15
|
+
collection_name_plural: string
|
|
16
|
+
|
|
17
|
+
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
18
|
+
this.path = path;
|
|
19
|
+
this.get_auth = get_auth;
|
|
20
|
+
this.collection_id = "institution";
|
|
21
|
+
this.collection_name_plural = "institutions"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
async query(query: institution_query): Promise<institution[]>{
|
|
26
|
+
try {
|
|
27
|
+
let result = await ky.get(this.path.join('/'), {
|
|
28
|
+
headers: {
|
|
29
|
+
authorization: await this.get_auth()
|
|
30
|
+
},
|
|
31
|
+
searchParams: encode_search_params(query)
|
|
32
|
+
}).json() as Response_Multiple<institution>;
|
|
33
|
+
return result.data;
|
|
34
|
+
} catch(err){
|
|
35
|
+
return Promise.reject(err)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async post(document: institution_post): Promise<institution>{
|
|
40
|
+
try {
|
|
41
|
+
let result = await ky.post(this.path.join('/'), {
|
|
42
|
+
headers: {
|
|
43
|
+
authorization: await this.get_auth()
|
|
44
|
+
},
|
|
45
|
+
json: document
|
|
46
|
+
}).json() as Response<institution>;
|
|
47
|
+
return result.data;
|
|
48
|
+
} catch(err){
|
|
49
|
+
return Promise.reject(err)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
document(document_id: string) {
|
|
54
|
+
let path = this.path;
|
|
55
|
+
let get_auth = this.get_auth;
|
|
56
|
+
let collection_id = this.collection_id;
|
|
57
|
+
let collection_name_plural = this.collection_name_plural;
|
|
58
|
+
return new Document(path, collection_id, document_id, collection_name_plural, get_auth);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
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
|
+
|
|
71
|
+
constructor(path: string[], collection_id: string, document_id: string, collection_name_plural: string, get_auth: () => Promise<any>) {
|
|
72
|
+
this.path = path;
|
|
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;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async get(): Promise<institution>{
|
|
80
|
+
try {
|
|
81
|
+
let result = await ky.get([...this.path, this.document_id].join('/'), {
|
|
82
|
+
headers: {
|
|
83
|
+
authorization: await this.get_auth()
|
|
84
|
+
},
|
|
85
|
+
}).json() as Response<institution>;
|
|
86
|
+
return result.data;
|
|
87
|
+
} catch(err){
|
|
88
|
+
return Promise.reject(err)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async put(update: institution_put): Promise<institution>{
|
|
93
|
+
try {
|
|
94
|
+
let result = await ky.put([...this.path, this.document_id].join('/'), {
|
|
95
|
+
headers: {
|
|
96
|
+
authorization: await this.get_auth()
|
|
97
|
+
},
|
|
98
|
+
json: update
|
|
99
|
+
}).json() as Response<institution>;
|
|
100
|
+
return result.data;
|
|
101
|
+
} catch(err){
|
|
102
|
+
return Promise.reject(err)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async remove(): Promise<institution>{
|
|
107
|
+
try {
|
|
108
|
+
let result = await ky.delete([...this.path, this.document_id].join('/'), {
|
|
109
|
+
headers: {
|
|
110
|
+
authorization: await this.get_auth()
|
|
111
|
+
},
|
|
112
|
+
}).json() as Response<institution>;
|
|
113
|
+
return result.data;
|
|
114
|
+
} catch(err){
|
|
115
|
+
return Promise.reject(err)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
collection(collection_id: "client"): Collection_Client;
|
|
120
|
+
collection(collection_id: string) {
|
|
121
|
+
switch(collection_id) {
|
|
122
|
+
case "client":
|
|
123
|
+
return new Collection_Client([...this.path, this.document_id, "client"], this.get_auth);
|
|
124
|
+
default:
|
|
125
|
+
throw new Error(`Api does not have the collection ${collection_id}`)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
@@ -2,12 +2,12 @@ import ky from "ky";
|
|
|
2
2
|
import { encode_search_params, Response, Response_Multiple } from "./utils/utils.js";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { project } from "./types/project.js";
|
|
6
|
+
import { project_query } from "./types/project_query.js";
|
|
7
|
+
import { project_put } from "./types/project_put.js";
|
|
8
|
+
import { project_post } from "./types/project_post.js";
|
|
9
9
|
|
|
10
|
-
export class
|
|
10
|
+
export class Collection_Project {
|
|
11
11
|
path: string[]
|
|
12
12
|
get_auth: () => Promise<any>
|
|
13
13
|
collection_id: string
|
|
@@ -16,33 +16,33 @@ export class Collection_Test_Collection {
|
|
|
16
16
|
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
17
17
|
this.path = path;
|
|
18
18
|
this.get_auth = get_auth;
|
|
19
|
-
this.collection_id = "
|
|
20
|
-
this.collection_name_plural = "
|
|
19
|
+
this.collection_id = "project";
|
|
20
|
+
this.collection_name_plural = "projects"
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
async query(query:
|
|
24
|
+
async query(query: project_query): Promise<project[]>{
|
|
25
25
|
try {
|
|
26
26
|
let result = await ky.get(this.path.join('/'), {
|
|
27
27
|
headers: {
|
|
28
28
|
authorization: await this.get_auth()
|
|
29
29
|
},
|
|
30
30
|
searchParams: encode_search_params(query)
|
|
31
|
-
}).json() as Response_Multiple<
|
|
31
|
+
}).json() as Response_Multiple<project>;
|
|
32
32
|
return result.data;
|
|
33
33
|
} catch(err){
|
|
34
34
|
return Promise.reject(err)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
async post(document:
|
|
38
|
+
async post(document: project_post): Promise<project>{
|
|
39
39
|
try {
|
|
40
40
|
let result = await ky.post(this.path.join('/'), {
|
|
41
41
|
headers: {
|
|
42
42
|
authorization: await this.get_auth()
|
|
43
43
|
},
|
|
44
44
|
json: document
|
|
45
|
-
}).json() as Response<
|
|
45
|
+
}).json() as Response<project>;
|
|
46
46
|
return result.data;
|
|
47
47
|
} catch(err){
|
|
48
48
|
return Promise.reject(err)
|
|
@@ -75,40 +75,40 @@ class Document {
|
|
|
75
75
|
this.get_auth = get_auth;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
async get(): Promise<
|
|
78
|
+
async get(): Promise<project>{
|
|
79
79
|
try {
|
|
80
80
|
let result = await ky.get([...this.path, this.document_id].join('/'), {
|
|
81
81
|
headers: {
|
|
82
82
|
authorization: await this.get_auth()
|
|
83
83
|
},
|
|
84
|
-
}).json() as Response<
|
|
84
|
+
}).json() as Response<project>;
|
|
85
85
|
return result.data;
|
|
86
86
|
} catch(err){
|
|
87
87
|
return Promise.reject(err)
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
async put(update:
|
|
91
|
+
async put(update: project_put): Promise<project>{
|
|
92
92
|
try {
|
|
93
93
|
let result = await ky.put([...this.path, this.document_id].join('/'), {
|
|
94
94
|
headers: {
|
|
95
95
|
authorization: await this.get_auth()
|
|
96
96
|
},
|
|
97
97
|
json: update
|
|
98
|
-
}).json() as Response<
|
|
98
|
+
}).json() as Response<project>;
|
|
99
99
|
return result.data;
|
|
100
100
|
} catch(err){
|
|
101
101
|
return Promise.reject(err)
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
async remove(): Promise<
|
|
105
|
+
async remove(): Promise<project>{
|
|
106
106
|
try {
|
|
107
107
|
let result = await ky.delete([...this.path, this.document_id].join('/'), {
|
|
108
108
|
headers: {
|
|
109
109
|
authorization: await this.get_auth()
|
|
110
110
|
},
|
|
111
|
-
}).json() as Response<
|
|
111
|
+
}).json() as Response<project>;
|
|
112
112
|
return result.data;
|
|
113
113
|
} catch(err){
|
|
114
114
|
return Promise.reject(err)
|
|
@@ -116,35 +116,27 @@ class Document {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
array(key: "
|
|
119
|
+
array(key: "steps"): Collection_Project_Array_steps;
|
|
120
120
|
array(key: string) {
|
|
121
121
|
switch(key) {
|
|
122
|
-
case "
|
|
123
|
-
return new
|
|
122
|
+
case "steps":
|
|
123
|
+
return new Collection_Project_Array_steps([...this.path, this.document_id, "steps"], this.get_auth);
|
|
124
124
|
default:
|
|
125
125
|
throw new Error(`Collection ${this.collection_id} does not have an array at the key ${key}`)
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
export type
|
|
131
|
-
type type_QYkdMaZiAmBjFZLw = {
|
|
130
|
+
export type project_steps_put = {
|
|
132
131
|
"_id": string
|
|
133
|
-
"
|
|
134
|
-
"looped_1": type_QYkdMaZiAmBjFZLw
|
|
132
|
+
"name": string
|
|
135
133
|
}
|
|
136
|
-
export type
|
|
134
|
+
export type project_steps_post = {
|
|
137
135
|
"_id"?: string
|
|
138
|
-
"
|
|
139
|
-
"looped_1": type_VOKxVEvOqcJphaZO
|
|
140
|
-
}
|
|
141
|
-
type type_VOKxVEvOqcJphaZO = {
|
|
142
|
-
"_id": string
|
|
143
|
-
"val": string
|
|
144
|
-
"looped_1": type_VOKxVEvOqcJphaZO
|
|
136
|
+
"name": string
|
|
145
137
|
}
|
|
146
138
|
|
|
147
|
-
export class
|
|
139
|
+
export class Collection_Project_Array_steps {
|
|
148
140
|
path: string[]
|
|
149
141
|
get_auth: () => Promise<any>
|
|
150
142
|
collection_id: string
|
|
@@ -154,46 +146,46 @@ export class Collection_Test_Collection_Array_loop_array {
|
|
|
154
146
|
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
155
147
|
this.path = path;
|
|
156
148
|
this.get_auth = get_auth;
|
|
157
|
-
this.collection_id = "
|
|
158
|
-
this.collection_name_plural = "
|
|
159
|
-
this.array_key = "
|
|
149
|
+
this.collection_id = "project";
|
|
150
|
+
this.collection_name_plural = "projects"
|
|
151
|
+
this.array_key = "steps"
|
|
160
152
|
}
|
|
161
153
|
|
|
162
|
-
async push(document:
|
|
154
|
+
async push(document: project_steps_post): Promise<project>{
|
|
163
155
|
try {
|
|
164
156
|
let result = await ky.post(this.path.join('/'), {
|
|
165
157
|
headers: {
|
|
166
158
|
authorization: await this.get_auth()
|
|
167
159
|
},
|
|
168
160
|
json: document
|
|
169
|
-
}).json() as Response<
|
|
161
|
+
}).json() as Response<project>;
|
|
170
162
|
return result.data;
|
|
171
163
|
} catch(err){
|
|
172
164
|
return Promise.reject(err)
|
|
173
165
|
}
|
|
174
166
|
}
|
|
175
167
|
|
|
176
|
-
async replace(document:
|
|
168
|
+
async replace(document: project_steps_put): Promise<project>{
|
|
177
169
|
try {
|
|
178
170
|
let result = await ky.put([...this.path, document._id].join('/'), {
|
|
179
171
|
headers: {
|
|
180
172
|
authorization: await this.get_auth()
|
|
181
173
|
},
|
|
182
174
|
json: document
|
|
183
|
-
}).json() as Response<
|
|
175
|
+
}).json() as Response<project>;
|
|
184
176
|
return result.data;
|
|
185
177
|
} catch(err){
|
|
186
178
|
return Promise.reject(err)
|
|
187
179
|
}
|
|
188
180
|
}
|
|
189
181
|
|
|
190
|
-
async delete(document_id: string): Promise<
|
|
182
|
+
async delete(document_id: string): Promise<project>{
|
|
191
183
|
try {
|
|
192
184
|
let result = await ky.delete([...this.path, document_id].join('/'), {
|
|
193
185
|
headers: {
|
|
194
186
|
authorization: await this.get_auth()
|
|
195
187
|
}
|
|
196
|
-
}).json() as Response<
|
|
188
|
+
}).json() as Response<project>;
|
|
197
189
|
return result.data;
|
|
198
190
|
} catch(err){
|
|
199
191
|
return Promise.reject(err)
|
package/test/tmp/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ky from 'ky';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Collection_Institution } from "./Institution.js"
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export type Auth_Data = {
|
|
@@ -28,11 +28,11 @@ class Api {
|
|
|
28
28
|
this.get_auth = get_auth
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
collection(collection_id: "
|
|
31
|
+
collection(collection_id: "institution"): Collection_Institution;
|
|
32
32
|
collection(collection_id: string) {
|
|
33
33
|
switch(collection_id) {
|
|
34
|
-
case "
|
|
35
|
-
return new
|
|
34
|
+
case "institution":
|
|
35
|
+
return new Collection_Institution([this.base_url, "institution"], this.get_auth);
|
|
36
36
|
default:
|
|
37
37
|
throw new Error(`Api does not have the collection ${collection_id}`)
|
|
38
38
|
}
|
|
@@ -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,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
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type institution_query = {
|
|
2
2
|
"limit"?: number
|
|
3
3
|
"cursor"?: string
|
|
4
4
|
"sort_order"?: ("ascending" | "descending")
|
|
@@ -6,5 +6,9 @@ export type test_collection_query = {
|
|
|
6
6
|
"_id_gt"?: string
|
|
7
7
|
"_id_lt"?: string
|
|
8
8
|
"_id_in"?: string[]
|
|
9
|
-
"
|
|
9
|
+
"name"?: string
|
|
10
|
+
"name_gt"?: string
|
|
11
|
+
"name_lt"?: string
|
|
12
|
+
"name_in"?: string[]
|
|
13
|
+
"sort"?: ("_id" | "name")
|
|
10
14
|
}
|