@liminalfunctions/framework 1.0.58 → 1.0.60
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/F_Collection.js.map +1 -1
- package/dist/F_Compile.js.map +1 -1
- package/dist/code_generation/generate_client_library.js +3 -2
- package/dist/code_generation/generate_client_library.js.map +1 -1
- package/dist/code_generation/templates/main.mustache +3 -4
- package/dist/utils/mongoose_from_zod.d.ts +2 -4
- package/package.json +1 -1
- package/src/F_Collection.ts +2 -3
- package/src/F_Compile.ts +0 -2
- package/src/code_generation/generate_client_library.ts +3 -2
- package/src/code_generation/templates/main.mustache +1 -1
- package/test/tmp/src/{Project.ts → Test_Collection.ts} +46 -34
- package/test/tmp/src/index.ts +7 -8
- package/test/tmp/src/types/test_collection.ts +9 -0
- package/test/tmp/src/types/test_collection_post.ts +9 -0
- package/test/tmp/src/types/test_collection_put.ts +9 -0
- package/test/tmp/src/types/{institution_query.ts → test_collection_query.ts} +2 -6
- package/test/tmp/dist/Brief_News_Category.d.ts +0 -26
- package/test/tmp/dist/Brief_News_Category.js +0 -104
- package/test/tmp/dist/Brief_News_Category.js.map +0 -1
- package/test/tmp/dist/Client.d.ts +0 -30
- package/test/tmp/dist/Client.js +0 -116
- package/test/tmp/dist/Client.js.map +0 -1
- package/test/tmp/dist/Institution.d.ts +0 -28
- package/test/tmp/dist/Institution.js +0 -113
- package/test/tmp/dist/Institution.js.map +0 -1
- package/test/tmp/dist/Project.d.ts +0 -46
- package/test/tmp/dist/Project.js +0 -167
- package/test/tmp/dist/Project.js.map +0 -1
- package/test/tmp/dist/index.d.ts +0 -24
- package/test/tmp/dist/index.js +0 -36
- package/test/tmp/dist/index.js.map +0 -1
- package/test/tmp/dist/types/brief_news_category.d.ts +0 -7
- package/test/tmp/dist/types/brief_news_category.js +0 -2
- package/test/tmp/dist/types/brief_news_category.js.map +0 -1
- package/test/tmp/dist/types/brief_news_category_post.d.ts +0 -7
- package/test/tmp/dist/types/brief_news_category_post.js +0 -2
- package/test/tmp/dist/types/brief_news_category_post.js.map +0 -1
- package/test/tmp/dist/types/brief_news_category_put.d.ts +0 -7
- package/test/tmp/dist/types/brief_news_category_put.js +0 -2
- package/test/tmp/dist/types/brief_news_category_put.js.map +0 -1
- package/test/tmp/dist/types/brief_news_category_query.d.ts +0 -26
- package/test/tmp/dist/types/brief_news_category_query.js +0 -2
- package/test/tmp/dist/types/brief_news_category_query.js.map +0 -1
- package/test/tmp/dist/types/client.d.ts +0 -5
- package/test/tmp/dist/types/client.js +0 -2
- package/test/tmp/dist/types/client.js.map +0 -1
- package/test/tmp/dist/types/client_post.d.ts +0 -5
- package/test/tmp/dist/types/client_post.js +0 -2
- package/test/tmp/dist/types/client_post.js.map +0 -1
- package/test/tmp/dist/types/client_put.d.ts +0 -5
- package/test/tmp/dist/types/client_put.js +0 -2
- package/test/tmp/dist/types/client_put.js.map +0 -1
- package/test/tmp/dist/types/client_query.d.ts +0 -18
- package/test/tmp/dist/types/client_query.js +0 -2
- package/test/tmp/dist/types/client_query.js.map +0 -1
- package/test/tmp/dist/types/institution.d.ts +0 -4
- package/test/tmp/dist/types/institution.js +0 -2
- package/test/tmp/dist/types/institution.js.map +0 -1
- package/test/tmp/dist/types/institution_post.d.ts +0 -4
- package/test/tmp/dist/types/institution_post.js +0 -2
- package/test/tmp/dist/types/institution_post.js.map +0 -1
- package/test/tmp/dist/types/institution_put.d.ts +0 -4
- package/test/tmp/dist/types/institution_put.js +0 -2
- package/test/tmp/dist/types/institution_put.js.map +0 -1
- package/test/tmp/dist/types/institution_query.d.ts +0 -14
- package/test/tmp/dist/types/institution_query.js +0 -2
- package/test/tmp/dist/types/institution_query.js.map +0 -1
- package/test/tmp/dist/types/project.d.ts +0 -11
- package/test/tmp/dist/types/project.js +0 -2
- package/test/tmp/dist/types/project.js.map +0 -1
- package/test/tmp/dist/types/project_post.d.ts +0 -11
- package/test/tmp/dist/types/project_post.js +0 -2
- package/test/tmp/dist/types/project_post.js.map +0 -1
- package/test/tmp/dist/types/project_put.d.ts +0 -11
- package/test/tmp/dist/types/project_put.js +0 -2
- package/test/tmp/dist/types/project_put.js.map +0 -1
- package/test/tmp/dist/types/project_query.d.ts +0 -27
- package/test/tmp/dist/types/project_query.js +0 -2
- package/test/tmp/dist/types/project_query.js.map +0 -1
- package/test/tmp/dist/utils/utils.d.ts +0 -11
- package/test/tmp/dist/utils/utils.js +0 -16
- package/test/tmp/dist/utils/utils.js.map +0 -1
- package/test/tmp/package-lock.json +0 -573
- package/test/tmp/src/Brief_News_Category.ts +0 -120
- package/test/tmp/src/Client.ts +0 -134
- package/test/tmp/src/Institution.ts +0 -130
- package/test/tmp/src/types/brief_news_category.ts +0 -7
- package/test/tmp/src/types/brief_news_category_post.ts +0 -7
- package/test/tmp/src/types/brief_news_category_put.ts +0 -7
- package/test/tmp/src/types/brief_news_category_query.ts +0 -26
- package/test/tmp/src/types/client.ts +0 -5
- package/test/tmp/src/types/client_post.ts +0 -5
- package/test/tmp/src/types/client_put.ts +0 -5
- package/test/tmp/src/types/client_query.ts +0 -18
- package/test/tmp/src/types/institution.ts +0 -4
- package/test/tmp/src/types/institution_post.ts +0 -4
- package/test/tmp/src/types/institution_put.ts +0 -4
- package/test/tmp/src/types/project.ts +0 -11
- package/test/tmp/src/types/project_post.ts +0 -11
- package/test/tmp/src/types/project_put.ts +0 -11
- package/test/tmp/src/types/project_query.ts +0 -27
package/test/tmp/src/Client.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,130 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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,27 +0,0 @@
|
|
|
1
|
-
export type project_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
|
-
"client_id"?: string
|
|
18
|
-
"client_id_gt"?: string
|
|
19
|
-
"client_id_lt"?: string
|
|
20
|
-
"client_id_in"?: string[]
|
|
21
|
-
"project_number"?: number
|
|
22
|
-
"project_number_gt"?: number
|
|
23
|
-
"project_number_gte"?: number
|
|
24
|
-
"project_number_lt"?: number
|
|
25
|
-
"project_number_lte"?: number
|
|
26
|
-
"sort"?: ("_id" | "name" | "institution_id" | "client_id" | "project_number")
|
|
27
|
-
}
|