@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.
Files changed (102) hide show
  1. package/dist/F_Collection.js.map +1 -1
  2. package/dist/F_Compile.js.map +1 -1
  3. package/dist/code_generation/generate_client_library.js +3 -2
  4. package/dist/code_generation/generate_client_library.js.map +1 -1
  5. package/dist/code_generation/templates/main.mustache +3 -4
  6. package/dist/utils/mongoose_from_zod.d.ts +2 -4
  7. package/package.json +1 -1
  8. package/src/F_Collection.ts +2 -3
  9. package/src/F_Compile.ts +0 -2
  10. package/src/code_generation/generate_client_library.ts +3 -2
  11. package/src/code_generation/templates/main.mustache +1 -1
  12. package/test/tmp/src/{Project.ts → Test_Collection.ts} +46 -34
  13. package/test/tmp/src/index.ts +7 -8
  14. package/test/tmp/src/types/test_collection.ts +9 -0
  15. package/test/tmp/src/types/test_collection_post.ts +9 -0
  16. package/test/tmp/src/types/test_collection_put.ts +9 -0
  17. package/test/tmp/src/types/{institution_query.ts → test_collection_query.ts} +2 -6
  18. package/test/tmp/dist/Brief_News_Category.d.ts +0 -26
  19. package/test/tmp/dist/Brief_News_Category.js +0 -104
  20. package/test/tmp/dist/Brief_News_Category.js.map +0 -1
  21. package/test/tmp/dist/Client.d.ts +0 -30
  22. package/test/tmp/dist/Client.js +0 -116
  23. package/test/tmp/dist/Client.js.map +0 -1
  24. package/test/tmp/dist/Institution.d.ts +0 -28
  25. package/test/tmp/dist/Institution.js +0 -113
  26. package/test/tmp/dist/Institution.js.map +0 -1
  27. package/test/tmp/dist/Project.d.ts +0 -46
  28. package/test/tmp/dist/Project.js +0 -167
  29. package/test/tmp/dist/Project.js.map +0 -1
  30. package/test/tmp/dist/index.d.ts +0 -24
  31. package/test/tmp/dist/index.js +0 -36
  32. package/test/tmp/dist/index.js.map +0 -1
  33. package/test/tmp/dist/types/brief_news_category.d.ts +0 -7
  34. package/test/tmp/dist/types/brief_news_category.js +0 -2
  35. package/test/tmp/dist/types/brief_news_category.js.map +0 -1
  36. package/test/tmp/dist/types/brief_news_category_post.d.ts +0 -7
  37. package/test/tmp/dist/types/brief_news_category_post.js +0 -2
  38. package/test/tmp/dist/types/brief_news_category_post.js.map +0 -1
  39. package/test/tmp/dist/types/brief_news_category_put.d.ts +0 -7
  40. package/test/tmp/dist/types/brief_news_category_put.js +0 -2
  41. package/test/tmp/dist/types/brief_news_category_put.js.map +0 -1
  42. package/test/tmp/dist/types/brief_news_category_query.d.ts +0 -26
  43. package/test/tmp/dist/types/brief_news_category_query.js +0 -2
  44. package/test/tmp/dist/types/brief_news_category_query.js.map +0 -1
  45. package/test/tmp/dist/types/client.d.ts +0 -5
  46. package/test/tmp/dist/types/client.js +0 -2
  47. package/test/tmp/dist/types/client.js.map +0 -1
  48. package/test/tmp/dist/types/client_post.d.ts +0 -5
  49. package/test/tmp/dist/types/client_post.js +0 -2
  50. package/test/tmp/dist/types/client_post.js.map +0 -1
  51. package/test/tmp/dist/types/client_put.d.ts +0 -5
  52. package/test/tmp/dist/types/client_put.js +0 -2
  53. package/test/tmp/dist/types/client_put.js.map +0 -1
  54. package/test/tmp/dist/types/client_query.d.ts +0 -18
  55. package/test/tmp/dist/types/client_query.js +0 -2
  56. package/test/tmp/dist/types/client_query.js.map +0 -1
  57. package/test/tmp/dist/types/institution.d.ts +0 -4
  58. package/test/tmp/dist/types/institution.js +0 -2
  59. package/test/tmp/dist/types/institution.js.map +0 -1
  60. package/test/tmp/dist/types/institution_post.d.ts +0 -4
  61. package/test/tmp/dist/types/institution_post.js +0 -2
  62. package/test/tmp/dist/types/institution_post.js.map +0 -1
  63. package/test/tmp/dist/types/institution_put.d.ts +0 -4
  64. package/test/tmp/dist/types/institution_put.js +0 -2
  65. package/test/tmp/dist/types/institution_put.js.map +0 -1
  66. package/test/tmp/dist/types/institution_query.d.ts +0 -14
  67. package/test/tmp/dist/types/institution_query.js +0 -2
  68. package/test/tmp/dist/types/institution_query.js.map +0 -1
  69. package/test/tmp/dist/types/project.d.ts +0 -11
  70. package/test/tmp/dist/types/project.js +0 -2
  71. package/test/tmp/dist/types/project.js.map +0 -1
  72. package/test/tmp/dist/types/project_post.d.ts +0 -11
  73. package/test/tmp/dist/types/project_post.js +0 -2
  74. package/test/tmp/dist/types/project_post.js.map +0 -1
  75. package/test/tmp/dist/types/project_put.d.ts +0 -11
  76. package/test/tmp/dist/types/project_put.js +0 -2
  77. package/test/tmp/dist/types/project_put.js.map +0 -1
  78. package/test/tmp/dist/types/project_query.d.ts +0 -27
  79. package/test/tmp/dist/types/project_query.js +0 -2
  80. package/test/tmp/dist/types/project_query.js.map +0 -1
  81. package/test/tmp/dist/utils/utils.d.ts +0 -11
  82. package/test/tmp/dist/utils/utils.js +0 -16
  83. package/test/tmp/dist/utils/utils.js.map +0 -1
  84. package/test/tmp/package-lock.json +0 -573
  85. package/test/tmp/src/Brief_News_Category.ts +0 -120
  86. package/test/tmp/src/Client.ts +0 -134
  87. package/test/tmp/src/Institution.ts +0 -130
  88. package/test/tmp/src/types/brief_news_category.ts +0 -7
  89. package/test/tmp/src/types/brief_news_category_post.ts +0 -7
  90. package/test/tmp/src/types/brief_news_category_put.ts +0 -7
  91. package/test/tmp/src/types/brief_news_category_query.ts +0 -26
  92. package/test/tmp/src/types/client.ts +0 -5
  93. package/test/tmp/src/types/client_post.ts +0 -5
  94. package/test/tmp/src/types/client_put.ts +0 -5
  95. package/test/tmp/src/types/client_query.ts +0 -18
  96. package/test/tmp/src/types/institution.ts +0 -4
  97. package/test/tmp/src/types/institution_post.ts +0 -4
  98. package/test/tmp/src/types/institution_put.ts +0 -4
  99. package/test/tmp/src/types/project.ts +0 -11
  100. package/test/tmp/src/types/project_post.ts +0 -11
  101. package/test/tmp/src/types/project_put.ts +0 -11
  102. package/test/tmp/src/types/project_query.ts +0 -27
@@ -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,7 +0,0 @@
1
- export type brief_news_category = {
2
- "_id": string
3
- "name": string
4
- "slug": string
5
- "institution_id": string
6
- "client_id": string
7
- }
@@ -1,7 +0,0 @@
1
- export type brief_news_category_post = {
2
- "_id"?: string
3
- "name": string
4
- "slug": string
5
- "institution_id": string
6
- "client_id": string
7
- }
@@ -1,7 +0,0 @@
1
- export type brief_news_category_put = {
2
- "_id"?: string
3
- "name"?: string
4
- "slug"?: string
5
- "institution_id"?: string
6
- "client_id"?: string
7
- }
@@ -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,5 +0,0 @@
1
- export type client = {
2
- "_id": string
3
- "name": string
4
- "institution_id": string
5
- }
@@ -1,5 +0,0 @@
1
- export type client_post = {
2
- "_id"?: string
3
- "name": string
4
- "institution_id": string
5
- }
@@ -1,5 +0,0 @@
1
- export type client_put = {
2
- "_id"?: string
3
- "name"?: string
4
- "institution_id"?: string
5
- }
@@ -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,4 +0,0 @@
1
- export type institution = {
2
- "_id": string
3
- "name": string
4
- }
@@ -1,4 +0,0 @@
1
- export type institution_post = {
2
- "_id"?: string
3
- "name": string
4
- }
@@ -1,4 +0,0 @@
1
- export type institution_put = {
2
- "_id"?: string
3
- "name"?: string
4
- }
@@ -1,11 +0,0 @@
1
- export type project = {
2
- "_id": string
3
- "name": string
4
- "institution_id": string
5
- "client_id": string
6
- "project_number": number
7
- "steps": {
8
- "_id": string
9
- "name": string
10
- }[]
11
- }
@@ -1,11 +0,0 @@
1
- export type project_post = {
2
- "_id"?: string
3
- "name": string
4
- "institution_id": string
5
- "client_id": string
6
- "project_number": number
7
- "steps": {
8
- "_id": string
9
- "name": string
10
- }[]
11
- }
@@ -1,11 +0,0 @@
1
- export type project_put = {
2
- "_id"?: string
3
- "name"?: string
4
- "institution_id"?: string
5
- "client_id"?: string
6
- "project_number"?: number
7
- "steps"?: {
8
- "_id": string
9
- "name": string
10
- }[]
11
- }
@@ -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
- }