@liminalfunctions/framework 1.0.0
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/.mocharc.json +5 -0
- package/dist/F_Client_Collection_Registry.d.ts +18 -0
- package/dist/F_Client_Collection_Registry.js +36 -0
- package/dist/F_Client_Collection_Registry.js.map +1 -0
- package/dist/F_Collection.d.ts +21 -0
- package/dist/F_Collection.js +36 -0
- package/dist/F_Collection.js.map +1 -0
- package/dist/F_Collection_Registry.d.ts +11 -0
- package/dist/F_Collection_Registry.js +18 -0
- package/dist/F_Collection_Registry.js.map +1 -0
- package/dist/F_Compile.d.ts +4 -0
- package/dist/F_Compile.js +298 -0
- package/dist/F_Compile.js.map +1 -0
- package/dist/F_Security_Models/F_SM_Open_Access.d.ts +11 -0
- package/dist/F_Security_Models/F_SM_Open_Access.js +14 -0
- package/dist/F_Security_Models/F_SM_Open_Access.js.map +1 -0
- package/dist/F_Security_Models/F_SM_Ownership.d.ts +12 -0
- package/dist/F_Security_Models/F_SM_Ownership.js +46 -0
- package/dist/F_Security_Models/F_SM_Ownership.js.map +1 -0
- package/dist/F_Security_Models/F_SM_Role_Membership.d.ts +19 -0
- package/dist/F_Security_Models/F_SM_Role_Membership.js +73 -0
- package/dist/F_Security_Models/F_SM_Role_Membership.js.map +1 -0
- package/dist/F_Security_Models/F_Security_Model.d.ts +41 -0
- package/dist/F_Security_Models/F_Security_Model.js +29 -0
- package/dist/F_Security_Models/F_Security_Model.js.map +1 -0
- package/dist/code_generation/generate_client_library.d.ts +4 -0
- package/dist/code_generation/generate_client_library.js +158 -0
- package/dist/code_generation/generate_client_library.js.map +1 -0
- package/dist/code_generation/templates/.gitignore.mustache +383 -0
- package/dist/code_generation/templates/collection.mustache +106 -0
- package/dist/code_generation/templates/main.mustache +24 -0
- package/dist/code_generation/templates/package.json.mustache +18 -0
- package/dist/code_generation/templates/tsconfig.json.mustache +14 -0
- package/dist/code_generation/templates/types.mustache +4 -0
- package/dist/code_generation/templates/utils.ts.mustache +17 -0
- package/dist/code_generation/utils/tab_indent.d.ts +1 -0
- package/dist/code_generation/utils/tab_indent.js +4 -0
- package/dist/code_generation/utils/tab_indent.js.map +1 -0
- package/dist/code_generation/utils/type_from_zod.d.ts +2 -0
- package/dist/code_generation/utils/type_from_zod.js +102 -0
- package/dist/code_generation/utils/type_from_zod.js.map +1 -0
- package/dist/utils/cache.d.ts +13 -0
- package/dist/utils/cache.js +101 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/mongoose_from_zod.d.ts +13 -0
- package/dist/utils/mongoose_from_zod.js +164 -0
- package/dist/utils/mongoose_from_zod.js.map +1 -0
- package/dist/utils/pretty_print_zod.d.ts +2 -0
- package/dist/utils/pretty_print_zod.js +63 -0
- package/dist/utils/pretty_print_zod.js.map +1 -0
- package/dist/utils/query_object_to_mongodb_query.d.ts +3 -0
- package/dist/utils/query_object_to_mongodb_query.js +61 -0
- package/dist/utils/query_object_to_mongodb_query.js.map +1 -0
- package/dist/utils/query_validator_from_zod.d.ts +6 -0
- package/dist/utils/query_validator_from_zod.js +216 -0
- package/dist/utils/query_validator_from_zod.js.map +1 -0
- package/package.json +36 -0
- package/src/F_Collection.ts +50 -0
- package/src/F_Collection_Registry.ts +29 -0
- package/src/F_Compile.ts +368 -0
- package/src/F_Security_Models/F_SM_Open_Access.ts +21 -0
- package/src/F_Security_Models/F_SM_Ownership.ts +72 -0
- package/src/F_Security_Models/F_SM_Role_Membership.ts +87 -0
- package/src/F_Security_Models/F_Security_Model.ts +85 -0
- package/src/code_generation/generate_client_library.ts +197 -0
- package/src/code_generation/templates/.gitignore.mustache +383 -0
- package/src/code_generation/templates/collection.mustache +106 -0
- package/src/code_generation/templates/main.mustache +24 -0
- package/src/code_generation/templates/package.json.mustache +18 -0
- package/src/code_generation/templates/tsconfig.json.mustache +14 -0
- package/src/code_generation/templates/types.mustache +4 -0
- package/src/code_generation/templates/utils.ts.mustache +17 -0
- package/src/code_generation/utils/tab_indent.ts +3 -0
- package/src/code_generation/utils/type_from_zod.ts +140 -0
- package/src/utils/cache.ts +149 -0
- package/src/utils/mongoose_from_zod.ts +191 -0
- package/src/utils/pretty_print_zod.ts +75 -0
- package/src/utils/query_object_to_mongodb_query.ts +73 -0
- package/src/utils/query_validator_from_zod.ts +246 -0
- package/test/0_0_mongoose_from_zod.test.ts +260 -0
- package/test/0_1_query_validator_from_zod.test.ts +518 -0
- package/test/0_2_query_validator_to_mongodb_query.test.ts +365 -0
- package/test/0_3_cache.test.ts +204 -0
- package/test/1_0_basic_server.test.ts +530 -0
- package/test/1_1_security_ownership.test.ts +328 -0
- package/test/1_2_role_membership.test.ts +731 -0
- package/test/2_0_client_library_basic_type_generation.test.ts +444 -0
- package/test/2_0_client_library_query_type_generation.test.ts +352 -0
- package/test/2_1_client_library_generation.test.ts +255 -0
- 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
- package/test/tmp/package-lock.json +573 -0
- package/test/tmp/package.json +18 -0
- package/test/tmp/src/Brief_News_Category.ts +94 -0
- package/test/tmp/src/Client.ts +106 -0
- package/test/tmp/src/Institution.ts +103 -0
- package/test/tmp/src/Project.ts +94 -0
- package/test/tmp/src/index.ts +20 -0
- 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/institution_query.ts +14 -0
- package/test/tmp/src/types/project.ts +7 -0
- package/test/tmp/src/types/project_post.ts +7 -0
- package/test/tmp/src/types/project_put.ts +7 -0
- package/test/tmp/src/types/project_query.ts +27 -0
- package/test/tmp/src/utils/utils.ts +17 -0
- package/test/tmp/tsconfig.json +14 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { F_Collection } from "../F_Collection.js";
|
|
2
|
+
import { F_Collection_Registry } from "../F_Collection_Registry.js";
|
|
3
|
+
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
4
|
+
import { type_from_zod } from "./utils/type_from_zod.js";
|
|
5
|
+
import mustache from 'mustache'
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { pretty_print } from "../utils/pretty_print_zod.js";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
type api_builder = {
|
|
11
|
+
collection?: F_Collection<string, any>,
|
|
12
|
+
mustache_context?: any,
|
|
13
|
+
children: {
|
|
14
|
+
[key: string]: api_builder
|
|
15
|
+
},
|
|
16
|
+
parent?: api_builder
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export async function generate_client_library<Collections>(path: string, collection_registry: F_Collection_Registry<Collections>, service_name = 'default-service') {
|
|
21
|
+
let api_builder: api_builder = {
|
|
22
|
+
mustache_context: {},
|
|
23
|
+
children: {}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// build the typescript types
|
|
27
|
+
for(let col of Object.values(collection_registry.collections)){
|
|
28
|
+
let collection = col as F_Collection<string, any>;
|
|
29
|
+
|
|
30
|
+
let mustache_context = {
|
|
31
|
+
collection_id: collection.collection_id,
|
|
32
|
+
|
|
33
|
+
type_return: `${get_type_name(collection.collection_id)}`,
|
|
34
|
+
path_type_return: `types/${get_type_name(collection.collection_id)}`,
|
|
35
|
+
|
|
36
|
+
type_query: `${get_type_name(collection.collection_id)}_query`,
|
|
37
|
+
path_type_query: `types/${get_type_name(collection.collection_id)}_query`,
|
|
38
|
+
|
|
39
|
+
type_put: `${get_type_name(collection.collection_id)}_put`,
|
|
40
|
+
path_type_put: `types/${get_type_name(collection.collection_id)}_put`,
|
|
41
|
+
|
|
42
|
+
type_post: `${get_type_name(collection.collection_id)}_post`,
|
|
43
|
+
path_type_post: `types/${get_type_name(collection.collection_id)}_post`,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let collection_type_definition_builder = [] as string[];
|
|
47
|
+
let collection_type_main = type_from_zod(collection.validator, 0);
|
|
48
|
+
collection_type_definition_builder.push(`export type ${mustache_context.type_return} = ${collection_type_main[0]}`, ...collection_type_main.slice(1));
|
|
49
|
+
|
|
50
|
+
let collection_query_type_definition_builder = [] as string[];
|
|
51
|
+
let collection_type_query = type_from_zod(collection.query_validator_client, 0);
|
|
52
|
+
collection_query_type_definition_builder.push(`export type ${mustache_context.type_query} = ${collection_type_query[0]}`, ...collection_type_query.slice(1));
|
|
53
|
+
|
|
54
|
+
let collection_put_type_definition_builder = [] as string[];
|
|
55
|
+
let collection_type_put = type_from_zod(collection.put_validator, 0);
|
|
56
|
+
collection_put_type_definition_builder.push(`export type ${mustache_context.type_put} = ${collection_type_put[0]}`, ...collection_type_put.slice(1));
|
|
57
|
+
|
|
58
|
+
let collection_post_type_definition_builder = [] as string[];
|
|
59
|
+
let collection_type_post = type_from_zod(collection.post_validator, 0);
|
|
60
|
+
collection_post_type_definition_builder.push(`export type ${mustache_context.type_post} = ${collection_type_post[0]}`, ...collection_type_post.slice(1));
|
|
61
|
+
|
|
62
|
+
if(!existsSync([path, 'src'].join('/'))){ await mkdir([path, 'src'].join('/')); }
|
|
63
|
+
if(!existsSync([path, 'dist'].join('/'))){ await mkdir([path, 'dist'].join('/')); }
|
|
64
|
+
if(!existsSync([path, 'src', 'types'].join('/'))){ await mkdir([path, 'src', 'types'].join('/')); }
|
|
65
|
+
if(!existsSync([path, 'src', 'utils'].join('/'))){ await mkdir([path, 'src', 'utils'].join('/')); }
|
|
66
|
+
await writeFile([path, 'src', 'utils', 'utils.ts'].join('/'), await readFile(import.meta.resolve('./templates/utils.ts.mustache').slice(8), { encoding: 'utf-8' }));
|
|
67
|
+
await writeFile([path, 'tsconfig.json'].join('/'), await readFile(import.meta.resolve('./templates/tsconfig.json.mustache').slice(8), { encoding: 'utf-8' }));
|
|
68
|
+
await writeFile([path, '.gitignore'].join('/'), await readFile(import.meta.resolve('./templates/.gitignore.mustache').slice(8), { encoding: 'utf-8' }));
|
|
69
|
+
await writeFile([path, 'src', mustache_context.path_type_return + '.ts'].join('/'), collection_type_definition_builder.join('\n'));
|
|
70
|
+
await writeFile([path, 'src', mustache_context.path_type_query + '.ts'].join('/'), collection_query_type_definition_builder.join('\n'));
|
|
71
|
+
await writeFile([path, 'src', mustache_context.path_type_put + '.ts'].join('/'), collection_put_type_definition_builder.join('\n'));
|
|
72
|
+
await writeFile([path, 'src', mustache_context.path_type_post + '.ts'].join('/'), collection_post_type_definition_builder.join('\n'));
|
|
73
|
+
|
|
74
|
+
for(let access_layer of collection.access_layers) {
|
|
75
|
+
let builder = get_builder(api_builder, access_layer.layers, collection, mustache_context);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let mustache_main = await readFile(import.meta.resolve('./templates/main.mustache').slice(8), { encoding: 'utf-8' });
|
|
80
|
+
let mustache_types = await readFile(import.meta.resolve('./templates/types.mustache').slice(8), { encoding: 'utf-8' });
|
|
81
|
+
let mustache_collection = await readFile(import.meta.resolve('./templates/collection.mustache').slice(8), { encoding: 'utf-8' });
|
|
82
|
+
let mustache_package = await readFile(import.meta.resolve('./templates/package.json.mustache').slice(8), { encoding: 'utf-8' });
|
|
83
|
+
|
|
84
|
+
let builder_leaves = [];
|
|
85
|
+
let queue: api_builder[] = [api_builder];
|
|
86
|
+
while(queue.length > 0){
|
|
87
|
+
let builder = queue.shift();
|
|
88
|
+
|
|
89
|
+
let children = Object.values(builder.children);
|
|
90
|
+
if(children.length > 0){
|
|
91
|
+
queue.push(...children);
|
|
92
|
+
} else {
|
|
93
|
+
builder_leaves.push(builder);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
builder.mustache_context.child_collection_id_types = `"${children.map(ele => ele.mustache_context.collection_id).join('" | "')}"`
|
|
97
|
+
builder.mustache_context.child_collections = children.map(ele => {
|
|
98
|
+
return {
|
|
99
|
+
collection_id: ele.mustache_context.collection_id,
|
|
100
|
+
built_collection: uppercase(ele.mustache_context.collection_id),
|
|
101
|
+
built_collection_path: `./${uppercase(ele.mustache_context.collection_id)}.js`
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// save the escape function used by mustache so that if another
|
|
107
|
+
// tool or portion of the tool uses mustache, we don't create
|
|
108
|
+
// a difficult-to-diagnose bug. It is important not to have any
|
|
109
|
+
// async calls until we have restored the original escape function.
|
|
110
|
+
let original_escape = mustache.escape;
|
|
111
|
+
mustache.escape = (text) => text;
|
|
112
|
+
|
|
113
|
+
let rendered_index = mustache.render(mustache_main, api_builder.mustache_context);
|
|
114
|
+
let rendered_collection_manipulators = [];
|
|
115
|
+
|
|
116
|
+
queue = Object.values(api_builder.children)
|
|
117
|
+
let added = new Set(Object.values(api_builder.children));
|
|
118
|
+
while(queue.length > 0){
|
|
119
|
+
let builder = queue.shift();
|
|
120
|
+
builder.mustache_context.my_built_collection = uppercase(builder.mustache_context.collection_id);
|
|
121
|
+
builder.mustache_context.my_built_collection_path = `./${uppercase(builder.mustache_context.collection_id)}`;
|
|
122
|
+
builder.mustache_context.types = mustache.render(mustache_types, builder.mustache_context);
|
|
123
|
+
builder.mustache_context.has_subcollections = builder.mustache_context.child_collections.length > 0;
|
|
124
|
+
rendered_collection_manipulators.push({builder: builder, text: mustache.render(mustache_collection, builder.mustache_context)})
|
|
125
|
+
queue.push(...Object.values(builder.children).filter(ele => !added.has(ele)));
|
|
126
|
+
for(let child of Object.values(builder.children)){
|
|
127
|
+
added.add(child);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let rendered_package_json = mustache.render(mustache_package, {
|
|
132
|
+
server_name: service_name
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// restore the original escape function so that it the escape function
|
|
136
|
+
// used by this code doesn't interfere with other vode.
|
|
137
|
+
mustache.escape = original_escape;
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
await writeFile([path, 'src', './index.ts'].join('/'), rendered_index);
|
|
141
|
+
for(let manipulator of rendered_collection_manipulators) {
|
|
142
|
+
await writeFile([path, 'src', manipulator.builder.mustache_context.my_built_collection_path as string + '.ts'].join('/'), manipulator.text);
|
|
143
|
+
}
|
|
144
|
+
await writeFile([path, './package.json'].join('/'), rendered_package_json);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function get_type_name(collection_id: string, suffix?: string): string {
|
|
148
|
+
return suffix ? `${collection_id}_${suffix}`.replace(/[^(a-zA-Z0-9\_)]/g, '_') : collection_id.replace(/[^(a-zA-Z0-9\_)]/g, '_');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function uppercase(str: string): string {
|
|
152
|
+
let upper_on = true;
|
|
153
|
+
let joinable = [];
|
|
154
|
+
for(let char of str) {
|
|
155
|
+
if(char === '_'){ upper_on = true; joinable.push(char); continue;}
|
|
156
|
+
if(upper_on) {
|
|
157
|
+
upper_on = false;
|
|
158
|
+
joinable.push(char.toUpperCase())
|
|
159
|
+
} else {
|
|
160
|
+
joinable.push(char)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return joinable.join('')
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function get_builder(root: api_builder, parent_collection_ids: string[], collection: F_Collection<string, any>, mustache_context: any){
|
|
168
|
+
let builder = root;
|
|
169
|
+
let collection_ids = parent_collection_ids.slice();
|
|
170
|
+
while(collection_ids.length > 0){
|
|
171
|
+
let collection_id = collection_ids.shift();
|
|
172
|
+
if(!builder.children[collection_id]){
|
|
173
|
+
builder.children[collection_id] = {
|
|
174
|
+
children: {},
|
|
175
|
+
parent: builder,
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
builder = builder.children[collection_id];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if(!builder.children[collection.collection_id]){
|
|
182
|
+
builder.children[collection.collection_id] = {
|
|
183
|
+
children: {},
|
|
184
|
+
parent: builder,
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
builder = builder.children[collection.collection_id];
|
|
189
|
+
|
|
190
|
+
if(!builder.collection){
|
|
191
|
+
builder.collection = collection;
|
|
192
|
+
builder.mustache_context = mustache_context;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return builder;
|
|
196
|
+
}
|
|
197
|
+
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
.env
|
|
2
|
+
/test/tmp
|
|
3
|
+
|
|
4
|
+
## Ignore Visual Studio temporary files, build results, and
|
|
5
|
+
## files generated by popular Visual Studio add-ons.
|
|
6
|
+
##
|
|
7
|
+
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
8
|
+
|
|
9
|
+
# User-specific files
|
|
10
|
+
*.rsuser
|
|
11
|
+
*.suo
|
|
12
|
+
*.user
|
|
13
|
+
*.userosscache
|
|
14
|
+
*.sln.docstates
|
|
15
|
+
|
|
16
|
+
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
17
|
+
*.userprefs
|
|
18
|
+
|
|
19
|
+
# Mono auto generated files
|
|
20
|
+
mono_crash.*
|
|
21
|
+
|
|
22
|
+
# Build results
|
|
23
|
+
[Dd]ebug/
|
|
24
|
+
[Dd]ebugPublic/
|
|
25
|
+
[Rr]elease/
|
|
26
|
+
[Rr]eleases/
|
|
27
|
+
x64/
|
|
28
|
+
x86/
|
|
29
|
+
[Ww][Ii][Nn]32/
|
|
30
|
+
[Aa][Rr][Mm]/
|
|
31
|
+
[Aa][Rr][Mm]64/
|
|
32
|
+
bld/
|
|
33
|
+
[Bb]in/
|
|
34
|
+
[Oo]bj/
|
|
35
|
+
[Oo]ut/
|
|
36
|
+
[Ll]og/
|
|
37
|
+
[Ll]ogs/
|
|
38
|
+
|
|
39
|
+
# Visual Studio 2015/2017 cache/options directory
|
|
40
|
+
.vs/
|
|
41
|
+
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
42
|
+
#wwwroot/
|
|
43
|
+
|
|
44
|
+
# Visual Studio 2017 auto generated files
|
|
45
|
+
Generated\ Files/
|
|
46
|
+
|
|
47
|
+
# MSTest test Results
|
|
48
|
+
[Tt]est[Rr]esult*/
|
|
49
|
+
[Bb]uild[Ll]og.*
|
|
50
|
+
|
|
51
|
+
# NUnit
|
|
52
|
+
*.VisualState.xml
|
|
53
|
+
TestResult.xml
|
|
54
|
+
nunit-*.xml
|
|
55
|
+
|
|
56
|
+
# Build Results of an ATL Project
|
|
57
|
+
[Dd]ebugPS/
|
|
58
|
+
[Rr]eleasePS/
|
|
59
|
+
dlldata.c
|
|
60
|
+
|
|
61
|
+
# Benchmark Results
|
|
62
|
+
BenchmarkDotNet.Artifacts/
|
|
63
|
+
|
|
64
|
+
# .NET Core
|
|
65
|
+
project.lock.json
|
|
66
|
+
project.fragment.lock.json
|
|
67
|
+
artifacts/
|
|
68
|
+
|
|
69
|
+
# ASP.NET Scaffolding
|
|
70
|
+
ScaffoldingReadMe.txt
|
|
71
|
+
|
|
72
|
+
# StyleCop
|
|
73
|
+
StyleCopReport.xml
|
|
74
|
+
|
|
75
|
+
# Files built by Visual Studio
|
|
76
|
+
*_i.c
|
|
77
|
+
*_p.c
|
|
78
|
+
*_h.h
|
|
79
|
+
*.ilk
|
|
80
|
+
*.meta
|
|
81
|
+
*.obj
|
|
82
|
+
*.iobj
|
|
83
|
+
*.pch
|
|
84
|
+
*.pdb
|
|
85
|
+
*.ipdb
|
|
86
|
+
*.pgc
|
|
87
|
+
*.pgd
|
|
88
|
+
*.rsp
|
|
89
|
+
*.sbr
|
|
90
|
+
*.tlb
|
|
91
|
+
*.tli
|
|
92
|
+
*.tlh
|
|
93
|
+
*.tmp
|
|
94
|
+
*.tmp_proj
|
|
95
|
+
*_wpftmp.csproj
|
|
96
|
+
*.log
|
|
97
|
+
*.vspscc
|
|
98
|
+
*.vssscc
|
|
99
|
+
.builds
|
|
100
|
+
*.pidb
|
|
101
|
+
*.svclog
|
|
102
|
+
*.scc
|
|
103
|
+
|
|
104
|
+
# Chutzpah Test files
|
|
105
|
+
_Chutzpah*
|
|
106
|
+
|
|
107
|
+
# Visual C++ cache files
|
|
108
|
+
ipch/
|
|
109
|
+
*.aps
|
|
110
|
+
*.ncb
|
|
111
|
+
*.opendb
|
|
112
|
+
*.opensdf
|
|
113
|
+
*.sdf
|
|
114
|
+
*.cachefile
|
|
115
|
+
*.VC.db
|
|
116
|
+
*.VC.VC.opendb
|
|
117
|
+
|
|
118
|
+
# Visual Studio profiler
|
|
119
|
+
*.psess
|
|
120
|
+
*.vsp
|
|
121
|
+
*.vspx
|
|
122
|
+
*.sap
|
|
123
|
+
|
|
124
|
+
# Visual Studio Trace Files
|
|
125
|
+
*.e2e
|
|
126
|
+
|
|
127
|
+
# TFS 2012 Local Workspace
|
|
128
|
+
$tf/
|
|
129
|
+
|
|
130
|
+
# Guidance Automation Toolkit
|
|
131
|
+
*.gpState
|
|
132
|
+
|
|
133
|
+
# ReSharper is a .NET coding add-in
|
|
134
|
+
_ReSharper*/
|
|
135
|
+
*.[Rr]e[Ss]harper
|
|
136
|
+
*.DotSettings.user
|
|
137
|
+
|
|
138
|
+
# TeamCity is a build add-in
|
|
139
|
+
_TeamCity*
|
|
140
|
+
|
|
141
|
+
# DotCover is a Code Coverage Tool
|
|
142
|
+
*.dotCover
|
|
143
|
+
|
|
144
|
+
# AxoCover is a Code Coverage Tool
|
|
145
|
+
.axoCover/*
|
|
146
|
+
!.axoCover/settings.json
|
|
147
|
+
|
|
148
|
+
# Coverlet is a free, cross platform Code Coverage Tool
|
|
149
|
+
coverage*.json
|
|
150
|
+
coverage*.xml
|
|
151
|
+
coverage*.info
|
|
152
|
+
|
|
153
|
+
# Visual Studio code coverage results
|
|
154
|
+
*.coverage
|
|
155
|
+
*.coveragexml
|
|
156
|
+
|
|
157
|
+
# NCrunch
|
|
158
|
+
_NCrunch_*
|
|
159
|
+
.*crunch*.local.xml
|
|
160
|
+
nCrunchTemp_*
|
|
161
|
+
|
|
162
|
+
# MightyMoose
|
|
163
|
+
*.mm.*
|
|
164
|
+
AutoTest.Net/
|
|
165
|
+
|
|
166
|
+
# Web workbench (sass)
|
|
167
|
+
.sass-cache/
|
|
168
|
+
|
|
169
|
+
# Installshield output folder
|
|
170
|
+
[Ee]xpress/
|
|
171
|
+
|
|
172
|
+
# DocProject is a documentation generator add-in
|
|
173
|
+
DocProject/buildhelp/
|
|
174
|
+
DocProject/Help/*.HxT
|
|
175
|
+
DocProject/Help/*.HxC
|
|
176
|
+
DocProject/Help/*.hhc
|
|
177
|
+
DocProject/Help/*.hhk
|
|
178
|
+
DocProject/Help/*.hhp
|
|
179
|
+
DocProject/Help/Html2
|
|
180
|
+
DocProject/Help/html
|
|
181
|
+
|
|
182
|
+
# Click-Once directory
|
|
183
|
+
publish/
|
|
184
|
+
|
|
185
|
+
# Publish Web Output
|
|
186
|
+
*.[Pp]ublish.xml
|
|
187
|
+
*.azurePubxml
|
|
188
|
+
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
189
|
+
# but database connection strings (with potential passwords) will be unencrypted
|
|
190
|
+
*.pubxml
|
|
191
|
+
*.publishproj
|
|
192
|
+
|
|
193
|
+
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
194
|
+
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
195
|
+
# in these scripts will be unencrypted
|
|
196
|
+
PublishScripts/
|
|
197
|
+
|
|
198
|
+
# NuGet Packages
|
|
199
|
+
*.nupkg
|
|
200
|
+
# NuGet Symbol Packages
|
|
201
|
+
*.snupkg
|
|
202
|
+
# The packages folder can be ignored because of Package Restore
|
|
203
|
+
**/[Pp]ackages/*
|
|
204
|
+
# except build/, which is used as an MSBuild target.
|
|
205
|
+
!**/[Pp]ackages/build/
|
|
206
|
+
# Uncomment if necessary however generally it will be regenerated when needed
|
|
207
|
+
#!**/[Pp]ackages/repositories.config
|
|
208
|
+
# NuGet v3's project.json files produces more ignorable files
|
|
209
|
+
*.nuget.props
|
|
210
|
+
*.nuget.targets
|
|
211
|
+
|
|
212
|
+
# Microsoft Azure Build Output
|
|
213
|
+
csx/
|
|
214
|
+
*.build.csdef
|
|
215
|
+
|
|
216
|
+
# Microsoft Azure Emulator
|
|
217
|
+
ecf/
|
|
218
|
+
rcf/
|
|
219
|
+
|
|
220
|
+
# Windows Store app package directories and files
|
|
221
|
+
AppPackages/
|
|
222
|
+
BundleArtifacts/
|
|
223
|
+
Package.StoreAssociation.xml
|
|
224
|
+
_pkginfo.txt
|
|
225
|
+
*.appx
|
|
226
|
+
*.appxbundle
|
|
227
|
+
*.appxupload
|
|
228
|
+
|
|
229
|
+
# Visual Studio cache files
|
|
230
|
+
# files ending in .cache can be ignored
|
|
231
|
+
*.[Cc]ache
|
|
232
|
+
# but keep track of directories ending in .cache
|
|
233
|
+
!?*.[Cc]ache/
|
|
234
|
+
|
|
235
|
+
# Others
|
|
236
|
+
ClientBin/
|
|
237
|
+
~$*
|
|
238
|
+
*~
|
|
239
|
+
*.dbmdl
|
|
240
|
+
*.dbproj.schemaview
|
|
241
|
+
*.jfm
|
|
242
|
+
*.pfx
|
|
243
|
+
*.publishsettings
|
|
244
|
+
orleans.codegen.cs
|
|
245
|
+
|
|
246
|
+
# Including strong name files can present a security risk
|
|
247
|
+
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
248
|
+
#*.snk
|
|
249
|
+
|
|
250
|
+
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
251
|
+
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
252
|
+
#bower_components/
|
|
253
|
+
|
|
254
|
+
# RIA/Silverlight projects
|
|
255
|
+
Generated_Code/
|
|
256
|
+
|
|
257
|
+
# Backup & report files from converting an old project file
|
|
258
|
+
# to a newer Visual Studio version. Backup files are not needed,
|
|
259
|
+
# because we have git ;-)
|
|
260
|
+
_UpgradeReport_Files/
|
|
261
|
+
Backup*/
|
|
262
|
+
UpgradeLog*.XML
|
|
263
|
+
UpgradeLog*.htm
|
|
264
|
+
ServiceFabricBackup/
|
|
265
|
+
*.rptproj.bak
|
|
266
|
+
|
|
267
|
+
# SQL Server files
|
|
268
|
+
*.mdf
|
|
269
|
+
*.ldf
|
|
270
|
+
*.ndf
|
|
271
|
+
|
|
272
|
+
# Business Intelligence projects
|
|
273
|
+
*.rdl.data
|
|
274
|
+
*.bim.layout
|
|
275
|
+
*.bim_*.settings
|
|
276
|
+
*.rptproj.rsuser
|
|
277
|
+
*- [Bb]ackup.rdl
|
|
278
|
+
*- [Bb]ackup ([0-9]).rdl
|
|
279
|
+
*- [Bb]ackup ([0-9][0-9]).rdl
|
|
280
|
+
|
|
281
|
+
# Microsoft Fakes
|
|
282
|
+
FakesAssemblies/
|
|
283
|
+
|
|
284
|
+
# GhostDoc plugin setting file
|
|
285
|
+
*.GhostDoc.xml
|
|
286
|
+
|
|
287
|
+
# Node.js Tools for Visual Studio
|
|
288
|
+
.ntvs_analysis.dat
|
|
289
|
+
node_modules/
|
|
290
|
+
|
|
291
|
+
# Visual Studio 6 build log
|
|
292
|
+
*.plg
|
|
293
|
+
|
|
294
|
+
# Visual Studio 6 workspace options file
|
|
295
|
+
*.opt
|
|
296
|
+
|
|
297
|
+
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
298
|
+
*.vbw
|
|
299
|
+
|
|
300
|
+
# Visual Studio LightSwitch build output
|
|
301
|
+
**/*.HTMLClient/GeneratedArtifacts
|
|
302
|
+
**/*.DesktopClient/GeneratedArtifacts
|
|
303
|
+
**/*.DesktopClient/ModelManifest.xml
|
|
304
|
+
**/*.Server/GeneratedArtifacts
|
|
305
|
+
**/*.Server/ModelManifest.xml
|
|
306
|
+
_Pvt_Extensions
|
|
307
|
+
|
|
308
|
+
# Paket dependency manager
|
|
309
|
+
.paket/paket.exe
|
|
310
|
+
paket-files/
|
|
311
|
+
|
|
312
|
+
# FAKE - F# Make
|
|
313
|
+
.fake/
|
|
314
|
+
|
|
315
|
+
# CodeRush personal settings
|
|
316
|
+
.cr/personal
|
|
317
|
+
|
|
318
|
+
# Python Tools for Visual Studio (PTVS)
|
|
319
|
+
__pycache__/
|
|
320
|
+
*.pyc
|
|
321
|
+
|
|
322
|
+
# Cake - Uncomment if you are using it
|
|
323
|
+
# tools/**
|
|
324
|
+
# !tools/packages.config
|
|
325
|
+
|
|
326
|
+
# Tabs Studio
|
|
327
|
+
*.tss
|
|
328
|
+
|
|
329
|
+
# Telerik's JustMock configuration file
|
|
330
|
+
*.jmconfig
|
|
331
|
+
|
|
332
|
+
# BizTalk build output
|
|
333
|
+
*.btp.cs
|
|
334
|
+
*.btm.cs
|
|
335
|
+
*.odx.cs
|
|
336
|
+
*.xsd.cs
|
|
337
|
+
|
|
338
|
+
# OpenCover UI analysis results
|
|
339
|
+
OpenCover/
|
|
340
|
+
|
|
341
|
+
# Azure Stream Analytics local run output
|
|
342
|
+
ASALocalRun/
|
|
343
|
+
|
|
344
|
+
# MSBuild Binary and Structured Log
|
|
345
|
+
*.binlog
|
|
346
|
+
|
|
347
|
+
# NVidia Nsight GPU debugger configuration file
|
|
348
|
+
*.nvuser
|
|
349
|
+
|
|
350
|
+
# MFractors (Xamarin productivity tool) working folder
|
|
351
|
+
.mfractor/
|
|
352
|
+
|
|
353
|
+
# Local History for Visual Studio
|
|
354
|
+
.localhistory/
|
|
355
|
+
|
|
356
|
+
# BeatPulse healthcheck temp database
|
|
357
|
+
healthchecksdb
|
|
358
|
+
|
|
359
|
+
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
|
360
|
+
MigrationBackup/
|
|
361
|
+
|
|
362
|
+
# Ionide (cross platform F# VS Code tools) working folder
|
|
363
|
+
.ionide/
|
|
364
|
+
|
|
365
|
+
# Fody - auto-generated XML schema
|
|
366
|
+
FodyWeavers.xsd
|
|
367
|
+
internal_dependencies/copypress-thematical-pp-common-libraries-1.0.0.tgz
|
|
368
|
+
plugins/rsa
|
|
369
|
+
check_24h.csv
|
|
370
|
+
check_2025-02-11.csv
|
|
371
|
+
check_2025-02-12.csv
|
|
372
|
+
check_start.csv
|
|
373
|
+
check_url_constrained.csv
|
|
374
|
+
check_2025-02-13_2.csv
|
|
375
|
+
check_2025-02-13.csv
|
|
376
|
+
check_2025-02-14.csv
|
|
377
|
+
check_2025-02-18.csv
|
|
378
|
+
check_2025-02-19.csv
|
|
379
|
+
check_2025-02-24_big.csv
|
|
380
|
+
check_2025-02-24.csv
|
|
381
|
+
check_2025-02-27_rock.csv
|
|
382
|
+
hub_spoke_test.txt
|
|
383
|
+
hub_spoke_test_spokes.txt
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import ky from "ky";
|
|
2
|
+
import { encode_search_params, Response, Response_Multiple } from "./utils/utils.js";
|
|
3
|
+
|
|
4
|
+
{{#child_collections}}
|
|
5
|
+
import { Collection_{{built_collection}} } from "{{ built_collection_path }}"
|
|
6
|
+
{{/child_collections}}
|
|
7
|
+
|
|
8
|
+
{{types}}
|
|
9
|
+
|
|
10
|
+
export class Collection_{{my_built_collection}} {
|
|
11
|
+
path: string[]
|
|
12
|
+
get_auth: () => Promise<any>
|
|
13
|
+
|
|
14
|
+
constructor(path: string[], get_auth: () => Promise<any>) {
|
|
15
|
+
this.path = path;
|
|
16
|
+
this.get_auth = get_auth;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async query(query: {{type_query}}): Promise<{{type_return}}[]>{
|
|
21
|
+
try {
|
|
22
|
+
let result = await ky.get(this.path.join('/'), {
|
|
23
|
+
headers: {
|
|
24
|
+
authorization: await this.get_auth()
|
|
25
|
+
},
|
|
26
|
+
searchParams: encode_search_params(query)
|
|
27
|
+
}).json() as Response_Multiple<{{type_return}}>;
|
|
28
|
+
return result.data;
|
|
29
|
+
} catch(err){
|
|
30
|
+
return Promise.reject(err)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async post(document: {{type_post}}): Promise<{{type_return}}>{
|
|
35
|
+
try {
|
|
36
|
+
let result = await ky.post(this.path.join('/'), {
|
|
37
|
+
headers: {
|
|
38
|
+
authorization: await this.get_auth()
|
|
39
|
+
},
|
|
40
|
+
json: document
|
|
41
|
+
}).json() as Response<{{type_return}}>;
|
|
42
|
+
return result.data;
|
|
43
|
+
} catch(err){
|
|
44
|
+
return Promise.reject(err)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
document(document_id: string) {
|
|
49
|
+
let path = this.path;
|
|
50
|
+
let get_auth = this.get_auth;
|
|
51
|
+
return {
|
|
52
|
+
async get(): Promise<{{type_return}}>{
|
|
53
|
+
try {
|
|
54
|
+
let result = await ky.get([...path, document_id].join('/'), {
|
|
55
|
+
headers: {
|
|
56
|
+
authorization: await get_auth()
|
|
57
|
+
},
|
|
58
|
+
}).json() as Response<{{type_return}}>;
|
|
59
|
+
return result.data;
|
|
60
|
+
} catch(err){
|
|
61
|
+
return Promise.reject(err)
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
async put(update: {{type_put}}): Promise<{{type_return}}>{
|
|
66
|
+
try {
|
|
67
|
+
let result = await ky.put([...path, document_id].join('/'), {
|
|
68
|
+
headers: {
|
|
69
|
+
authorization: await get_auth()
|
|
70
|
+
},
|
|
71
|
+
json: update
|
|
72
|
+
}).json() as Response<{{type_return}}>;
|
|
73
|
+
return result.data;
|
|
74
|
+
} catch(err){
|
|
75
|
+
return Promise.reject(err)
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
async remove(): Promise<{{type_return}}>{
|
|
80
|
+
try {
|
|
81
|
+
let result = await ky.delete([...path, document_id].join('/'), {
|
|
82
|
+
headers: {
|
|
83
|
+
authorization: await get_auth()
|
|
84
|
+
},
|
|
85
|
+
}).json() as Response<{{type_return}}>;
|
|
86
|
+
return result.data;
|
|
87
|
+
} catch(err){
|
|
88
|
+
return Promise.reject(err)
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
{{#has_subcollections}}
|
|
93
|
+
collection(collection_id: {{child_collection_id_types}}) {
|
|
94
|
+
switch(collection_id) {
|
|
95
|
+
{{#child_collections}}
|
|
96
|
+
case "{{collection_id}}":
|
|
97
|
+
return new Collection_{{built_collection}}([...path, document_id, "{{collection_id}}"], get_auth);
|
|
98
|
+
{{/child_collections}}
|
|
99
|
+
default:
|
|
100
|
+
throw new Error(`Api does not have the collection ${collection_id}`)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
{{/has_subcollections}}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ky from 'ky';
|
|
2
|
+
|
|
3
|
+
{{types}}
|
|
4
|
+
{{#child_collections}}
|
|
5
|
+
import { Collection_{{built_collection}} } from "{{ built_collection_path }}"
|
|
6
|
+
{{/child_collections}}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export function api(base_url: string, get_auth: () => Promise<any>) {
|
|
10
|
+
return {
|
|
11
|
+
collection(collection_id: {{child_collection_id_types}}) {
|
|
12
|
+
switch(collection_id) {
|
|
13
|
+
{{#child_collections}}
|
|
14
|
+
case "{{collection_id}}":
|
|
15
|
+
return new Collection_{{built_collection}}([base_url, "{{collection_id}}"], get_auth);
|
|
16
|
+
{{/child_collections}}
|
|
17
|
+
default:
|
|
18
|
+
throw new Error(`Api does not have the collection ${collection_id}`)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|