@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.
Files changed (98) hide show
  1. package/dist/code_generation/generate_client_library.js +0 -1
  2. package/dist/code_generation/generate_client_library.js.map +1 -1
  3. package/dist/utils/mongoose_from_zod.js +1 -1
  4. package/dist/utils/mongoose_from_zod.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/code_generation/generate_client_library.ts +0 -1
  7. package/src/utils/mongoose_from_zod.ts +3 -1
  8. package/test/tmp/dist/Brief_News_Category.d.ts +26 -0
  9. package/test/tmp/dist/Brief_News_Category.js +104 -0
  10. package/test/tmp/dist/Brief_News_Category.js.map +1 -0
  11. package/test/tmp/dist/Client.d.ts +30 -0
  12. package/test/tmp/dist/Client.js +116 -0
  13. package/test/tmp/dist/Client.js.map +1 -0
  14. package/test/tmp/dist/Institution.d.ts +28 -0
  15. package/test/tmp/dist/Institution.js +113 -0
  16. package/test/tmp/dist/Institution.js.map +1 -0
  17. package/test/tmp/dist/Project.d.ts +46 -0
  18. package/test/tmp/dist/Project.js +167 -0
  19. package/test/tmp/dist/Project.js.map +1 -0
  20. package/test/tmp/dist/index.d.ts +24 -0
  21. package/test/tmp/dist/index.js +35 -0
  22. package/test/tmp/dist/index.js.map +1 -0
  23. package/test/tmp/dist/types/brief_news_category.d.ts +7 -0
  24. package/test/tmp/dist/types/brief_news_category.js +2 -0
  25. package/test/tmp/dist/types/brief_news_category.js.map +1 -0
  26. package/test/tmp/dist/types/brief_news_category_post.d.ts +7 -0
  27. package/test/tmp/dist/types/brief_news_category_post.js +2 -0
  28. package/test/tmp/dist/types/brief_news_category_post.js.map +1 -0
  29. package/test/tmp/dist/types/brief_news_category_put.d.ts +7 -0
  30. package/test/tmp/dist/types/brief_news_category_put.js +2 -0
  31. package/test/tmp/dist/types/brief_news_category_put.js.map +1 -0
  32. package/test/tmp/dist/types/brief_news_category_query.d.ts +26 -0
  33. package/test/tmp/dist/types/brief_news_category_query.js +2 -0
  34. package/test/tmp/dist/types/brief_news_category_query.js.map +1 -0
  35. package/test/tmp/dist/types/client.d.ts +5 -0
  36. package/test/tmp/dist/types/client.js +2 -0
  37. package/test/tmp/dist/types/client.js.map +1 -0
  38. package/test/tmp/dist/types/client_post.d.ts +5 -0
  39. package/test/tmp/dist/types/client_post.js +2 -0
  40. package/test/tmp/dist/types/client_post.js.map +1 -0
  41. package/test/tmp/dist/types/client_put.d.ts +5 -0
  42. package/test/tmp/dist/types/client_put.js +2 -0
  43. package/test/tmp/dist/types/client_put.js.map +1 -0
  44. package/test/tmp/dist/types/client_query.d.ts +18 -0
  45. package/test/tmp/dist/types/client_query.js +2 -0
  46. package/test/tmp/dist/types/client_query.js.map +1 -0
  47. package/test/tmp/dist/types/institution.d.ts +4 -0
  48. package/test/tmp/dist/types/institution.js +2 -0
  49. package/test/tmp/dist/types/institution.js.map +1 -0
  50. package/test/tmp/dist/types/institution_post.d.ts +4 -0
  51. package/test/tmp/dist/types/institution_post.js +2 -0
  52. package/test/tmp/dist/types/institution_post.js.map +1 -0
  53. package/test/tmp/dist/types/institution_put.d.ts +4 -0
  54. package/test/tmp/dist/types/institution_put.js +2 -0
  55. package/test/tmp/dist/types/institution_put.js.map +1 -0
  56. package/test/tmp/dist/types/institution_query.d.ts +14 -0
  57. package/test/tmp/dist/types/institution_query.js +2 -0
  58. package/test/tmp/dist/types/institution_query.js.map +1 -0
  59. package/test/tmp/dist/types/project.d.ts +11 -0
  60. package/test/tmp/dist/types/project.js +2 -0
  61. package/test/tmp/dist/types/project.js.map +1 -0
  62. package/test/tmp/dist/types/project_post.d.ts +11 -0
  63. package/test/tmp/dist/types/project_post.js +2 -0
  64. package/test/tmp/dist/types/project_post.js.map +1 -0
  65. package/test/tmp/dist/types/project_put.d.ts +11 -0
  66. package/test/tmp/dist/types/project_put.js +2 -0
  67. package/test/tmp/dist/types/project_put.js.map +1 -0
  68. package/test/tmp/dist/types/project_query.d.ts +27 -0
  69. package/test/tmp/dist/types/project_query.js +2 -0
  70. package/test/tmp/dist/types/project_query.js.map +1 -0
  71. package/test/tmp/dist/utils/utils.d.ts +11 -0
  72. package/test/tmp/dist/utils/utils.js +16 -0
  73. package/test/tmp/dist/utils/utils.js.map +1 -0
  74. package/test/tmp/package-lock.json +573 -0
  75. package/test/tmp/src/Brief_News_Category.ts +120 -0
  76. package/test/tmp/src/Client.ts +134 -0
  77. package/test/tmp/src/Institution.ts +130 -0
  78. package/test/tmp/src/{Test_Collection.ts → Project.ts} +34 -42
  79. package/test/tmp/src/index.ts +4 -4
  80. package/test/tmp/src/types/brief_news_category.ts +7 -0
  81. package/test/tmp/src/types/brief_news_category_post.ts +7 -0
  82. package/test/tmp/src/types/brief_news_category_put.ts +7 -0
  83. package/test/tmp/src/types/brief_news_category_query.ts +26 -0
  84. package/test/tmp/src/types/client.ts +5 -0
  85. package/test/tmp/src/types/client_post.ts +5 -0
  86. package/test/tmp/src/types/client_put.ts +5 -0
  87. package/test/tmp/src/types/client_query.ts +18 -0
  88. package/test/tmp/src/types/institution.ts +4 -0
  89. package/test/tmp/src/types/institution_post.ts +4 -0
  90. package/test/tmp/src/types/institution_put.ts +4 -0
  91. package/test/tmp/src/types/{test_collection_query.ts → institution_query.ts} +6 -2
  92. package/test/tmp/src/types/project.ts +11 -0
  93. package/test/tmp/src/types/project_post.ts +11 -0
  94. package/test/tmp/src/types/project_put.ts +11 -0
  95. package/test/tmp/src/types/project_query.ts +27 -0
  96. package/test/tmp/src/types/test_collection.ts +0 -9
  97. package/test/tmp/src/types/test_collection_post.ts +0 -9
  98. package/test/tmp/src/types/test_collection_put.ts +0 -9
@@ -0,0 +1,167 @@
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
+ collection_id;
7
+ collection_name_plural;
8
+ constructor(path, get_auth) {
9
+ this.path = path;
10
+ this.get_auth = get_auth;
11
+ this.collection_id = "project";
12
+ this.collection_name_plural = "projects";
13
+ }
14
+ async query(query) {
15
+ try {
16
+ let result = await ky.get(this.path.join('/'), {
17
+ headers: {
18
+ authorization: await this.get_auth()
19
+ },
20
+ searchParams: encode_search_params(query)
21
+ }).json();
22
+ return result.data;
23
+ }
24
+ catch (err) {
25
+ return Promise.reject(err);
26
+ }
27
+ }
28
+ async post(document) {
29
+ try {
30
+ let result = await ky.post(this.path.join('/'), {
31
+ headers: {
32
+ authorization: await this.get_auth()
33
+ },
34
+ json: document
35
+ }).json();
36
+ return result.data;
37
+ }
38
+ catch (err) {
39
+ return Promise.reject(err);
40
+ }
41
+ }
42
+ document(document_id) {
43
+ let path = this.path;
44
+ let get_auth = this.get_auth;
45
+ let collection_id = this.collection_id;
46
+ let collection_name_plural = this.collection_name_plural;
47
+ return new Document(path, collection_id, document_id, collection_name_plural, get_auth);
48
+ }
49
+ }
50
+ class Document {
51
+ path;
52
+ collection_id;
53
+ document_id;
54
+ collection_name_plural;
55
+ get_auth;
56
+ constructor(path, collection_id, document_id, collection_name_plural, get_auth) {
57
+ this.path = path;
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;
62
+ }
63
+ async get() {
64
+ try {
65
+ let result = await ky.get([...this.path, this.document_id].join('/'), {
66
+ headers: {
67
+ authorization: await this.get_auth()
68
+ },
69
+ }).json();
70
+ return result.data;
71
+ }
72
+ catch (err) {
73
+ return Promise.reject(err);
74
+ }
75
+ }
76
+ async put(update) {
77
+ try {
78
+ let result = await ky.put([...this.path, this.document_id].join('/'), {
79
+ headers: {
80
+ authorization: await this.get_auth()
81
+ },
82
+ json: update
83
+ }).json();
84
+ return result.data;
85
+ }
86
+ catch (err) {
87
+ return Promise.reject(err);
88
+ }
89
+ }
90
+ async remove() {
91
+ try {
92
+ let result = await ky.delete([...this.path, this.document_id].join('/'), {
93
+ headers: {
94
+ authorization: await this.get_auth()
95
+ },
96
+ }).json();
97
+ return result.data;
98
+ }
99
+ catch (err) {
100
+ return Promise.reject(err);
101
+ }
102
+ }
103
+ array(key) {
104
+ switch (key) {
105
+ case "steps":
106
+ return new Collection_Project_Array_steps([...this.path, this.document_id, "steps"], this.get_auth);
107
+ default:
108
+ throw new Error(`Collection ${this.collection_id} does not have an array at the key ${key}`);
109
+ }
110
+ }
111
+ }
112
+ export class Collection_Project_Array_steps {
113
+ path;
114
+ get_auth;
115
+ collection_id;
116
+ collection_name_plural;
117
+ array_key;
118
+ constructor(path, get_auth) {
119
+ this.path = path;
120
+ this.get_auth = get_auth;
121
+ this.collection_id = "project";
122
+ this.collection_name_plural = "projects";
123
+ this.array_key = "steps";
124
+ }
125
+ async push(document) {
126
+ try {
127
+ let result = await ky.post(this.path.join('/'), {
128
+ headers: {
129
+ authorization: await this.get_auth()
130
+ },
131
+ json: document
132
+ }).json();
133
+ return result.data;
134
+ }
135
+ catch (err) {
136
+ return Promise.reject(err);
137
+ }
138
+ }
139
+ async replace(document) {
140
+ try {
141
+ let result = await ky.put([...this.path, document._id].join('/'), {
142
+ headers: {
143
+ authorization: await this.get_auth()
144
+ },
145
+ json: document
146
+ }).json();
147
+ return result.data;
148
+ }
149
+ catch (err) {
150
+ return Promise.reject(err);
151
+ }
152
+ }
153
+ async delete(document_id) {
154
+ try {
155
+ let result = await ky.delete([...this.path, document_id].join('/'), {
156
+ headers: {
157
+ authorization: await this.get_auth()
158
+ }
159
+ }).json();
160
+ return result.data;
161
+ }
162
+ catch (err) {
163
+ return Promise.reject(err);
164
+ }
165
+ }
166
+ }
167
+ //# sourceMappingURL=Project.js.map
@@ -0,0 +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;AAQrF,MAAM,OAAO,kBAAkB;IAC3B,IAAI,CAAU;IACd,QAAQ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AC,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"}
@@ -0,0 +1,24 @@
1
+ import { Collection_Institution } from "./Institution.js";
2
+ export type Auth_Data = {
3
+ user_id: string;
4
+ layers: {
5
+ layer: string;
6
+ layer_id: string;
7
+ permissions: {
8
+ [key: string]: ('read' | 'update' | 'create' | 'delete')[];
9
+ };
10
+ special_permissions: {
11
+ [key: string]: string[];
12
+ };
13
+ }[];
14
+ metadata?: any;
15
+ };
16
+ export declare function api(base_url: string, get_auth: () => Promise<any>): Api;
17
+ declare class Api {
18
+ base_url: string;
19
+ get_auth: () => Promise<any>;
20
+ constructor(base_url: string, get_auth: () => Promise<any>);
21
+ collection(collection_id: "institution"): Collection_Institution;
22
+ me(): Promise<Auth_Data>;
23
+ }
24
+ export {};
@@ -0,0 +1,35 @@
1
+ import ky from 'ky';
2
+ import { Collection_Institution } from "./Institution.js";
3
+ export function api(base_url, get_auth) {
4
+ return new Api(base_url, get_auth);
5
+ }
6
+ class Api {
7
+ base_url;
8
+ get_auth;
9
+ constructor(base_url, get_auth) {
10
+ this.base_url = base_url;
11
+ this.get_auth = get_auth;
12
+ }
13
+ collection(collection_id) {
14
+ switch (collection_id) {
15
+ case "institution":
16
+ return new Collection_Institution([this.base_url, "institution"], this.get_auth);
17
+ default:
18
+ throw new Error(`Api does not have the collection ${collection_id}`);
19
+ }
20
+ }
21
+ async me() {
22
+ try {
23
+ let result = await ky.get([this.base_url, 'me'].join('/'), {
24
+ headers: {
25
+ authorization: await this.get_auth()
26
+ }
27
+ }).json();
28
+ return result;
29
+ }
30
+ catch (err) {
31
+ return Promise.reject(err);
32
+ }
33
+ }
34
+ }
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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;IACL,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,7 @@
1
+ export type brief_news_category = {
2
+ "_id": string;
3
+ "name": string;
4
+ "slug": string;
5
+ "institution_id": string;
6
+ "client_id": string;
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=brief_news_category.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brief_news_category.js","sourceRoot":"","sources":["../../src/types/brief_news_category.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=brief_news_category_post.js.map
@@ -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,7 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=brief_news_category_put.js.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=brief_news_category_query.js.map
@@ -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,5 @@
1
+ export type client = {
2
+ "_id": string;
3
+ "name": string;
4
+ "institution_id": string;
5
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export type client_post = {
2
+ "_id"?: string;
3
+ "name": string;
4
+ "institution_id": string;
5
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client_post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client_post.js","sourceRoot":"","sources":["../../src/types/client_post.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export type client_put = {
2
+ "_id"?: string;
3
+ "name"?: string;
4
+ "institution_id"?: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client_put.js.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client_query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client_query.js","sourceRoot":"","sources":["../../src/types/client_query.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type institution = {
2
+ "_id": string;
3
+ "name": string;
4
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=institution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"institution.js","sourceRoot":"","sources":["../../src/types/institution.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type institution_post = {
2
+ "_id"?: string;
3
+ "name": string;
4
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=institution_post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"institution_post.js","sourceRoot":"","sources":["../../src/types/institution_post.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type institution_put = {
2
+ "_id"?: string;
3
+ "name"?: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=institution_put.js.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=institution_query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"institution_query.js","sourceRoot":"","sources":["../../src/types/institution_query.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/types/project.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project_post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project_post.js","sourceRoot":"","sources":["../../src/types/project_post.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project_put.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project_put.js","sourceRoot":"","sources":["../../src/types/project_put.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project_query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project_query.js","sourceRoot":"","sources":["../../src/types/project_query.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ export declare function encode_search_params(params: {
2
+ [key: string]: string | number | boolean | string[] | Date;
3
+ }): {
4
+ [key: string]: string | number | boolean;
5
+ };
6
+ export type Response<Q> = {
7
+ data: Q;
8
+ };
9
+ export type Response_Multiple<Q> = {
10
+ data: Q[];
11
+ };
@@ -0,0 +1,16 @@
1
+ export function encode_search_params(params) {
2
+ let retval = {};
3
+ for (let [key, value] of Object.entries(params)) {
4
+ if (Array.isArray(value)) {
5
+ retval[key] = value.join(',');
6
+ }
7
+ else if (value instanceof Date) {
8
+ retval[key] = value.toISOString();
9
+ }
10
+ else {
11
+ retval[key] = value;
12
+ }
13
+ }
14
+ return retval;
15
+ }
16
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,MAAoE;IACrG,IAAI,MAAM,GAAgD,EAAE,CAAA;IAC5D,KAAI,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAC,CAAC;QAC5C,IAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC,CAAC;YACrB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACjC,CAAC;aAAM,IAAG,KAAK,YAAY,IAAI,EAAC,CAAC;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACtC,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}