@snowtop/ent 0.1.0-alpha124 → 0.1.0-alpha126

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,7 +0,0 @@
1
- import { Field, GlobalSchema } from "../schema/schema";
2
- export declare function setGlobalSchema(val: GlobalSchema): void;
3
- export declare function clearGlobalSchema(): void;
4
- export declare function __hasGlobalSchema(): boolean;
5
- export declare function __getGlobalSchema(): GlobalSchema | undefined;
6
- export declare function __getGlobalSchemaFields(): Map<string, Field>;
7
- export declare function __getGlobalSchemaField(type: string): Field | undefined;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.__getGlobalSchemaField = exports.__getGlobalSchemaFields = exports.__getGlobalSchema = exports.__hasGlobalSchema = exports.clearGlobalSchema = exports.setGlobalSchema = void 0;
4
- const schema_1 = require("../schema/schema");
5
- let globalSchema;
6
- let globalSchemaFields = new Map();
7
- function isGlobalSchemaField(f) {
8
- switch (f.type.dbType) {
9
- case schema_1.DBType.Enum:
10
- case schema_1.DBType.StringEnum:
11
- case schema_1.DBType.IntEnum:
12
- case schema_1.DBType.JSON:
13
- case schema_1.DBType.JSONB:
14
- return true;
15
- }
16
- return false;
17
- }
18
- function setGlobalSchema(val) {
19
- globalSchema = val;
20
- if (val.fields) {
21
- for (const [k, v] of Object.entries(val.fields)) {
22
- if (isGlobalSchemaField(v) && v.type.type) {
23
- globalSchemaFields.set(v.type.type, v);
24
- }
25
- }
26
- }
27
- }
28
- exports.setGlobalSchema = setGlobalSchema;
29
- function clearGlobalSchema() {
30
- globalSchema = undefined;
31
- globalSchemaFields.clear();
32
- }
33
- exports.clearGlobalSchema = clearGlobalSchema;
34
- // used by tests. no guarantee will always exist
35
- function __hasGlobalSchema() {
36
- return globalSchema !== undefined;
37
- }
38
- exports.__hasGlobalSchema = __hasGlobalSchema;
39
- // used by tests. no guarantee will always exist
40
- function __getGlobalSchema() {
41
- return globalSchema;
42
- }
43
- exports.__getGlobalSchema = __getGlobalSchema;
44
- function __getGlobalSchemaFields() {
45
- return globalSchemaFields;
46
- }
47
- exports.__getGlobalSchemaFields = __getGlobalSchemaFields;
48
- function __getGlobalSchemaField(type) {
49
- return globalSchemaFields.get(type);
50
- }
51
- exports.__getGlobalSchemaField = __getGlobalSchemaField;