shapedef 1.0.1 → 1.0.2
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/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/shape-collection.d.ts +3 -0
- package/dist/cjs/shape-collection.d.ts.map +1 -0
- package/dist/cjs/shape-collection.js +3 -0
- package/dist/cjs/shape-collection.js.map +1 -0
- package/dist/cjs/translations/translation.d.ts +2 -0
- package/dist/cjs/translations/translation.d.ts.map +1 -1
- package/dist/cjs/translations/typescript.d.ts +4 -0
- package/dist/cjs/translations/typescript.d.ts.map +1 -1
- package/dist/cjs/translations/typescript.js +13 -1
- package/dist/cjs/translations/typescript.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/shape-collection.d.ts +3 -0
- package/dist/esm/shape-collection.d.ts.map +1 -0
- package/dist/esm/shape-collection.js +3 -0
- package/dist/esm/shape-collection.js.map +1 -0
- package/dist/esm/translations/translation.d.ts +2 -0
- package/dist/esm/translations/translation.d.ts.map +1 -1
- package/dist/esm/translations/typescript.d.ts +4 -0
- package/dist/esm/translations/typescript.d.ts.map +1 -1
- package/dist/esm/translations/typescript.js +13 -1
- package/dist/esm/translations/typescript.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/samples/bank.sample.ts +1 -0
- package/src/shape-collection.ts +3 -0
- package/src/translations/postgres.ts +5 -0
- package/src/translations/translation.ts +4 -0
- package/src/translations/typescript.ts +26 -1
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./shape"), exports);
|
|
18
|
+
__exportStar(require("./shape-collection"), exports);
|
|
18
19
|
__exportStar(require("./shape-utils"), exports);
|
|
19
20
|
__exportStar(require("./inputs"), exports);
|
|
20
21
|
__exportStar(require("./translations"), exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,gDAA8B;AAC9B,2CAAyB;AACzB,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,qDAAmC;AACnC,gDAA8B;AAC9B,2CAAyB;AACzB,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-collection.d.ts","sourceRoot":"","sources":["../../src/shape-collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-collection.js","sourceRoot":"","sources":["../../src/shape-collection.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Shape } from "../shape";
|
|
2
|
+
import { ShapeCollection } from "../shape-collection";
|
|
2
3
|
export type TranslationFunc<T extends any = any> = (shape: Shape) => T;
|
|
4
|
+
export type CollectionTranslateFunc<T extends any = any> = (collection: ShapeCollection) => T;
|
|
3
5
|
//# sourceMappingURL=translation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../src/translations/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../src/translations/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,CAAC;AACvE,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CACzD,UAAU,EAAE,eAAe,KACxB,CAAC,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { ShapeCollection } from "../shape-collection";
|
|
1
2
|
import { TranslationFunc } from "./translation";
|
|
2
3
|
export declare const typescript: TranslationFunc<string>;
|
|
4
|
+
export declare const typescriptCollection: (collection: ShapeCollection, options?: {
|
|
5
|
+
summaryName?: string;
|
|
6
|
+
}) => string;
|
|
3
7
|
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/translations/typescript.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAyIhD,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,MAAM,CAE9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/translations/typescript.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAyIhD,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,MAAM,CAE9C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,YAAY,eAAe,EAC3B,UAAS;IACP,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,WAkBP,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typescript = void 0;
|
|
3
|
+
exports.typescriptCollection = exports.typescript = void 0;
|
|
4
4
|
const padding_1 = require("../common/padding");
|
|
5
|
+
const shape_1 = require("../shape");
|
|
5
6
|
const incDepth = (ctx) => ({ ...ctx, depth: ctx.depth + 1 });
|
|
6
7
|
const maybeTypeAlias = (shape, ctx, out) => {
|
|
7
8
|
if (ctx.depth > 0)
|
|
@@ -119,4 +120,15 @@ const typescript = (shape) => {
|
|
|
119
120
|
return ts(shape, { padding: 0, depth: 0 });
|
|
120
121
|
};
|
|
121
122
|
exports.typescript = typescript;
|
|
123
|
+
const typescriptCollection = (collection, options = {}) => {
|
|
124
|
+
const { summaryName = "Schema" } = options;
|
|
125
|
+
const items = Array.from(collection.values());
|
|
126
|
+
const rec = shape_1.shapes.mapping(Object.fromEntries(items.map((s) => [s.anno.name || "?", shape_1.shapes.ref(s.anno.name || "?")])));
|
|
127
|
+
const tsContent = [
|
|
128
|
+
items.map((s) => (0, exports.typescript)(s)).join("\n"),
|
|
129
|
+
`export type ${summaryName} = ${(0, exports.typescript)(rec)};`,
|
|
130
|
+
].join("\n");
|
|
131
|
+
return tsContent;
|
|
132
|
+
};
|
|
133
|
+
exports.typescriptCollection = typescriptCollection;
|
|
122
134
|
//# sourceMappingURL=typescript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/translations/typescript.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/translations/typescript.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,oCAAyC;AASzC,MAAM,QAAQ,GAAG,CAAC,GAAY,EAAW,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;AAE/E,MAAM,cAAc,GAAG,CAAC,KAAY,EAAE,GAAY,EAAE,GAAW,EAAU,EAAE;IACzE,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;IACjD,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,eAAe,IAAI,MAAM,GAAG,EAAE,CAAC;IACvE,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAI,GAAQ,EAAE,SAAiB,EAAc,EAAE;IAC/D,MAAM,OAAO,GAAe,EAAE,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,OAAO,CA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AK,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEK,MAAM,oBAAoB,GAAG,CAClC,UAA2B,EAC3B,UAEI,EAAE,EACN,EAAE;IACF,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE3C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAE9C,MAAM,GAAG,GAAG,cAAM,CAAC,OAAO,CACxB,MAAM,CAAC,WAAW,CAChB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAE,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CACvE,CACF,CAAC;IAEF,MAAM,SAAS,GAAG;QAChB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1C,eAAe,WAAW,MAAM,IAAA,kBAAU,EAAC,GAAG,CAAC,GAAG;KACnD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAtBW,QAAA,oBAAoB,wBAsB/B"}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./shape"), exports);
|
|
18
|
+
__exportStar(require("./shape-collection"), exports);
|
|
18
19
|
__exportStar(require("./shape-utils"), exports);
|
|
19
20
|
__exportStar(require("./inputs"), exports);
|
|
20
21
|
__exportStar(require("./translations"), exports);
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,gDAA8B;AAC9B,2CAAyB;AACzB,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,qDAAmC;AACnC,gDAA8B;AAC9B,2CAAyB;AACzB,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-collection.d.ts","sourceRoot":"","sources":["../../src/shape-collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-collection.js","sourceRoot":"","sources":["../../src/shape-collection.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Shape } from "../shape";
|
|
2
|
+
import { ShapeCollection } from "../shape-collection";
|
|
2
3
|
export type TranslationFunc<T extends any = any> = (shape: Shape) => T;
|
|
4
|
+
export type CollectionTranslateFunc<T extends any = any> = (collection: ShapeCollection) => T;
|
|
3
5
|
//# sourceMappingURL=translation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../src/translations/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../src/translations/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,CAAC;AACvE,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CACzD,UAAU,EAAE,eAAe,KACxB,CAAC,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { ShapeCollection } from "../shape-collection";
|
|
1
2
|
import { TranslationFunc } from "./translation";
|
|
2
3
|
export declare const typescript: TranslationFunc<string>;
|
|
4
|
+
export declare const typescriptCollection: (collection: ShapeCollection, options?: {
|
|
5
|
+
summaryName?: string;
|
|
6
|
+
}) => string;
|
|
3
7
|
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/translations/typescript.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAyIhD,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,MAAM,CAE9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/translations/typescript.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAyIhD,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,MAAM,CAE9C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,YAAY,eAAe,EAC3B,UAAS;IACP,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,WAkBP,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typescript = void 0;
|
|
3
|
+
exports.typescriptCollection = exports.typescript = void 0;
|
|
4
4
|
const padding_1 = require("../common/padding");
|
|
5
|
+
const shape_1 = require("../shape");
|
|
5
6
|
const incDepth = (ctx) => ({ ...ctx, depth: ctx.depth + 1 });
|
|
6
7
|
const maybeTypeAlias = (shape, ctx, out) => {
|
|
7
8
|
if (ctx.depth > 0)
|
|
@@ -119,4 +120,15 @@ const typescript = (shape) => {
|
|
|
119
120
|
return ts(shape, { padding: 0, depth: 0 });
|
|
120
121
|
};
|
|
121
122
|
exports.typescript = typescript;
|
|
123
|
+
const typescriptCollection = (collection, options = {}) => {
|
|
124
|
+
const { summaryName = "Schema" } = options;
|
|
125
|
+
const items = Array.from(collection.values());
|
|
126
|
+
const rec = shape_1.shapes.mapping(Object.fromEntries(items.map((s) => [s.anno.name || "?", shape_1.shapes.ref(s.anno.name || "?")])));
|
|
127
|
+
const tsContent = [
|
|
128
|
+
items.map((s) => (0, exports.typescript)(s)).join("\n"),
|
|
129
|
+
`export type ${summaryName} = ${(0, exports.typescript)(rec)};`,
|
|
130
|
+
].join("\n");
|
|
131
|
+
return tsContent;
|
|
132
|
+
};
|
|
133
|
+
exports.typescriptCollection = typescriptCollection;
|
|
122
134
|
//# sourceMappingURL=typescript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/translations/typescript.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/translations/typescript.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,oCAAyC;AASzC,MAAM,QAAQ,GAAG,CAAC,GAAY,EAAW,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;AAE/E,MAAM,cAAc,GAAG,CAAC,KAAY,EAAE,GAAY,EAAE,GAAW,EAAU,EAAE;IACzE,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;IACjD,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,eAAe,IAAI,MAAM,GAAG,EAAE,CAAC;IACvE,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAI,GAAQ,EAAE,SAAiB,EAAc,EAAE;IAC/D,MAAM,OAAO,GAAe,EAAE,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAY,EAAY,EAAE;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,WAAW,GAAG,C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BAAoB,GAAG,CAClC,UAA2B,EAC3B,UAEI,EAAE,EACN,EAAE;IACF,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE3C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAE9C,MAAM,GAAG,GAAG,cAAM,CAAC,OAAO,CACxB,MAAM,CAAC,WAAW,CAChB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAE,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CACvE,CACF,CAAC;IAEF,MAAM,SAAS,GAAG;QAChB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1C,eAAe,WAAW,MAAM,IAAA,kBAAU,EAAC,GAAG,CAAC,GAAG;KACnD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAtBW,QAAA,oBAAoB,wBAsB/B"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export const BankAccount = annotate.named(
|
|
|
15
15
|
shapes.mapping({
|
|
16
16
|
id: annotate.unique(annotate.primary(shapes.str())),
|
|
17
17
|
userId: annotate.foreign(shapes.str(), "User", "id"),
|
|
18
|
+
timestamp: annotate.by(shapes.date(), { defaultValue: "NOW()" }),
|
|
18
19
|
name: shapes.str(),
|
|
19
20
|
balance: shapes.mapping({
|
|
20
21
|
value: shapes.float(),
|
|
@@ -54,6 +54,11 @@ const pgColumnDef = (colName: string, shape: Shape): string => {
|
|
|
54
54
|
if (shape.anno.unique && !shape.anno.primary) {
|
|
55
55
|
parts.push("UNIQUE");
|
|
56
56
|
}
|
|
57
|
+
if (shape.anno.defaultValue) {
|
|
58
|
+
if (typeof shape.anno.defaultValue === "string") {
|
|
59
|
+
parts.push(`DEFAULT ${shape.anno.defaultValue}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
57
62
|
if (shape.anno.foreign) {
|
|
58
63
|
parts.push(
|
|
59
64
|
`REFERENCES ${shape.anno.foreign.shapeName}(${shape.anno.foreign.fieldName})`,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { Shape } from "../shape";
|
|
2
|
+
import { ShapeCollection } from "../shape-collection";
|
|
2
3
|
|
|
3
4
|
export type TranslationFunc<T extends any = any> = (shape: Shape) => T;
|
|
5
|
+
export type CollectionTranslateFunc<T extends any = any> = (
|
|
6
|
+
collection: ShapeCollection,
|
|
7
|
+
) => T;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mkpad } from "../common/padding";
|
|
2
|
-
import { Shape } from "../shape";
|
|
2
|
+
import { Shape, shapes } from "../shape";
|
|
3
|
+
import { ShapeCollection } from "../shape-collection";
|
|
3
4
|
import { TranslationFunc } from "./translation";
|
|
4
5
|
|
|
5
6
|
type Context = {
|
|
@@ -140,3 +141,27 @@ const ts = (shape: Shape, ctx: Context): string => {
|
|
|
140
141
|
export const typescript: TranslationFunc<string> = (shape) => {
|
|
141
142
|
return ts(shape, { padding: 0, depth: 0 });
|
|
142
143
|
};
|
|
144
|
+
|
|
145
|
+
export const typescriptCollection = (
|
|
146
|
+
collection: ShapeCollection,
|
|
147
|
+
options: {
|
|
148
|
+
summaryName?: string;
|
|
149
|
+
} = {},
|
|
150
|
+
) => {
|
|
151
|
+
const { summaryName = "Schema" } = options;
|
|
152
|
+
|
|
153
|
+
const items = Array.from(collection.values());
|
|
154
|
+
|
|
155
|
+
const rec = shapes.mapping(
|
|
156
|
+
Object.fromEntries(
|
|
157
|
+
items.map((s) => [s.anno.name || "?", shapes.ref(s.anno.name || "?")]),
|
|
158
|
+
),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
const tsContent = [
|
|
162
|
+
items.map((s) => typescript(s)).join("\n"),
|
|
163
|
+
`export type ${summaryName} = ${typescript(rec)};`,
|
|
164
|
+
].join("\n");
|
|
165
|
+
|
|
166
|
+
return tsContent;
|
|
167
|
+
};
|