@snowtop/ent 0.1.0-alpha → 0.1.0-alpha12

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 (86) hide show
  1. package/action/action.d.ts +2 -0
  2. package/action/executor.d.ts +1 -1
  3. package/action/orchestrator.d.ts +16 -3
  4. package/action/orchestrator.js +157 -47
  5. package/core/base.d.ts +6 -2
  6. package/core/base.js +16 -0
  7. package/core/clause.d.ts +24 -3
  8. package/core/clause.js +246 -5
  9. package/core/config.d.ts +18 -0
  10. package/core/config.js +17 -0
  11. package/core/db.d.ts +3 -3
  12. package/core/db.js +2 -0
  13. package/core/ent.d.ts +2 -4
  14. package/core/ent.js +72 -25
  15. package/core/loaders/assoc_edge_loader.d.ts +1 -1
  16. package/core/loaders/assoc_edge_loader.js +5 -4
  17. package/core/loaders/index_loader.js +1 -0
  18. package/core/loaders/object_loader.d.ts +7 -2
  19. package/core/loaders/object_loader.js +59 -4
  20. package/core/privacy.d.ts +1 -1
  21. package/core/privacy.js +3 -0
  22. package/core/viewer.d.ts +1 -0
  23. package/core/viewer.js +4 -0
  24. package/graphql/builtins/connection.js +3 -3
  25. package/graphql/builtins/edge.js +2 -2
  26. package/graphql/builtins/node.js +1 -1
  27. package/graphql/graphql.d.ts +3 -2
  28. package/graphql/graphql.js +24 -23
  29. package/graphql/index.d.ts +1 -0
  30. package/graphql/index.js +3 -1
  31. package/graphql/mutations/union.d.ts +2 -0
  32. package/graphql/mutations/union.js +35 -0
  33. package/graphql/node_resolver.d.ts +0 -1
  34. package/graphql/query/connection_type.js +6 -6
  35. package/graphql/query/page_info.js +4 -4
  36. package/graphql/query/shared_assoc_test.js +2 -2
  37. package/graphql/scalars/time.d.ts +1 -1
  38. package/imports/index.d.ts +0 -1
  39. package/imports/index.js +3 -36
  40. package/index.d.ts +16 -1
  41. package/index.js +18 -5
  42. package/package.json +3 -3
  43. package/parse_schema/parse.d.ts +23 -4
  44. package/parse_schema/parse.js +87 -8
  45. package/schema/base_schema.d.ts +36 -1
  46. package/schema/base_schema.js +63 -17
  47. package/schema/field.d.ts +25 -25
  48. package/schema/field.js +42 -33
  49. package/schema/index.d.ts +4 -2
  50. package/schema/index.js +10 -1
  51. package/schema/json_field.d.ts +6 -6
  52. package/schema/json_field.js +2 -2
  53. package/schema/schema.d.ts +70 -6
  54. package/schema/schema.js +142 -10
  55. package/schema/struct_field.d.ts +17 -0
  56. package/schema/struct_field.js +102 -0
  57. package/schema/union_field.d.ts +23 -0
  58. package/schema/union_field.js +79 -0
  59. package/scripts/custom_compiler.js +2 -19
  60. package/scripts/custom_graphql.js +122 -15
  61. package/scripts/move_generated.d.ts +1 -0
  62. package/scripts/move_generated.js +142 -0
  63. package/scripts/read_schema.js +15 -1
  64. package/scripts/transform_code.d.ts +1 -0
  65. package/scripts/transform_code.js +113 -0
  66. package/scripts/transform_schema.d.ts +1 -0
  67. package/scripts/transform_schema.js +355 -0
  68. package/testutils/builder.d.ts +16 -9
  69. package/testutils/builder.js +80 -8
  70. package/testutils/context/test_context.d.ts +2 -2
  71. package/testutils/context/test_context.js +7 -1
  72. package/testutils/db/test_db.d.ts +2 -1
  73. package/testutils/db/test_db.js +22 -13
  74. package/testutils/ent-graphql-tests/index.d.ts +2 -0
  75. package/testutils/ent-graphql-tests/index.js +26 -17
  76. package/testutils/fake_data/fake_contact.d.ts +3 -7
  77. package/testutils/fake_data/fake_contact.js +14 -26
  78. package/testutils/fake_data/fake_event.d.ts +3 -7
  79. package/testutils/fake_data/fake_event.js +20 -33
  80. package/testutils/fake_data/fake_user.d.ts +3 -7
  81. package/testutils/fake_data/fake_user.js +22 -36
  82. package/testutils/fake_data/test_helpers.js +1 -1
  83. package/tsc/ast.d.ts +21 -0
  84. package/tsc/ast.js +154 -0
  85. package/tsc/compilerOptions.d.ts +8 -0
  86. package/tsc/compilerOptions.js +100 -0
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const glob_1 = require("glob");
26
+ const typescript_1 = __importDefault(require("typescript"));
27
+ const compilerOptions_1 = require("../tsc/compilerOptions");
28
+ const ast_1 = require("../tsc/ast");
29
+ const child_process_1 = require("child_process");
30
+ const fs = __importStar(require("fs"));
31
+ async function main() {
32
+ let files = glob_1.glob.sync("src/ent/*.ts");
33
+ const target = (0, compilerOptions_1.getTargetFromCurrentDir)();
34
+ files.forEach((file) => {
35
+ let { contents, sourceFile } = (0, compilerOptions_1.createSourceFile)(target, file);
36
+ let traversed = false;
37
+ let nodes = [];
38
+ typescript_1.default.forEachChild(sourceFile, function (node) {
39
+ if (!typescript_1.default.isClassDeclaration(node) || !node.heritageClauses) {
40
+ nodes.push({ node });
41
+ return;
42
+ }
43
+ let classInfo = (0, ast_1.getClassInfo)(contents, sourceFile, node);
44
+ // only do classes which extend a base class e.g. User extends UserBase
45
+ if (!classInfo || classInfo.extends !== classInfo.name + "Base") {
46
+ return;
47
+ }
48
+ // need to check for PrivacyPolicy import...
49
+ traversed = true;
50
+ let klassContents = "";
51
+ for (const mm of node.members) {
52
+ if (isPrivacyPolicy(mm)) {
53
+ const property = mm;
54
+ // if invalid privacy policy, bounce
55
+ if (!property.initializer) {
56
+ traversed = false;
57
+ return;
58
+ }
59
+ const pp = property.initializer.getFullText(sourceFile);
60
+ const code = `getPrivacyPolicy(): PrivacyPolicy<this> {
61
+ return ${pp}
62
+ }`;
63
+ klassContents += code;
64
+ }
65
+ else {
66
+ klassContents += mm.getFullText(sourceFile);
67
+ }
68
+ }
69
+ // wrap comments and transform to export class Foo extends Bar { ${inner} }
70
+ nodes.push({ rawString: classInfo.wrapClassContents(klassContents) });
71
+ // console.debug(classInfo.wrapClassContents(klassContents));
72
+ });
73
+ // if traversed, overwrite.
74
+ if (!traversed) {
75
+ return;
76
+ }
77
+ let newContents = "";
78
+ for (const node of nodes) {
79
+ if (node.node) {
80
+ if (typescript_1.default.isImportDeclaration(node.node)) {
81
+ let transformed = (0, ast_1.transformImport)(contents, node.node, sourceFile, {
82
+ newImports: ["PrivacyPolicy"],
83
+ });
84
+ if (transformed) {
85
+ newContents += transformed;
86
+ continue;
87
+ }
88
+ }
89
+ newContents += node.node.getFullText(sourceFile);
90
+ }
91
+ else if (node.rawString) {
92
+ newContents += node.rawString;
93
+ }
94
+ else {
95
+ throw new Error(`malformed node with no node or rawString`);
96
+ }
97
+ fs.writeFileSync(file, newContents);
98
+ }
99
+ });
100
+ (0, child_process_1.execSync)("prettier src/ent/*.ts --write");
101
+ }
102
+ function isPrivacyPolicy(mm) {
103
+ return (mm.kind === typescript_1.default.SyntaxKind.PropertyDeclaration &&
104
+ mm.name.escapedText === "privacyPolicy");
105
+ }
106
+ main()
107
+ .then(() => {
108
+ process.exit(0);
109
+ })
110
+ .catch((err) => {
111
+ console.error(err);
112
+ process.exit(1);
113
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,355 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const glob_1 = require("glob");
26
+ const typescript_1 = __importDefault(require("typescript"));
27
+ const fs = __importStar(require("fs"));
28
+ const compilerOptions_1 = require("../tsc/compilerOptions");
29
+ const child_process_1 = require("child_process");
30
+ const path_1 = __importDefault(require("path"));
31
+ const ast_1 = require("../tsc/ast");
32
+ async function main() {
33
+ let files = glob_1.glob.sync("src/schema/*.ts");
34
+ const target = (0, compilerOptions_1.getTargetFromCurrentDir)();
35
+ // filter to only event.ts e.g. for comments and whitespace...
36
+ // files = files.filter((f) => f.endsWith("event.ts"));
37
+ files.forEach((file) => {
38
+ // assume valid file since we do glob above
39
+ // const idx = file.lastIndexOf(".ts");
40
+ // const writeFile = file.substring(0, idx) + "2" + ".ts";
41
+ // console.debug(file);
42
+ const writeFile = "src/schema/" + path_1.default.basename(file).slice(0, -3) + "_schema.ts";
43
+ // const writeFile = file;
44
+ // console.debug(file, writeFile);
45
+ // go through the file and print everything back if not starting immediately after other position
46
+ let { contents, sourceFile } = (0, compilerOptions_1.createSourceFile)(target, file);
47
+ const nodes = [];
48
+ let updateImport = false;
49
+ let removeImports = [];
50
+ const f = {
51
+ trackNode: function (tni) {
52
+ nodes.push({
53
+ node: tni.node,
54
+ importNode: tni.node && typescript_1.default.isImportDeclaration(tni.node),
55
+ rawString: tni.rawString,
56
+ });
57
+ if (tni.removeImports) {
58
+ removeImports.push(...tni.removeImports);
59
+ }
60
+ },
61
+ flagUpdateImport() {
62
+ updateImport = true;
63
+ },
64
+ };
65
+ if (!traverse(contents, sourceFile, f)) {
66
+ return;
67
+ }
68
+ let newContents = "";
69
+ for (const node of nodes) {
70
+ if (updateImport && node.importNode) {
71
+ const importNode = node.node;
72
+ const transformedImport = (0, ast_1.transformImport)(contents, importNode, sourceFile, {
73
+ removeImports,
74
+ transform: transformSchema,
75
+ });
76
+ if (transformedImport) {
77
+ newContents += transformedImport;
78
+ continue;
79
+ }
80
+ }
81
+ if (node.node) {
82
+ newContents += node.node.getFullText(sourceFile);
83
+ }
84
+ else if (node.rawString) {
85
+ newContents += node.rawString;
86
+ }
87
+ else {
88
+ console.error("invalid node");
89
+ }
90
+ }
91
+ // console.debug(newContents);
92
+ // ideally there's a flag that indicates if we write
93
+ fs.writeFileSync(writeFile, newContents);
94
+ fs.rmSync(file);
95
+ });
96
+ (0, child_process_1.execSync)("prettier src/schema/*.ts --write");
97
+ }
98
+ function traverse(fileContents, sourceFile, f) {
99
+ let traversed = false;
100
+ typescript_1.default.forEachChild(sourceFile, function (node) {
101
+ if (typescript_1.default.isClassDeclaration(node)) {
102
+ traversed = true;
103
+ // TODO address implicit schema doesn't work here...
104
+ // console.debug(sourceFile.fileName, node.kind);
105
+ if (traverseClass(fileContents, sourceFile, node, f)) {
106
+ f.flagUpdateImport();
107
+ return;
108
+ }
109
+ }
110
+ f.trackNode({ node });
111
+ });
112
+ return traversed;
113
+ }
114
+ function traverseClass(fileContents, sourceFile, node, f) {
115
+ const ci = getTransformClassInfo(fileContents, sourceFile, node);
116
+ if (!ci) {
117
+ return false;
118
+ }
119
+ let klassContents = `${ci.comment}const ${ci.name} = new ${ci.class}({\n`;
120
+ let removeImports = [];
121
+ if (ci.implementsSchema) {
122
+ removeImports.push("Schema");
123
+ }
124
+ for (let member of node.members) {
125
+ const fInfo = getClassElementInfo(fileContents, member, sourceFile);
126
+ if (!fInfo) {
127
+ return false;
128
+ }
129
+ klassContents += `${fInfo.comment}${fInfo.key}:${fInfo.value},\n`;
130
+ if (fInfo.type) {
131
+ removeImports.push(fInfo.type);
132
+ }
133
+ }
134
+ klassContents += "\n})";
135
+ if (ci.export && ci.default) {
136
+ klassContents += `\n export default ${ci.name};`;
137
+ }
138
+ else if (ci.export) {
139
+ klassContents = "export " + klassContents;
140
+ }
141
+ // console.debug(klassContents);
142
+ f.trackNode({ rawString: klassContents, removeImports: removeImports });
143
+ return true;
144
+ }
145
+ function transformSchema(str) {
146
+ // only do known class names
147
+ if (str === "BaseEntSchema" || str === "BaseEntSchemaWithTZ") {
148
+ return str.substring(4);
149
+ }
150
+ return str;
151
+ }
152
+ // TODO need to generify this...
153
+ // and then have a schema specific version
154
+ // may make sense to just duplicate this logic...
155
+ function getTransformClassInfo(fileContents, sourceFile, node) {
156
+ const generic = (0, ast_1.getClassInfo)(fileContents, sourceFile, node);
157
+ if (!generic) {
158
+ return;
159
+ }
160
+ let className = generic.name;
161
+ if (!className?.endsWith("Schema")) {
162
+ className += "Schema";
163
+ }
164
+ let implementsSchema = generic.implements?.some((v) => v == "Schema");
165
+ let classExtends = generic.extends;
166
+ if (classExtends && classExtends === transformSchema(classExtends)) {
167
+ return undefined;
168
+ }
169
+ if (!className || !node.heritageClauses || !classExtends) {
170
+ return undefined;
171
+ }
172
+ let ci = {
173
+ ...generic,
174
+ name: className,
175
+ class: classExtends,
176
+ implementsSchema,
177
+ };
178
+ return ci;
179
+ }
180
+ // intentionally doesn't parse decorators since we don't need it
181
+ function getClassElementInfo(fileContents, member, sourceFile) {
182
+ if (isFieldElement(member, sourceFile)) {
183
+ return getFieldElementInfo(fileContents, member, sourceFile);
184
+ }
185
+ if (member.kind === typescript_1.default.SyntaxKind.Constructor) {
186
+ return getConstructorElementInfo(fileContents, member, sourceFile);
187
+ }
188
+ if (member.kind !== typescript_1.default.SyntaxKind.PropertyDeclaration) {
189
+ return;
190
+ }
191
+ // other properties
192
+ const property = member;
193
+ if (!property.initializer) {
194
+ return;
195
+ }
196
+ const token = property.name;
197
+ return {
198
+ key: token.escapedText.toString(),
199
+ value: property.initializer?.getFullText(sourceFile),
200
+ comment: (0, ast_1.getPreText)(fileContents, member, sourceFile),
201
+ type: getType(property, sourceFile),
202
+ };
203
+ }
204
+ function getType(property, sourceFile) {
205
+ let propertytype = property.type?.getText(sourceFile) || "";
206
+ let ends = ["| null", "[]"];
207
+ for (const end of ends) {
208
+ if (propertytype.endsWith(end)) {
209
+ propertytype = propertytype.slice(0, -1 * end.length);
210
+ }
211
+ }
212
+ return propertytype;
213
+ }
214
+ function getFieldElementInfo(fileContents, member, sourceFile) {
215
+ let fieldMap = "";
216
+ // need to change to fields: {code: StringType()};
217
+ const property = member;
218
+ const initializer = property.initializer;
219
+ fieldMap += "{";
220
+ for (const element of initializer.elements) {
221
+ const parsed = parseFieldElement(element, sourceFile, fileContents);
222
+ if (parsed === null) {
223
+ return;
224
+ }
225
+ const { callEx, name, nameComment, properties } = parsed;
226
+ let property = "";
227
+ const fieldComment = (0, ast_1.getPreText)(fileContents, element, sourceFile).trim();
228
+ if (fieldComment) {
229
+ property += "\n" + fieldComment + "\n";
230
+ }
231
+ if (nameComment) {
232
+ property += nameComment + "\n";
233
+ }
234
+ // e.g. UUIDType, StringType etc
235
+ let call = callEx.expression.getText(sourceFile);
236
+ let fnCall = "";
237
+ if (properties.length) {
238
+ fnCall = `{${properties.join(",")}}`;
239
+ }
240
+ property += `${name}:${call}(${fnCall}),`;
241
+ fieldMap += property;
242
+ }
243
+ fieldMap += "}";
244
+ return {
245
+ key: "fields",
246
+ value: fieldMap,
247
+ comment: (0, ast_1.getPreText)(fileContents, member, sourceFile),
248
+ type: getType(property, sourceFile),
249
+ };
250
+ }
251
+ function getConstructorElementInfo(fileContents, member, sourceFile) {
252
+ const c = member;
253
+ //remove {}
254
+ let fullText = c.body?.getFullText(sourceFile) || "";
255
+ fullText = fullText.trim().slice(1, -1).trim();
256
+ // convert something like
257
+ /*
258
+ constructor() {
259
+ super();
260
+ this.addPatterns(
261
+ new Feedback(),
262
+ new DayOfWeek(),
263
+ new Feedback(),
264
+ new DayOfWeek(),
265
+ );
266
+ }
267
+ */
268
+ // into this.addPatterns(new Feedback(),new DayOfWeek(),new Feedback(),new DayOfWeek(),)
269
+ const lines = fullText
270
+ .split("\n")
271
+ .map((line) => line.trim())
272
+ .join("")
273
+ .split(";")
274
+ .filter((f) => f != "super()" && f != "");
275
+ // at this point there should be only line for what we handle
276
+ if (lines.length != 1) {
277
+ return;
278
+ }
279
+ const line = lines[0];
280
+ const addPatterns = "this.addPatterns(";
281
+ if (!line.startsWith(addPatterns)) {
282
+ return;
283
+ }
284
+ return {
285
+ key: "patterns",
286
+ // remove this.addPatterns at the front, remove trailing ) at the end
287
+ // if there's a trailing comma, it'll be handled by prettier
288
+ value: `[${line.slice(addPatterns.length, -1)}]`,
289
+ comment: "",
290
+ };
291
+ }
292
+ function isFieldElement(member, sourceFile) {
293
+ if (member.kind !== typescript_1.default.SyntaxKind.PropertyDeclaration) {
294
+ return false;
295
+ }
296
+ const property = member;
297
+ const token = property.name;
298
+ if (token.escapedText !== "fields") {
299
+ return false;
300
+ }
301
+ const propertytype = property.type?.getText(sourceFile);
302
+ if (propertytype !== "Field[]") {
303
+ return false;
304
+ }
305
+ if (property.initializer?.kind !== typescript_1.default.SyntaxKind.ArrayLiteralExpression) {
306
+ console.error("invalid array type");
307
+ return false;
308
+ }
309
+ return true;
310
+ }
311
+ function parseFieldElement(element, sourceFile, fileContents) {
312
+ if (element.kind !== typescript_1.default.SyntaxKind.CallExpression) {
313
+ console.error("skipped non-call expression");
314
+ return null;
315
+ }
316
+ let callEx = element;
317
+ if (callEx.arguments.length !== 1) {
318
+ console.error("callExpression with arguments not of length 1");
319
+ return null;
320
+ }
321
+ let arg = callEx.arguments[0];
322
+ if (arg.kind !== typescript_1.default.SyntaxKind.ObjectLiteralExpression) {
323
+ console.error("not objectLiteralExpression");
324
+ return null;
325
+ }
326
+ let expr = arg;
327
+ let name = "";
328
+ let propertyComment;
329
+ let properties = [];
330
+ for (const p of expr.properties) {
331
+ const p2 = p;
332
+ // found name property
333
+ if (p2.name.escapedText === "name") {
334
+ name = p2.initializer.getText(sourceFile);
335
+ // check for any comment associated with name: "fooo"
336
+ propertyComment = (0, ast_1.getPreText)(fileContents, p, sourceFile).trim();
337
+ }
338
+ else {
339
+ properties.push(p.getFullText(sourceFile));
340
+ }
341
+ }
342
+ if (!name) {
343
+ console.error(`couldn't find name property`);
344
+ return null;
345
+ }
346
+ // remove quotes
347
+ name = name.slice(1, -1);
348
+ return {
349
+ callEx,
350
+ name,
351
+ properties,
352
+ nameComment: propertyComment,
353
+ };
354
+ }
355
+ Promise.resolve(main());
@@ -1,14 +1,16 @@
1
- import { Ent, ID, Viewer, Data, EntConstructor } from "../core/base";
1
+ import { Ent, ID, Viewer, Data, EntConstructor, PrivacyPolicy } from "../core/base";
2
2
  import { Orchestrator } from "../action/orchestrator";
3
3
  import { Action, Builder, Changeset, WriteOperation, Validator, Trigger, Observer } from "../action";
4
- import { Schema } from "../schema";
4
+ import { FieldMap, Schema } from "../schema";
5
+ import { SchemaConfig } from "../schema/base_schema";
6
+ import { FieldInfoMap } from "../schema/schema";
5
7
  export declare class User implements Ent {
6
8
  viewer: Viewer;
7
9
  data: Data;
8
10
  id: ID;
9
11
  accountID: string;
10
12
  nodeType: string;
11
- privacyPolicy: import("../core/base").PrivacyPolicy<Ent>;
13
+ getPrivacyPolicy(): PrivacyPolicy<this>;
12
14
  firstName: string;
13
15
  constructor(viewer: Viewer, data: Data);
14
16
  }
@@ -18,7 +20,7 @@ export declare class Event implements Ent {
18
20
  id: ID;
19
21
  accountID: string;
20
22
  nodeType: string;
21
- privacyPolicy: import("../core/base").PrivacyPolicy<Ent>;
23
+ getPrivacyPolicy(): PrivacyPolicy<this>;
22
24
  constructor(viewer: Viewer, data: Data);
23
25
  }
24
26
  export declare class Contact implements Ent {
@@ -27,7 +29,7 @@ export declare class Contact implements Ent {
27
29
  id: ID;
28
30
  accountID: string;
29
31
  nodeType: string;
30
- privacyPolicy: import("../core/base").PrivacyPolicy<Ent>;
32
+ getPrivacyPolicy(): PrivacyPolicy<this>;
31
33
  constructor(viewer: Viewer, data: Data);
32
34
  }
33
35
  export declare class Group implements Ent {
@@ -36,7 +38,7 @@ export declare class Group implements Ent {
36
38
  id: ID;
37
39
  accountID: string;
38
40
  nodeType: string;
39
- privacyPolicy: import("../core/base").PrivacyPolicy<Ent>;
41
+ getPrivacyPolicy(): PrivacyPolicy<this>;
40
42
  constructor(viewer: Viewer, data: Data);
41
43
  }
42
44
  export declare class Message implements Ent {
@@ -45,7 +47,7 @@ export declare class Message implements Ent {
45
47
  id: ID;
46
48
  accountID: string;
47
49
  nodeType: string;
48
- privacyPolicy: import("../core/base").PrivacyPolicy<Ent>;
50
+ getPrivacyPolicy(): PrivacyPolicy<this>;
49
51
  constructor(viewer: Viewer, data: Data);
50
52
  }
51
53
  export declare class Address implements Ent {
@@ -54,14 +56,18 @@ export declare class Address implements Ent {
54
56
  id: ID;
55
57
  accountID: string;
56
58
  nodeType: string;
57
- privacyPolicy: import("../core/base").PrivacyPolicy<Ent>;
59
+ getPrivacyPolicy(): PrivacyPolicy<this>;
58
60
  constructor(viewer: Viewer, data: Data);
59
61
  }
60
62
  export interface BuilderSchema<T extends Ent> extends Schema {
61
63
  ent: EntConstructor<T>;
62
64
  }
65
+ export declare function getBuilderSchema<T extends Ent>(cfg: SchemaConfig, ent: EntConstructor<T>): BuilderSchema<T>;
66
+ export declare function getBuilderSchemaFromFields<T extends Ent>(fields: FieldMap, ent: EntConstructor<T>): BuilderSchema<T>;
67
+ export declare function getBuilderSchemaTZFromFields<T extends Ent>(fields: FieldMap, ent: EntConstructor<T>): BuilderSchema<T>;
63
68
  export declare function getSchemaName(value: BuilderSchema<Ent>): string;
64
69
  export declare function getTableName(value: BuilderSchema<Ent>): string;
70
+ export declare function getFieldInfo(value: BuilderSchema<Ent>): FieldInfoMap;
65
71
  export declare class SimpleBuilder<T extends Ent> implements Builder<T> {
66
72
  viewer: Viewer;
67
73
  private schema;
@@ -73,6 +79,7 @@ export declare class SimpleBuilder<T extends Ent> implements Builder<T> {
73
79
  fields: Map<string, any>;
74
80
  nodeType: string;
75
81
  constructor(viewer: Viewer, schema: BuilderSchema<T>, fields: Map<string, any>, operation?: WriteOperation, existingEnt?: T | undefined, action?: Action<T, SimpleBuilder<T>, Data> | undefined);
82
+ updateInput(input: Data): void;
76
83
  build(): Promise<Changeset<T>>;
77
84
  editedEnt(): Promise<T | null>;
78
85
  editedEntX(): Promise<T>;
@@ -93,7 +100,7 @@ export declare class SimpleAction<T extends Ent> implements Action<T, SimpleBuil
93
100
  observers: Observer<SimpleBuilder<T>, Data>[];
94
101
  viewerForEntLoad: viewerEntLoadFunc | undefined;
95
102
  constructor(viewer: Viewer, schema: BuilderSchema<T>, fields: Map<string, any>, operation?: WriteOperation, existingEnt?: T | undefined);
96
- getPrivacyPolicy(): import("../core/base").PrivacyPolicy<Ent>;
103
+ getPrivacyPolicy(): PrivacyPolicy<Ent>;
97
104
  getInput(): Data;
98
105
  changeset(): Promise<Changeset<T>>;
99
106
  valid(): Promise<boolean>;