@opengis/fastify-table 2.0.115 → 2.0.116

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AA2FA,iBAAS,MAAM,CAAC,OAAO,EAAE,GAAG,QAyJ3B;;AACD,wBAA0B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AA2FA,iBAAS,MAAM,CAAC,OAAO,EAAE,GAAG,QA4K3B;;AACD,wBAA0B"}
package/dist/index.js CHANGED
@@ -68,9 +68,16 @@ function plugin(fastify) {
68
68
  });
69
69
  }
70
70
  if (!fastify.hasRoute({ method: "GET", url: "/api/list" })) {
71
- fastify.get(`${opt.prefix}/list`, { config: { role: "admin" } }, () => ({
72
- rows: routes,
73
- }));
71
+ fastify.get(`${opt.prefix}/list`, { config: { role: "admin" } }, ({ query }) => {
72
+ const { package: packageName, subdir } = query;
73
+ if (packageName) {
74
+ return { rows: routes.filter((r) => r.package === packageName) };
75
+ }
76
+ if (subdir) {
77
+ return { rows: routes.filter((r) => r.subdir === subdir) };
78
+ }
79
+ return { rows: routes };
80
+ });
74
81
  }
75
82
  fastify.addHook("onRoute", (r) => {
76
83
  if (r.method === "HEAD")
@@ -82,9 +89,13 @@ function plugin(fastify) {
82
89
  [curr]: r.schema?.querystring?.properties?.[curr]?.type,
83
90
  }), {})
84
91
  : undefined;
92
+ r.config = r.config || {};
93
+ r.config.package = r.config.package || "fastify-table";
85
94
  routes.push({
86
95
  method,
87
96
  route: r.url,
97
+ subdir: r.config?.subdir,
98
+ package: r.config?.package,
88
99
  description: r.config?.description,
89
100
  query,
90
101
  roles: r.config?.role?.split?.("|"),
@@ -11,7 +11,7 @@ CREATE TABLE if not exists {{nspname}}.{{relname}}
11
11
  {{column_name}} {{data_type}} {{#unless is_nullable}}NOT NULL{{/unless}}{{#if column_default}}DEFAULT {{column_default}}{{/if}}{{#ifCond @index '!=' (_math ../columns.length '-' 1)}},{{/ifCond}} -- {{{coalesce description '-'}}}
12
12
  {{/each}}{{#if constraints.length}},{{/if}}
13
13
  {{#each constraints}}
14
- CONSTRAINT {{constraint_name}} {{#ifCond constraint_type '==' 'c'}} {{check_definition}} {{/ifCond}} {{#ifCond constraint_type '==' 'f'}}FOREIGN KEY ({{foreign_column}}) REFERENCES {{foreign_table}} ({{foreign_column}}) MATCH {{select confmatchtype data="constraint_matchtype"}} ON UPDATE {{select confupdtype data="constraint_action"}} ON DELETE {{select confdeltype data="constraint_action"}}{{^}}{{select constraint_type data="constraint_type_full"}} ({{column_name}}){{/ifCond}}{{#ifCond @index '!=' (_math ../constraints.length '-' 1)}},{{/ifCond}}
14
+ CONSTRAINT {{constraint_name}} {{#ifCond constraint_type '==' 'c'}} {{check_definition}} {{/ifCond}} {{#ifCond constraint_type '==' 'f'}}FOREIGN KEY ({{foreign_column}}) REFERENCES {{foreign_table}} ({{foreign_column}}) MATCH {{select confmatchtype data="constraint_matchtype"}} ON UPDATE {{select confupdtype data="constraint_action"}} ON DELETE {{select confdeltype data="constraint_action"}}{{^}}{{#ifCond constraint_type '!=' 'c'}}{{select constraint_type data="constraint_type_full"}} ({{column_name}}){{/ifCond}}{{/ifCond}}{{#ifCond @index '!=' (_math ../constraints.length '-' 1)}},{{/ifCond}}
15
15
  {{/each}}
16
16
  );
17
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.0.115",
3
+ "version": "2.0.116",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [