@statezero/core 0.2.21 → 0.2.23
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/actions/backend1/django_app/calculate-hash.d.ts +57 -0
- package/dist/actions/backend1/django_app/calculate-hash.js +80 -0
- package/dist/actions/backend1/django_app/calculate-hash.schema.json +148 -0
- package/dist/actions/backend1/django_app/get-current-username.d.ts +29 -0
- package/dist/actions/backend1/django_app/get-current-username.js +65 -0
- package/dist/actions/backend1/django_app/get-current-username.schema.json +47 -0
- package/dist/actions/backend1/django_app/get-server-status.d.ts +38 -0
- package/dist/actions/backend1/django_app/get-server-status.js +68 -0
- package/dist/actions/backend1/django_app/get-server-status.schema.json +93 -0
- package/dist/actions/backend1/django_app/get-user-info.d.ts +44 -0
- package/dist/actions/backend1/django_app/get-user-info.js +70 -0
- package/dist/actions/backend1/django_app/get-user-info.schema.json +127 -0
- package/dist/actions/backend1/django_app/index.d.ts +1 -0
- package/dist/actions/backend1/django_app/index.js +6 -0
- package/dist/actions/backend1/django_app/process-data.d.ts +51 -0
- package/dist/actions/backend1/django_app/process-data.js +78 -0
- package/dist/actions/backend1/django_app/process-data.schema.json +117 -0
- package/dist/actions/backend1/django_app/send-notification.d.ts +55 -0
- package/dist/actions/backend1/django_app/send-notification.js +81 -0
- package/dist/actions/backend1/django_app/send-notification.schema.json +175 -0
- package/dist/actions/backend1/index.d.ts +1 -0
- package/dist/actions/backend1/index.js +1 -0
- package/dist/actions/default/django_app/calculate-hash.d.ts +57 -0
- package/dist/actions/default/django_app/calculate-hash.js +80 -0
- package/dist/actions/default/django_app/calculate-hash.schema.json +148 -0
- package/dist/actions/default/django_app/get-current-username.d.ts +29 -0
- package/dist/actions/default/django_app/get-current-username.js +65 -0
- package/dist/actions/default/django_app/get-current-username.schema.json +47 -0
- package/dist/actions/default/django_app/get-server-status.d.ts +38 -0
- package/dist/actions/default/django_app/get-server-status.js +68 -0
- package/dist/actions/default/django_app/get-server-status.schema.json +93 -0
- package/dist/actions/default/django_app/get-user-info.d.ts +44 -0
- package/dist/actions/default/django_app/get-user-info.js +70 -0
- package/dist/actions/default/django_app/get-user-info.schema.json +127 -0
- package/dist/actions/default/django_app/index.d.ts +1 -0
- package/dist/actions/default/django_app/index.js +6 -0
- package/dist/actions/default/django_app/process-data.d.ts +51 -0
- package/dist/actions/default/django_app/process-data.js +78 -0
- package/dist/actions/default/django_app/process-data.schema.json +117 -0
- package/dist/actions/default/django_app/send-notification.d.ts +55 -0
- package/dist/actions/default/django_app/send-notification.js +81 -0
- package/dist/actions/default/django_app/send-notification.schema.json +175 -0
- package/dist/actions/default/index.d.ts +1 -0
- package/dist/actions/default/index.js +1 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +5 -0
- package/dist/flavours/django/dates.js +4 -1
- package/dist/flavours/django/querySet.js +0 -1
- package/dist/flavours/django/serializers.js +8 -4
- package/dist/models/backend1/django_app/comprehensivemodel.d.ts +894 -0
- package/dist/models/backend1/django_app/comprehensivemodel.js +71 -0
- package/dist/models/backend1/django_app/comprehensivemodel.schema.json +870 -0
- package/dist/models/backend1/django_app/custompkmodel.d.ts +92 -0
- package/dist/models/backend1/django_app/custompkmodel.js +69 -0
- package/dist/models/backend1/django_app/custompkmodel.schema.json +71 -0
- package/dist/models/backend1/django_app/dailyrate.d.ts +230 -0
- package/dist/models/backend1/django_app/dailyrate.js +71 -0
- package/dist/models/backend1/django_app/dailyrate.schema.json +212 -0
- package/dist/models/backend1/django_app/deepmodellevel1.d.ts +140 -0
- package/dist/models/backend1/django_app/deepmodellevel1.js +72 -0
- package/dist/models/backend1/django_app/deepmodellevel1.schema.json +114 -0
- package/dist/models/backend1/django_app/deepmodellevel2.d.ts +118 -0
- package/dist/models/backend1/django_app/deepmodellevel2.js +71 -0
- package/dist/models/backend1/django_app/deepmodellevel2.schema.json +92 -0
- package/dist/models/backend1/django_app/deepmodellevel3.d.ts +92 -0
- package/dist/models/backend1/django_app/deepmodellevel3.js +69 -0
- package/dist/models/backend1/django_app/deepmodellevel3.schema.json +69 -0
- package/dist/models/backend1/django_app/dummymodel.d.ts +134 -0
- package/dist/models/backend1/django_app/dummymodel.js +71 -0
- package/dist/models/backend1/django_app/dummymodel.schema.json +109 -0
- package/dist/models/backend1/django_app/dummyrelatedmodel.d.ts +92 -0
- package/dist/models/backend1/django_app/dummyrelatedmodel.js +69 -0
- package/dist/models/backend1/django_app/dummyrelatedmodel.schema.json +69 -0
- package/dist/models/backend1/django_app/filetest.d.ts +140 -0
- package/dist/models/backend1/django_app/filetest.js +69 -0
- package/dist/models/backend1/django_app/filetest.schema.json +111 -0
- package/dist/models/backend1/django_app/index.d.ts +1 -0
- package/dist/models/backend1/django_app/index.js +18 -0
- package/dist/models/backend1/django_app/modelwithcustompkrelation.d.ts +118 -0
- package/dist/models/backend1/django_app/modelwithcustompkrelation.js +71 -0
- package/dist/models/backend1/django_app/modelwithcustompkrelation.schema.json +93 -0
- package/dist/models/backend1/django_app/modelwithrestrictedfields.d.ts +134 -0
- package/dist/models/backend1/django_app/modelwithrestrictedfields.js +71 -0
- package/dist/models/backend1/django_app/modelwithrestrictedfields.schema.json +111 -0
- package/dist/models/backend1/django_app/namefiltercustompkmodel.d.ts +92 -0
- package/dist/models/backend1/django_app/namefiltercustompkmodel.js +69 -0
- package/dist/models/backend1/django_app/namefiltercustompkmodel.schema.json +71 -0
- package/dist/models/backend1/django_app/order.d.ts +220 -0
- package/dist/models/backend1/django_app/order.js +71 -0
- package/dist/models/backend1/django_app/order.schema.json +203 -0
- package/dist/models/backend1/django_app/orderitem.d.ts +172 -0
- package/dist/models/backend1/django_app/orderitem.js +72 -0
- package/dist/models/backend1/django_app/orderitem.schema.json +149 -0
- package/dist/models/backend1/django_app/product.d.ts +254 -0
- package/dist/models/backend1/django_app/product.js +71 -0
- package/dist/models/backend1/django_app/product.schema.json +277 -0
- package/dist/models/backend1/django_app/productcategory.d.ts +92 -0
- package/dist/models/backend1/django_app/productcategory.js +69 -0
- package/dist/models/backend1/django_app/productcategory.schema.json +70 -0
- package/dist/models/backend1/django_app/rateplan.d.ts +92 -0
- package/dist/models/backend1/django_app/rateplan.js +69 -0
- package/dist/models/backend1/django_app/rateplan.schema.json +70 -0
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.d.ts +108 -0
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.js +69 -0
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.schema.json +87 -0
- package/dist/models/backend1/fileobject.d.ts +4 -0
- package/dist/models/backend1/fileobject.js +9 -0
- package/dist/models/backend1/index.d.ts +2 -0
- package/dist/models/backend1/index.js +2 -0
- package/dist/models/default/django_app/comprehensivemodel.d.ts +894 -0
- package/dist/models/default/django_app/comprehensivemodel.js +71 -0
- package/dist/models/default/django_app/comprehensivemodel.schema.json +870 -0
- package/dist/models/default/django_app/custompkmodel.d.ts +92 -0
- package/dist/models/default/django_app/custompkmodel.js +69 -0
- package/dist/models/default/django_app/custompkmodel.schema.json +71 -0
- package/dist/models/default/django_app/dailyrate.d.ts +230 -0
- package/dist/models/default/django_app/dailyrate.js +71 -0
- package/dist/models/default/django_app/dailyrate.schema.json +212 -0
- package/dist/models/default/django_app/deepmodellevel1.d.ts +128 -0
- package/dist/models/default/django_app/deepmodellevel1.js +72 -0
- package/dist/models/default/django_app/deepmodellevel1.schema.json +102 -0
- package/dist/models/default/django_app/deepmodellevel2.d.ts +106 -0
- package/dist/models/default/django_app/deepmodellevel2.js +71 -0
- package/dist/models/default/django_app/deepmodellevel2.schema.json +80 -0
- package/dist/models/default/django_app/deepmodellevel3.d.ts +80 -0
- package/dist/models/default/django_app/deepmodellevel3.js +69 -0
- package/dist/models/default/django_app/deepmodellevel3.schema.json +57 -0
- package/dist/models/default/django_app/dummymodel.d.ts +122 -0
- package/dist/models/default/django_app/dummymodel.js +71 -0
- package/dist/models/default/django_app/dummymodel.schema.json +97 -0
- package/dist/models/default/django_app/dummyrelatedmodel.d.ts +80 -0
- package/dist/models/default/django_app/dummyrelatedmodel.js +69 -0
- package/dist/models/default/django_app/dummyrelatedmodel.schema.json +57 -0
- package/dist/models/default/django_app/filetest.d.ts +128 -0
- package/dist/models/default/django_app/filetest.js +69 -0
- package/dist/models/default/django_app/filetest.schema.json +99 -0
- package/dist/models/default/django_app/index.d.ts +1 -0
- package/dist/models/default/django_app/index.js +18 -0
- package/dist/models/default/django_app/modelwithcustompkrelation.d.ts +118 -0
- package/dist/models/default/django_app/modelwithcustompkrelation.js +71 -0
- package/dist/models/default/django_app/modelwithcustompkrelation.schema.json +93 -0
- package/dist/models/default/django_app/modelwithrestrictedfields.d.ts +134 -0
- package/dist/models/default/django_app/modelwithrestrictedfields.js +71 -0
- package/dist/models/default/django_app/modelwithrestrictedfields.schema.json +111 -0
- package/dist/models/default/django_app/namefiltercustompkmodel.d.ts +92 -0
- package/dist/models/default/django_app/namefiltercustompkmodel.js +69 -0
- package/dist/models/default/django_app/namefiltercustompkmodel.schema.json +71 -0
- package/dist/models/default/django_app/order.d.ts +220 -0
- package/dist/models/default/django_app/order.js +71 -0
- package/dist/models/default/django_app/order.schema.json +203 -0
- package/dist/models/default/django_app/orderitem.d.ts +172 -0
- package/dist/models/default/django_app/orderitem.js +72 -0
- package/dist/models/default/django_app/orderitem.schema.json +149 -0
- package/dist/models/default/django_app/product.d.ts +254 -0
- package/dist/models/default/django_app/product.js +71 -0
- package/dist/models/default/django_app/product.schema.json +277 -0
- package/dist/models/default/django_app/productcategory.d.ts +92 -0
- package/dist/models/default/django_app/productcategory.js +69 -0
- package/dist/models/default/django_app/productcategory.schema.json +70 -0
- package/dist/models/default/django_app/rateplan.d.ts +92 -0
- package/dist/models/default/django_app/rateplan.js +69 -0
- package/dist/models/default/django_app/rateplan.schema.json +70 -0
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.d.ts +108 -0
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.js +69 -0
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.schema.json +87 -0
- package/dist/models/default/fileobject.d.ts +4 -0
- package/dist/models/default/fileobject.js +9 -0
- package/dist/models/default/index.d.ts +2 -0
- package/dist/models/default/index.js +2 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +5 -0
- package/dist/syncEngine/cache/cache.js +15 -1
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-specific QuerySet implementation
|
|
3
|
+
*/
|
|
4
|
+
export class ModelWithCustomPKRelationQuerySet {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Model-specific Manager implementation
|
|
8
|
+
*/
|
|
9
|
+
export class ModelWithCustomPKRelationManager {
|
|
10
|
+
constructor(ModelClass: any);
|
|
11
|
+
newQuerySet(): ModelWithCustomPKRelationQuerySet;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Implementation of the ModelWithCustomPKRelation model
|
|
15
|
+
*/
|
|
16
|
+
export class ModelWithCustomPKRelation {
|
|
17
|
+
static configKey: string;
|
|
18
|
+
static modelName: string;
|
|
19
|
+
static primaryKeyField: string;
|
|
20
|
+
static objects: ModelWithCustomPKRelationManager;
|
|
21
|
+
static fields: string[];
|
|
22
|
+
static schema: {
|
|
23
|
+
model_name: string;
|
|
24
|
+
title: string;
|
|
25
|
+
class_name: string;
|
|
26
|
+
plural_title: string;
|
|
27
|
+
primary_key_field: string;
|
|
28
|
+
filterable_fields: string[];
|
|
29
|
+
searchable_fields: string[];
|
|
30
|
+
ordering_fields: string[];
|
|
31
|
+
properties: {
|
|
32
|
+
id: {
|
|
33
|
+
type: string;
|
|
34
|
+
title: string;
|
|
35
|
+
required: boolean;
|
|
36
|
+
description: null;
|
|
37
|
+
nullable: boolean;
|
|
38
|
+
format: string;
|
|
39
|
+
max_length: null;
|
|
40
|
+
choices: null;
|
|
41
|
+
default: null;
|
|
42
|
+
validators: never[];
|
|
43
|
+
max_digits: null;
|
|
44
|
+
decimal_places: null;
|
|
45
|
+
read_only: boolean;
|
|
46
|
+
ref: null;
|
|
47
|
+
};
|
|
48
|
+
name: {
|
|
49
|
+
type: string;
|
|
50
|
+
title: string;
|
|
51
|
+
required: boolean;
|
|
52
|
+
description: null;
|
|
53
|
+
nullable: boolean;
|
|
54
|
+
format: null;
|
|
55
|
+
max_length: number;
|
|
56
|
+
choices: null;
|
|
57
|
+
default: null;
|
|
58
|
+
validators: never[];
|
|
59
|
+
max_digits: null;
|
|
60
|
+
decimal_places: null;
|
|
61
|
+
read_only: boolean;
|
|
62
|
+
ref: null;
|
|
63
|
+
};
|
|
64
|
+
custom_pk_related: {
|
|
65
|
+
type: string;
|
|
66
|
+
title: string;
|
|
67
|
+
required: boolean;
|
|
68
|
+
description: null;
|
|
69
|
+
nullable: boolean;
|
|
70
|
+
format: string;
|
|
71
|
+
max_length: null;
|
|
72
|
+
choices: null;
|
|
73
|
+
default: null;
|
|
74
|
+
validators: never[];
|
|
75
|
+
max_digits: null;
|
|
76
|
+
decimal_places: null;
|
|
77
|
+
read_only: boolean;
|
|
78
|
+
ref: null;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
relationships: {
|
|
82
|
+
custom_pk_related: {
|
|
83
|
+
type: string;
|
|
84
|
+
model: string;
|
|
85
|
+
class_name: string;
|
|
86
|
+
primary_key_field: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
default_ordering: null;
|
|
90
|
+
definitions: {
|
|
91
|
+
MoneyField: {
|
|
92
|
+
type: string;
|
|
93
|
+
properties: {
|
|
94
|
+
amount: {
|
|
95
|
+
type: string;
|
|
96
|
+
};
|
|
97
|
+
currency: {
|
|
98
|
+
type: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
datetime_format: string;
|
|
104
|
+
date_format: string;
|
|
105
|
+
time_format: string;
|
|
106
|
+
display: null;
|
|
107
|
+
};
|
|
108
|
+
static relationshipFields: Map<string, {
|
|
109
|
+
ModelClass: () => any;
|
|
110
|
+
relationshipType: string;
|
|
111
|
+
}>;
|
|
112
|
+
constructor(data: any);
|
|
113
|
+
/**
|
|
114
|
+
* Define property getters and setters for all model fields
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
private _defineProperties;
|
|
118
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated. Do not make direct changes to the file.
|
|
3
|
+
*/
|
|
4
|
+
import { Model, Manager, QuerySet, getModelClass } from '../../../../src';
|
|
5
|
+
import { wrapReactiveModel } from '../../../../src';
|
|
6
|
+
import schemaData from './modelwithcustompkrelation.schema.json';
|
|
7
|
+
/**
|
|
8
|
+
* Model-specific QuerySet implementation
|
|
9
|
+
*/
|
|
10
|
+
export class ModelWithCustomPKRelationQuerySet extends QuerySet {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Model-specific Manager implementation
|
|
14
|
+
*/
|
|
15
|
+
export class ModelWithCustomPKRelationManager extends Manager {
|
|
16
|
+
constructor(ModelClass) {
|
|
17
|
+
super(ModelClass, ModelWithCustomPKRelationQuerySet);
|
|
18
|
+
}
|
|
19
|
+
newQuerySet() {
|
|
20
|
+
return new ModelWithCustomPKRelationQuerySet(this.ModelClass);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Implementation of the ModelWithCustomPKRelation model
|
|
25
|
+
*/
|
|
26
|
+
export class ModelWithCustomPKRelation extends Model {
|
|
27
|
+
constructor(data) {
|
|
28
|
+
ModelWithCustomPKRelation.validateFields(data);
|
|
29
|
+
super(data);
|
|
30
|
+
// Define getters and setters for all fields
|
|
31
|
+
this._defineProperties();
|
|
32
|
+
return wrapReactiveModel(this);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Define property getters and setters for all model fields
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
_defineProperties() {
|
|
39
|
+
// For each field, define a property that gets/sets from internal storage
|
|
40
|
+
ModelWithCustomPKRelation.fields.forEach(field => {
|
|
41
|
+
Object.defineProperty(this, field, {
|
|
42
|
+
get: function () {
|
|
43
|
+
return this.getField(field);
|
|
44
|
+
},
|
|
45
|
+
set: function (value) {
|
|
46
|
+
this.setField(field, value);
|
|
47
|
+
},
|
|
48
|
+
enumerable: true, // Make sure fields are enumerable for serialization
|
|
49
|
+
configurable: true
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
// Add a special read-only getter for the repr field
|
|
53
|
+
Object.defineProperty(this, 'repr', {
|
|
54
|
+
get: function () {
|
|
55
|
+
return this.getField('repr');
|
|
56
|
+
},
|
|
57
|
+
enumerable: true, // Make sure repr is enumerable
|
|
58
|
+
configurable: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Bind this model to its backend
|
|
63
|
+
ModelWithCustomPKRelation.configKey = 'backend1';
|
|
64
|
+
ModelWithCustomPKRelation.modelName = 'django_app.modelwithcustompkrelation';
|
|
65
|
+
ModelWithCustomPKRelation.primaryKeyField = 'id';
|
|
66
|
+
ModelWithCustomPKRelation.objects = new ModelWithCustomPKRelationManager(ModelWithCustomPKRelation);
|
|
67
|
+
ModelWithCustomPKRelation.fields = ['id', 'name', 'custom_pk_related'];
|
|
68
|
+
ModelWithCustomPKRelation.schema = schemaData;
|
|
69
|
+
ModelWithCustomPKRelation.relationshipFields = new Map([
|
|
70
|
+
['custom_pk_related', { 'ModelClass': () => getModelClass('django_app.custompkmodel', 'backend1'), 'relationshipType': 'foreign-key' }]
|
|
71
|
+
]);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"model_name": "django_app.modelwithcustompkrelation",
|
|
3
|
+
"title": "Model With Custom Pk Relation",
|
|
4
|
+
"class_name": "ModelWithCustomPKRelation",
|
|
5
|
+
"plural_title": "Model With Custom Pk Relations",
|
|
6
|
+
"primary_key_field": "id",
|
|
7
|
+
"filterable_fields": [
|
|
8
|
+
"custom_pk_related",
|
|
9
|
+
"name"
|
|
10
|
+
],
|
|
11
|
+
"searchable_fields": [
|
|
12
|
+
"name"
|
|
13
|
+
],
|
|
14
|
+
"ordering_fields": [
|
|
15
|
+
"name"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"id": {
|
|
19
|
+
"type": "integer",
|
|
20
|
+
"title": "Id",
|
|
21
|
+
"required": true,
|
|
22
|
+
"description": null,
|
|
23
|
+
"nullable": false,
|
|
24
|
+
"format": "id",
|
|
25
|
+
"max_length": null,
|
|
26
|
+
"choices": null,
|
|
27
|
+
"default": null,
|
|
28
|
+
"validators": [],
|
|
29
|
+
"max_digits": null,
|
|
30
|
+
"decimal_places": null,
|
|
31
|
+
"read_only": true,
|
|
32
|
+
"ref": null
|
|
33
|
+
},
|
|
34
|
+
"name": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"title": "Name",
|
|
37
|
+
"required": true,
|
|
38
|
+
"description": null,
|
|
39
|
+
"nullable": false,
|
|
40
|
+
"format": null,
|
|
41
|
+
"max_length": 100,
|
|
42
|
+
"choices": null,
|
|
43
|
+
"default": null,
|
|
44
|
+
"validators": [],
|
|
45
|
+
"max_digits": null,
|
|
46
|
+
"decimal_places": null,
|
|
47
|
+
"read_only": false,
|
|
48
|
+
"ref": null
|
|
49
|
+
},
|
|
50
|
+
"custom_pk_related": {
|
|
51
|
+
"type": "integer",
|
|
52
|
+
"title": "Custom pk related",
|
|
53
|
+
"required": true,
|
|
54
|
+
"description": null,
|
|
55
|
+
"nullable": false,
|
|
56
|
+
"format": "foreign-key",
|
|
57
|
+
"max_length": null,
|
|
58
|
+
"choices": null,
|
|
59
|
+
"default": null,
|
|
60
|
+
"validators": [],
|
|
61
|
+
"max_digits": null,
|
|
62
|
+
"decimal_places": null,
|
|
63
|
+
"read_only": false,
|
|
64
|
+
"ref": null
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"relationships": {
|
|
68
|
+
"custom_pk_related": {
|
|
69
|
+
"type": "foreign-key",
|
|
70
|
+
"model": "django_app.custompkmodel",
|
|
71
|
+
"class_name": "CustomPKModel",
|
|
72
|
+
"primary_key_field": "custom_pk"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"default_ordering": null,
|
|
76
|
+
"definitions": {
|
|
77
|
+
"MoneyField": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"properties": {
|
|
80
|
+
"amount": {
|
|
81
|
+
"type": "number"
|
|
82
|
+
},
|
|
83
|
+
"currency": {
|
|
84
|
+
"type": "string"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"datetime_format": "iso-8601",
|
|
90
|
+
"date_format": "iso-8601",
|
|
91
|
+
"time_format": "iso-8601",
|
|
92
|
+
"display": null
|
|
93
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-specific QuerySet implementation
|
|
3
|
+
*/
|
|
4
|
+
export class ModelWithRestrictedFieldsQuerySet {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Model-specific Manager implementation
|
|
8
|
+
*/
|
|
9
|
+
export class ModelWithRestrictedFieldsManager {
|
|
10
|
+
constructor(ModelClass: any);
|
|
11
|
+
newQuerySet(): ModelWithRestrictedFieldsQuerySet;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Implementation of the ModelWithRestrictedFields model
|
|
15
|
+
*/
|
|
16
|
+
export class ModelWithRestrictedFields {
|
|
17
|
+
static configKey: string;
|
|
18
|
+
static modelName: string;
|
|
19
|
+
static primaryKeyField: string;
|
|
20
|
+
static objects: ModelWithRestrictedFieldsManager;
|
|
21
|
+
static fields: string[];
|
|
22
|
+
static schema: {
|
|
23
|
+
model_name: string;
|
|
24
|
+
title: string;
|
|
25
|
+
class_name: string;
|
|
26
|
+
plural_title: string;
|
|
27
|
+
primary_key_field: string;
|
|
28
|
+
filterable_fields: string[];
|
|
29
|
+
searchable_fields: string[];
|
|
30
|
+
ordering_fields: string[];
|
|
31
|
+
properties: {
|
|
32
|
+
id: {
|
|
33
|
+
type: string;
|
|
34
|
+
title: string;
|
|
35
|
+
required: boolean;
|
|
36
|
+
description: null;
|
|
37
|
+
nullable: boolean;
|
|
38
|
+
format: string;
|
|
39
|
+
max_length: null;
|
|
40
|
+
choices: null;
|
|
41
|
+
default: null;
|
|
42
|
+
validators: never[];
|
|
43
|
+
max_digits: null;
|
|
44
|
+
decimal_places: null;
|
|
45
|
+
read_only: boolean;
|
|
46
|
+
ref: null;
|
|
47
|
+
};
|
|
48
|
+
name: {
|
|
49
|
+
type: string;
|
|
50
|
+
title: string;
|
|
51
|
+
required: boolean;
|
|
52
|
+
description: null;
|
|
53
|
+
nullable: boolean;
|
|
54
|
+
format: null;
|
|
55
|
+
max_length: number;
|
|
56
|
+
choices: null;
|
|
57
|
+
default: null;
|
|
58
|
+
validators: never[];
|
|
59
|
+
max_digits: null;
|
|
60
|
+
decimal_places: null;
|
|
61
|
+
read_only: boolean;
|
|
62
|
+
ref: null;
|
|
63
|
+
};
|
|
64
|
+
admin_only_field: {
|
|
65
|
+
type: string;
|
|
66
|
+
title: string;
|
|
67
|
+
required: boolean;
|
|
68
|
+
description: null;
|
|
69
|
+
nullable: boolean;
|
|
70
|
+
format: null;
|
|
71
|
+
max_length: number;
|
|
72
|
+
choices: null;
|
|
73
|
+
default: null;
|
|
74
|
+
validators: never[];
|
|
75
|
+
max_digits: null;
|
|
76
|
+
decimal_places: null;
|
|
77
|
+
read_only: boolean;
|
|
78
|
+
ref: null;
|
|
79
|
+
};
|
|
80
|
+
restricted_related: {
|
|
81
|
+
type: string;
|
|
82
|
+
title: string;
|
|
83
|
+
required: boolean;
|
|
84
|
+
description: null;
|
|
85
|
+
nullable: boolean;
|
|
86
|
+
format: string;
|
|
87
|
+
max_length: null;
|
|
88
|
+
choices: null;
|
|
89
|
+
default: null;
|
|
90
|
+
validators: never[];
|
|
91
|
+
max_digits: null;
|
|
92
|
+
decimal_places: null;
|
|
93
|
+
read_only: boolean;
|
|
94
|
+
ref: null;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
relationships: {
|
|
98
|
+
restricted_related: {
|
|
99
|
+
type: string;
|
|
100
|
+
model: string;
|
|
101
|
+
class_name: string;
|
|
102
|
+
primary_key_field: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
default_ordering: null;
|
|
106
|
+
definitions: {
|
|
107
|
+
MoneyField: {
|
|
108
|
+
type: string;
|
|
109
|
+
properties: {
|
|
110
|
+
amount: {
|
|
111
|
+
type: string;
|
|
112
|
+
};
|
|
113
|
+
currency: {
|
|
114
|
+
type: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
datetime_format: string;
|
|
120
|
+
date_format: string;
|
|
121
|
+
time_format: string;
|
|
122
|
+
display: null;
|
|
123
|
+
};
|
|
124
|
+
static relationshipFields: Map<string, {
|
|
125
|
+
ModelClass: () => any;
|
|
126
|
+
relationshipType: string;
|
|
127
|
+
}>;
|
|
128
|
+
constructor(data: any);
|
|
129
|
+
/**
|
|
130
|
+
* Define property getters and setters for all model fields
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
private _defineProperties;
|
|
134
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated. Do not make direct changes to the file.
|
|
3
|
+
*/
|
|
4
|
+
import { Model, Manager, QuerySet, getModelClass } from '../../../../src';
|
|
5
|
+
import { wrapReactiveModel } from '../../../../src';
|
|
6
|
+
import schemaData from './modelwithrestrictedfields.schema.json';
|
|
7
|
+
/**
|
|
8
|
+
* Model-specific QuerySet implementation
|
|
9
|
+
*/
|
|
10
|
+
export class ModelWithRestrictedFieldsQuerySet extends QuerySet {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Model-specific Manager implementation
|
|
14
|
+
*/
|
|
15
|
+
export class ModelWithRestrictedFieldsManager extends Manager {
|
|
16
|
+
constructor(ModelClass) {
|
|
17
|
+
super(ModelClass, ModelWithRestrictedFieldsQuerySet);
|
|
18
|
+
}
|
|
19
|
+
newQuerySet() {
|
|
20
|
+
return new ModelWithRestrictedFieldsQuerySet(this.ModelClass);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Implementation of the ModelWithRestrictedFields model
|
|
25
|
+
*/
|
|
26
|
+
export class ModelWithRestrictedFields extends Model {
|
|
27
|
+
constructor(data) {
|
|
28
|
+
ModelWithRestrictedFields.validateFields(data);
|
|
29
|
+
super(data);
|
|
30
|
+
// Define getters and setters for all fields
|
|
31
|
+
this._defineProperties();
|
|
32
|
+
return wrapReactiveModel(this);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Define property getters and setters for all model fields
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
_defineProperties() {
|
|
39
|
+
// For each field, define a property that gets/sets from internal storage
|
|
40
|
+
ModelWithRestrictedFields.fields.forEach(field => {
|
|
41
|
+
Object.defineProperty(this, field, {
|
|
42
|
+
get: function () {
|
|
43
|
+
return this.getField(field);
|
|
44
|
+
},
|
|
45
|
+
set: function (value) {
|
|
46
|
+
this.setField(field, value);
|
|
47
|
+
},
|
|
48
|
+
enumerable: true, // Make sure fields are enumerable for serialization
|
|
49
|
+
configurable: true
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
// Add a special read-only getter for the repr field
|
|
53
|
+
Object.defineProperty(this, 'repr', {
|
|
54
|
+
get: function () {
|
|
55
|
+
return this.getField('repr');
|
|
56
|
+
},
|
|
57
|
+
enumerable: true, // Make sure repr is enumerable
|
|
58
|
+
configurable: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Bind this model to its backend
|
|
63
|
+
ModelWithRestrictedFields.configKey = 'backend1';
|
|
64
|
+
ModelWithRestrictedFields.modelName = 'django_app.modelwithrestrictedfields';
|
|
65
|
+
ModelWithRestrictedFields.primaryKeyField = 'id';
|
|
66
|
+
ModelWithRestrictedFields.objects = new ModelWithRestrictedFieldsManager(ModelWithRestrictedFields);
|
|
67
|
+
ModelWithRestrictedFields.fields = ['id', 'name', 'admin_only_field', 'restricted_related'];
|
|
68
|
+
ModelWithRestrictedFields.schema = schemaData;
|
|
69
|
+
ModelWithRestrictedFields.relationshipFields = new Map([
|
|
70
|
+
['restricted_related', { 'ModelClass': () => getModelClass('django_app.restrictedfieldrelatedmodel', 'backend1'), 'relationshipType': 'foreign-key' }]
|
|
71
|
+
]);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"model_name": "django_app.modelwithrestrictedfields",
|
|
3
|
+
"title": "Model With Restricted Fields",
|
|
4
|
+
"class_name": "ModelWithRestrictedFields",
|
|
5
|
+
"plural_title": "Model With Restricted Fieldss",
|
|
6
|
+
"primary_key_field": "id",
|
|
7
|
+
"filterable_fields": [
|
|
8
|
+
"admin_only_field",
|
|
9
|
+
"id",
|
|
10
|
+
"restricted_related",
|
|
11
|
+
"name"
|
|
12
|
+
],
|
|
13
|
+
"searchable_fields": [
|
|
14
|
+
"name"
|
|
15
|
+
],
|
|
16
|
+
"ordering_fields": [
|
|
17
|
+
"name"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"id": {
|
|
21
|
+
"type": "integer",
|
|
22
|
+
"title": "Id",
|
|
23
|
+
"required": true,
|
|
24
|
+
"description": null,
|
|
25
|
+
"nullable": false,
|
|
26
|
+
"format": "id",
|
|
27
|
+
"max_length": null,
|
|
28
|
+
"choices": null,
|
|
29
|
+
"default": null,
|
|
30
|
+
"validators": [],
|
|
31
|
+
"max_digits": null,
|
|
32
|
+
"decimal_places": null,
|
|
33
|
+
"read_only": true,
|
|
34
|
+
"ref": null
|
|
35
|
+
},
|
|
36
|
+
"name": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"title": "Name",
|
|
39
|
+
"required": true,
|
|
40
|
+
"description": null,
|
|
41
|
+
"nullable": false,
|
|
42
|
+
"format": null,
|
|
43
|
+
"max_length": 100,
|
|
44
|
+
"choices": null,
|
|
45
|
+
"default": null,
|
|
46
|
+
"validators": [],
|
|
47
|
+
"max_digits": null,
|
|
48
|
+
"decimal_places": null,
|
|
49
|
+
"read_only": false,
|
|
50
|
+
"ref": null
|
|
51
|
+
},
|
|
52
|
+
"admin_only_field": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"title": "Admin only field",
|
|
55
|
+
"required": true,
|
|
56
|
+
"description": null,
|
|
57
|
+
"nullable": false,
|
|
58
|
+
"format": null,
|
|
59
|
+
"max_length": 100,
|
|
60
|
+
"choices": null,
|
|
61
|
+
"default": null,
|
|
62
|
+
"validators": [],
|
|
63
|
+
"max_digits": null,
|
|
64
|
+
"decimal_places": null,
|
|
65
|
+
"read_only": false,
|
|
66
|
+
"ref": null
|
|
67
|
+
},
|
|
68
|
+
"restricted_related": {
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"title": "Restricted related",
|
|
71
|
+
"required": false,
|
|
72
|
+
"description": null,
|
|
73
|
+
"nullable": true,
|
|
74
|
+
"format": "foreign-key",
|
|
75
|
+
"max_length": null,
|
|
76
|
+
"choices": null,
|
|
77
|
+
"default": null,
|
|
78
|
+
"validators": [],
|
|
79
|
+
"max_digits": null,
|
|
80
|
+
"decimal_places": null,
|
|
81
|
+
"read_only": false,
|
|
82
|
+
"ref": null
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"relationships": {
|
|
86
|
+
"restricted_related": {
|
|
87
|
+
"type": "foreign-key",
|
|
88
|
+
"model": "django_app.restrictedfieldrelatedmodel",
|
|
89
|
+
"class_name": "RestrictedFieldRelatedModel",
|
|
90
|
+
"primary_key_field": "id"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"default_ordering": null,
|
|
94
|
+
"definitions": {
|
|
95
|
+
"MoneyField": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"properties": {
|
|
98
|
+
"amount": {
|
|
99
|
+
"type": "number"
|
|
100
|
+
},
|
|
101
|
+
"currency": {
|
|
102
|
+
"type": "string"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"datetime_format": "iso-8601",
|
|
108
|
+
"date_format": "iso-8601",
|
|
109
|
+
"time_format": "iso-8601",
|
|
110
|
+
"display": null
|
|
111
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-specific QuerySet implementation
|
|
3
|
+
*/
|
|
4
|
+
export class NameFilterCustomPKModelQuerySet {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Model-specific Manager implementation
|
|
8
|
+
*/
|
|
9
|
+
export class NameFilterCustomPKModelManager {
|
|
10
|
+
constructor(ModelClass: any);
|
|
11
|
+
newQuerySet(): NameFilterCustomPKModelQuerySet;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Implementation of the NameFilterCustomPKModel model
|
|
15
|
+
*/
|
|
16
|
+
export class NameFilterCustomPKModel {
|
|
17
|
+
static configKey: string;
|
|
18
|
+
static modelName: string;
|
|
19
|
+
static primaryKeyField: string;
|
|
20
|
+
static objects: NameFilterCustomPKModelManager;
|
|
21
|
+
static fields: string[];
|
|
22
|
+
static schema: {
|
|
23
|
+
model_name: string;
|
|
24
|
+
title: string;
|
|
25
|
+
class_name: string;
|
|
26
|
+
plural_title: string;
|
|
27
|
+
primary_key_field: string;
|
|
28
|
+
filterable_fields: string[];
|
|
29
|
+
searchable_fields: string[];
|
|
30
|
+
ordering_fields: string[];
|
|
31
|
+
properties: {
|
|
32
|
+
custom_pk: {
|
|
33
|
+
type: string;
|
|
34
|
+
title: string;
|
|
35
|
+
required: boolean;
|
|
36
|
+
description: null;
|
|
37
|
+
nullable: boolean;
|
|
38
|
+
format: string;
|
|
39
|
+
max_length: null;
|
|
40
|
+
choices: null;
|
|
41
|
+
default: null;
|
|
42
|
+
validators: never[];
|
|
43
|
+
max_digits: null;
|
|
44
|
+
decimal_places: null;
|
|
45
|
+
read_only: boolean;
|
|
46
|
+
ref: null;
|
|
47
|
+
};
|
|
48
|
+
name: {
|
|
49
|
+
type: string;
|
|
50
|
+
title: string;
|
|
51
|
+
required: boolean;
|
|
52
|
+
description: null;
|
|
53
|
+
nullable: boolean;
|
|
54
|
+
format: null;
|
|
55
|
+
max_length: number;
|
|
56
|
+
choices: null;
|
|
57
|
+
default: null;
|
|
58
|
+
validators: never[];
|
|
59
|
+
max_digits: null;
|
|
60
|
+
decimal_places: null;
|
|
61
|
+
read_only: boolean;
|
|
62
|
+
ref: null;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
relationships: {};
|
|
66
|
+
default_ordering: null;
|
|
67
|
+
definitions: {
|
|
68
|
+
MoneyField: {
|
|
69
|
+
type: string;
|
|
70
|
+
properties: {
|
|
71
|
+
amount: {
|
|
72
|
+
type: string;
|
|
73
|
+
};
|
|
74
|
+
currency: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
datetime_format: string;
|
|
81
|
+
date_format: string;
|
|
82
|
+
time_format: string;
|
|
83
|
+
display: null;
|
|
84
|
+
};
|
|
85
|
+
static relationshipFields: Map<any, any>;
|
|
86
|
+
constructor(data: any);
|
|
87
|
+
/**
|
|
88
|
+
* Define property getters and setters for all model fields
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
private _defineProperties;
|
|
92
|
+
}
|