prostgles-server 4.2.382 → 4.2.383
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/DBSchemaBuilder/getFunctionsTypescriptSchema.d.ts.map +1 -1
- package/dist/DBSchemaBuilder/getFunctionsTypescriptSchema.js +2 -2
- package/dist/DBSchemaBuilder/getFunctionsTypescriptSchema.js.map +1 -1
- package/lib/DBSchemaBuilder/getFunctionsTypescriptSchema.ts +3 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFunctionsTypescriptSchema.d.ts","sourceRoot":"","sources":["../../lib/DBSchemaBuilder/getFunctionsTypescriptSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,eAAO,MAAM,4BAA4B,kBACxB,WAAW,EAAE,qBACT,OACjB,MAAM,EACN;IACE,KAAK,CAAC,EAAE,OAAO,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CACF,
|
|
1
|
+
{"version":3,"file":"getFunctionsTypescriptSchema.d.ts","sourceRoot":"","sources":["../../lib/DBSchemaBuilder/getFunctionsTypescriptSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,eAAO,MAAM,4BAA4B,kBACxB,WAAW,EAAE,qBACT,OACjB,MAAM,EACN;IACE,KAAK,CAAC,EAAE,OAAO,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CACF,uBAkBF,CAAC"}
|
|
@@ -6,10 +6,10 @@ const getFunctionsTypescriptSchema = (tablesOrViews, resolvedFunctions) => {
|
|
|
6
6
|
const methodDefinitions = (0, prostgles_types_1.getObjectEntries)(resolvedFunctions).map(([name, functionDefinition]) => {
|
|
7
7
|
const { output } = functionDefinition;
|
|
8
8
|
const input = functionDefinition.input;
|
|
9
|
-
const argumentTypes = !input ? "
|
|
9
|
+
const argumentTypes = !input ? "" : `args: ${(0, prostgles_types_1.getJSONBTSTypes)(tablesOrViews, { type: input })}`;
|
|
10
10
|
const removeSemicolon = (v) => v.trim().endsWith(";") ? v.trim().slice(0, -1) : v.trim();
|
|
11
11
|
const returnType = !output ? "void" : (0, prostgles_types_1.getJSONBTSTypes)(tablesOrViews, output);
|
|
12
|
-
return ` ${JSON.stringify(name)}: (
|
|
12
|
+
return ` ${JSON.stringify(name)}: (${removeSemicolon(argumentTypes)}) => Promise<${removeSemicolon(returnType)}>`;
|
|
13
13
|
});
|
|
14
14
|
if (methodDefinitions.length) {
|
|
15
15
|
return ["\n", `export type GeneratedFunctionSchema = { `, ...methodDefinitions, `}`].join("\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFunctionsTypescriptSchema.js","sourceRoot":"","sources":["../../lib/DBSchemaBuilder/getFunctionsTypescriptSchema.ts"],"names":[],"mappings":";;;AAAA,qDAAgF;AAGzE,MAAM,4BAA4B,GAAG,CAC1C,aAA4B,EAC5B,iBAOC,EACD,EAAE;IACF,MAAM,iBAAiB,GAAG,IAAA,kCAAgB,EAAC,iBAAiB,CAAC,CAAC,GAAG,CAC/D,CAAC,CAAC,IAAI,EAAE,kBAAkB,CAAC,EAAE,EAAE;QAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAAC;QACtC,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC;QACvC,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"getFunctionsTypesc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AAI,CAAC,CAAC;IAClG,CAAC;AACH,CAAC,CAAC;AA3BW,QAAA,4BAA4B,gCA2BvC"}
|
|
@@ -16,12 +16,13 @@ export const getFunctionsTypescriptSchema = (
|
|
|
16
16
|
([name, functionDefinition]) => {
|
|
17
17
|
const { output } = functionDefinition;
|
|
18
18
|
const input = functionDefinition.input;
|
|
19
|
-
const argumentTypes =
|
|
19
|
+
const argumentTypes =
|
|
20
|
+
!input ? "" : `args: ${getJSONBTSTypes(tablesOrViews, { type: input })}`;
|
|
20
21
|
|
|
21
22
|
const removeSemicolon = (v: string) =>
|
|
22
23
|
v.trim().endsWith(";") ? v.trim().slice(0, -1) : v.trim();
|
|
23
24
|
const returnType = !output ? "void" : getJSONBTSTypes(tablesOrViews, output);
|
|
24
|
-
return ` ${JSON.stringify(name)}: (
|
|
25
|
+
return ` ${JSON.stringify(name)}: (${removeSemicolon(argumentTypes)}) => Promise<${removeSemicolon(returnType)}>`;
|
|
25
26
|
}
|
|
26
27
|
);
|
|
27
28
|
if (methodDefinitions.length) {
|