@appweaver/data 2.4.1 → 2.6.0
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/README.md +4 -2
- package/config.d.ts +3 -0
- package/config.js +3 -0
- package/database/database-config.d.ts +9 -0
- package/database/database-config.js +56 -1
- package/database/database-error.d.ts +8 -0
- package/database/database-error.js +18 -0
- package/database/prisma-database.js +18 -1
- package/database/setup-database.d.ts +23 -0
- package/database/setup-database.js +59 -0
- package/database/sqlserver-extension.d.ts +18 -0
- package/database/sqlserver-extension.js +183 -0
- package/database/telemetry-extension.d.ts +10 -0
- package/database/telemetry-extension.js +52 -0
- package/export/export-service.js +4 -0
- package/factory/create-model.d.ts +1 -1
- package/factory/create-model.js +135 -5
- package/factory/create-service.js +8 -0
- package/index.d.ts +3 -0
- package/index.js +6 -0
- package/internal.d.ts +2 -0
- package/internal.js +3 -1
- package/module.js +23 -3
- package/package.json +3 -3
- package/prisma/client/browser.d.ts +10 -0
- package/prisma/client/client.d.ts +10 -0
- package/prisma/client/commonInputTypes.d.ts +81 -0
- package/prisma/client/enums.d.ts +6 -1
- package/prisma/client/enums.js +6 -0
- package/prisma/client/internal/class.d.ts +22 -0
- package/prisma/client/internal/class.js +4 -4
- package/prisma/client/internal/prismaNamespace.d.ts +175 -1
- package/prisma/client/internal/prismaNamespace.js +19 -1
- package/prisma/client/internal/prismaNamespaceBrowser.d.ts +20 -0
- package/prisma/client/internal/prismaNamespaceBrowser.js +19 -1
- package/prisma/client/models/TwoFactorMethod.d.ts +1140 -0
- package/prisma/client/models/TwoFactorMethod.js +2 -0
- package/prisma/client/models/TwoFactorRecoveryCode.d.ts +1005 -0
- package/prisma/client/models/TwoFactorRecoveryCode.js +2 -0
- package/prisma/client/models.d.ts +2 -0
- package/resource/resource-service.d.ts +32 -7
- package/resource/resource-service.js +248 -35
- package/resource/schemas/resource-filter-schema.d.ts +8 -0
- package/resource/schemas/resource-filter-schema.js +40 -1
- package/resource/schemas/resource-sort-schema.js +10 -0
- package/resource/utils/cursor-util.d.ts +13 -0
- package/resource/utils/cursor-util.js +21 -0
- package/resource/utils/filter-util.d.ts +9 -0
- package/resource/utils/filter-util.js +17 -0
- package/resource/utils/prune-util.js +3 -1
- package/resource/utils/sort-util.d.ts +14 -0
- package/resource/utils/sort-util.js +1 -0
- package/resource/utils/where-util.d.ts +20 -0
- package/resource/utils/where-util.js +210 -0
- package/resources.d.ts +4 -0
- package/resources.js +17 -9
- package/security/auth-config.d.ts +3 -0
- package/security/auth-config.js +6 -1
- package/security/create-auth-resources.d.ts +3 -3
- package/security/create-auth-resources.js +44 -7
- package/security/helper.d.ts +6 -0
- package/security/helper.js +11 -0
- package/security/resources/two-factor-method/model.d.ts +2 -0
- package/security/resources/two-factor-method/model.js +64 -0
- package/security/resources/two-factor-method/service.d.ts +2 -0
- package/security/resources/two-factor-method/service.js +7 -0
- package/security/resources/two-factor-recovery-code/model.d.ts +2 -0
- package/security/resources/two-factor-recovery-code/model.js +49 -0
- package/security/resources/two-factor-recovery-code/service.d.ts +2 -0
- package/security/resources/two-factor-recovery-code/service.js +7 -0
- package/security/store/database-security-store.d.ts +2 -2
- package/security/store/database-security-store.js +11 -1
- package/seeder/create-seeder.d.ts +3 -0
- package/seeder/create-seeder.js +6 -2
- package/seeder/seeder.d.ts +4 -2
- package/seeder/seeder.js +56 -23
- package/spatial/geo-schema.d.ts +22 -0
- package/spatial/geo-schema.js +60 -0
- package/spatial/spatial-config.d.ts +21 -0
- package/spatial/spatial-config.js +52 -0
- package/spatial/spatial-engine.d.ts +78 -0
- package/spatial/spatial-engine.js +232 -0
- package/spatial/spatial-extension.d.ts +10 -0
- package/spatial/spatial-extension.js +100 -0
- package/spatial/spatial-service.d.ts +54 -0
- package/spatial/spatial-service.js +213 -0
- package/spatial/utils/box-util.d.ts +31 -0
- package/spatial/utils/box-util.js +62 -0
- package/timeseries/database-series-config.d.ts +5 -0
- package/timeseries/database-series-config.js +15 -0
- package/timeseries/database-time-series.d.ts +36 -0
- package/timeseries/database-time-series.js +147 -0
- package/timeseries/index.d.ts +2 -0
- package/timeseries/index.js +18 -0
- package/timeseries/timescale-config.d.ts +6 -0
- package/timeseries/timescale-config.js +19 -0
- package/timeseries/timescale-time-series.d.ts +21 -0
- package/timeseries/timescale-time-series.js +158 -0
- package/timeseries/utils/series-sql-util.d.ts +90 -0
- package/timeseries/utils/series-sql-util.js +313 -0
- package/types/generated.d.ts +92 -0
- package/utils/schema-util.d.ts +8 -0
- package/utils/schema-util.js +22 -0
- package/utils/write-data-util.d.ts +22 -0
- package/utils/write-data-util.js +144 -0
package/factory/create-model.js
CHANGED
|
@@ -6,6 +6,7 @@ const common_1 = require("@appweaver/common");
|
|
|
6
6
|
const internal_1 = require("@appweaver/core/internal");
|
|
7
7
|
const core_1 = require("@appweaver/core");
|
|
8
8
|
const model_schema_1 = require("../resource/model-schema");
|
|
9
|
+
const geo_schema_1 = require("../spatial/geo-schema");
|
|
9
10
|
const logger = (0, common_1.createLogger)('resource');
|
|
10
11
|
/**
|
|
11
12
|
* Creates a resource model from its configuration and defines it in the application context. The names of the
|
|
@@ -18,6 +19,8 @@ const logger = (0, common_1.createLogger)('resource');
|
|
|
18
19
|
*/
|
|
19
20
|
function createModel(modelConfig, override = false) {
|
|
20
21
|
const config = normalizeRelations(modelConfig);
|
|
22
|
+
validateSeries(config);
|
|
23
|
+
validateGeo(config);
|
|
21
24
|
const resourceModel = buildModel(config);
|
|
22
25
|
logger.debug({ modelName: resourceModel.name }, 'Created resource model');
|
|
23
26
|
(0, core_1.define)(resourceModel, undefined, override ? 'override' : undefined);
|
|
@@ -52,6 +55,118 @@ function normalizeRelations(config) {
|
|
|
52
55
|
}
|
|
53
56
|
return { ...config, relations };
|
|
54
57
|
}
|
|
58
|
+
const SERIES_RESERVED_NAMES = ['time', 'resourceId'];
|
|
59
|
+
const SERIES_TYPES = ['float', 'int', 'boolean'];
|
|
60
|
+
const SERIES_INGESTS = ['direct', 'queue', 'auto'];
|
|
61
|
+
/**
|
|
62
|
+
* Checks the series of a model: the types of its fields, names leaving the `time` and `resourceId` of a point free,
|
|
63
|
+
* and the durations and the ingest of its options.
|
|
64
|
+
*
|
|
65
|
+
* @throws {ConfigurationError} For a series field with a reserved name or an unknown type, or an invalid option.
|
|
66
|
+
*/
|
|
67
|
+
function validateSeries(config) {
|
|
68
|
+
for (const [field, series] of Object.entries(config.series ?? {})) {
|
|
69
|
+
if (SERIES_RESERVED_NAMES.includes(field) || !/^[A-Za-z]\w*$/.test(field)) {
|
|
70
|
+
throw new common_1.ConfigurationError(common_1.ErrorCode.ConfigurationInvalid, `Series field '${config.name}.${field}' must be an identifier other than ${SERIES_RESERVED_NAMES.join(' and ')}`);
|
|
71
|
+
}
|
|
72
|
+
if (!SERIES_TYPES.includes(series.type)) {
|
|
73
|
+
throw new common_1.ConfigurationError(common_1.ErrorCode.ConfigurationInvalid, `Series field '${config.name}.${field}' has the type '${series.type}', not one of ${SERIES_TYPES.join(', ')}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const options = config.seriesOptions ?? {};
|
|
77
|
+
for (const option of [
|
|
78
|
+
'retention',
|
|
79
|
+
'chunkInterval',
|
|
80
|
+
'compressAfter'
|
|
81
|
+
]) {
|
|
82
|
+
const duration = options[option];
|
|
83
|
+
if (duration === undefined) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const seconds = (0, common_1.parseDuration)(duration);
|
|
87
|
+
if (!seconds || !Number.isInteger(seconds)) {
|
|
88
|
+
throw new common_1.ConfigurationError(common_1.ErrorCode.ConfigurationInvalid, `Series option '${config.name}.${option}' is '${duration}', not a duration of whole seconds, i.e. 30d`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (options.ingest && !SERIES_INGESTS.includes(options.ingest)) {
|
|
92
|
+
throw new common_1.ConfigurationError(common_1.ErrorCode.ConfigurationInvalid, `Series option '${config.name}.ingest' is '${options.ingest}', not one of ${SERIES_INGESTS.join(', ')}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Checks the geo fields of a model: their types, and names taken by no other field of the model, nor by the columns
|
|
97
|
+
* the field keeps beside its own (`<field>MinLng`, `<field>Geom`, ...) and its distance (`<field>Distance`).
|
|
98
|
+
*
|
|
99
|
+
* @throws {ConfigurationError} For a geo field with an unknown type or a name taken by another field.
|
|
100
|
+
*/
|
|
101
|
+
function validateGeo(config) {
|
|
102
|
+
const taken = new Set([
|
|
103
|
+
'id',
|
|
104
|
+
...Object.keys(config.scalars ?? {}),
|
|
105
|
+
...Object.keys(config.relations ?? {}),
|
|
106
|
+
...Object.keys(config.files ?? {}),
|
|
107
|
+
...Object.keys(config.virtual ?? {})
|
|
108
|
+
]);
|
|
109
|
+
const geoFields = Object.keys(config.geo ?? {});
|
|
110
|
+
for (const [field, geo] of Object.entries(config.geo ?? {})) {
|
|
111
|
+
if (!common_1.GEO_FIELD_GEOMETRIES[geo?.type]) {
|
|
112
|
+
throw new common_1.ConfigurationError(common_1.ErrorCode.ConfigurationInvalid, `Geo field '${config.name}.${field}' has the type '${geo?.type}', not one of ${Object.keys(common_1.GEO_FIELD_GEOMETRIES).join(', ')}`);
|
|
113
|
+
}
|
|
114
|
+
const names = [
|
|
115
|
+
field,
|
|
116
|
+
...Object.values((0, common_1.geoColumns)(field)),
|
|
117
|
+
(0, common_1.distanceFieldName)(field)
|
|
118
|
+
];
|
|
119
|
+
const conflict = names.find((name) => taken.has(name) || (name !== field && geoFields.includes(name)));
|
|
120
|
+
if (conflict || !/^[A-Za-z]\w*$/.test(field)) {
|
|
121
|
+
throw new common_1.ConfigurationError(common_1.ErrorCode.ConfigurationInvalid, `Geo field '${config.name}.${field}' must be an identifier taken by no other field` +
|
|
122
|
+
(conflict ? `, but '${conflict}' is another field of the model` : ''));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The geo fields of a model, as their input values, or as their output ones, each field followed by its distance from
|
|
128
|
+
* the point of its `_near` filter, which a query filtering by it returns.
|
|
129
|
+
*/
|
|
130
|
+
function buildGeoSchema(geo = {}, input = false) {
|
|
131
|
+
const properties = {};
|
|
132
|
+
for (const [name, field] of Object.entries(geo)) {
|
|
133
|
+
properties[name] = (0, geo_schema_1.geoFieldSchema)(field, input);
|
|
134
|
+
if (!input && !field.hidden) {
|
|
135
|
+
properties[(0, common_1.distanceFieldName)(name)] = typebox_1.Type.Optional(typebox_1.Type.Number({
|
|
136
|
+
minimum: 0,
|
|
137
|
+
description: `Distance of ${name} in meters from the point of its _near filter`
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return typebox_1.Type.Object(properties);
|
|
142
|
+
}
|
|
143
|
+
/** The read restrictions of a model, the distance of a geo field left out or picked with its field. */
|
|
144
|
+
function readOperationConfig(config) {
|
|
145
|
+
const withDistances = (fields) => fields?.flatMap((field) => config.geo?.[field] ? [field, (0, common_1.distanceFieldName)(field)] : [field]);
|
|
146
|
+
return (config.read && {
|
|
147
|
+
omit: withDistances(config.read.omit),
|
|
148
|
+
pick: withDistances(config.read.pick)
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/** The values of the series fields, each optional and nullable, a null leaving the stored value unchanged. */
|
|
152
|
+
function buildSeriesModel(series) {
|
|
153
|
+
const properties = {};
|
|
154
|
+
for (const [name, field] of Object.entries(series ?? {})) {
|
|
155
|
+
const options = (0, common_1.pickProperties)(field, [
|
|
156
|
+
'minimum',
|
|
157
|
+
'maximum',
|
|
158
|
+
'description',
|
|
159
|
+
'example'
|
|
160
|
+
]);
|
|
161
|
+
const schema = field.type === 'boolean'
|
|
162
|
+
? typebox_1.Type.Boolean((0, common_1.pickProperties)(field, ['description', 'example']))
|
|
163
|
+
: field.type === 'int'
|
|
164
|
+
? typebox_1.Type.Integer(options)
|
|
165
|
+
: typebox_1.Type.Number(options);
|
|
166
|
+
properties[name] = typebox_1.Type.Optional((0, common_1.Nullable)(schema));
|
|
167
|
+
}
|
|
168
|
+
return typebox_1.Type.Object(properties);
|
|
169
|
+
}
|
|
55
170
|
function buildModel(config) {
|
|
56
171
|
const name = (0, common_1.capitalize)(config.name);
|
|
57
172
|
const idSchema = (0, model_schema_1.idSchema)(config?.id);
|
|
@@ -60,9 +175,12 @@ function buildModel(config) {
|
|
|
60
175
|
const virtualSchema = buildScalarsSchema(config?.virtual);
|
|
61
176
|
const filesSchema = buildFilesSchema(config?.files);
|
|
62
177
|
const relationsSchema = buildRelationsSchema(config?.relations);
|
|
178
|
+
const geoSchema = buildGeoSchema(config?.geo);
|
|
179
|
+
const geoInputSchema = buildGeoSchema(config?.geo, true);
|
|
63
180
|
const readModel = typebox_1.Type.Composite([
|
|
64
181
|
idSchema,
|
|
65
182
|
scalarsSchema,
|
|
183
|
+
geoSchema,
|
|
66
184
|
virtualSchema,
|
|
67
185
|
relationsSchema,
|
|
68
186
|
filesSchema,
|
|
@@ -77,17 +195,28 @@ function buildModel(config) {
|
|
|
77
195
|
$id: `${name}Relations`
|
|
78
196
|
});
|
|
79
197
|
const filesModel = typebox_1.Type.Composite([filesSchema], { $id: `${name}Files` });
|
|
80
|
-
const baseReadModel = omitOrPickScalars(typebox_1.Type.Composite([
|
|
81
|
-
|
|
82
|
-
|
|
198
|
+
const baseReadModel = omitOrPickScalars(typebox_1.Type.Composite([
|
|
199
|
+
idSchema,
|
|
200
|
+
scalarsSchema,
|
|
201
|
+
geoSchema,
|
|
202
|
+
virtualSchema,
|
|
203
|
+
auditSchema
|
|
204
|
+
]), readOperationConfig(config));
|
|
205
|
+
const createModel = omitOrPickScalars(resolveDefaultScalars(typebox_1.Type.Composite([scalarsSchema, geoInputSchema, virtualSchema]), config), config.create);
|
|
206
|
+
const updateModel = omitOrPickScalars(resolveDefaultScalars(typebox_1.Type.Partial(typebox_1.Type.Composite([scalarsSchema, geoInputSchema, virtualSchema])), config), config.update);
|
|
83
207
|
// The fields of an update, its scalars required the same way as on a
|
|
84
208
|
// create, since a replacement carries the whole stored state of the
|
|
85
209
|
// resource. The virtual fields are no part of it, so they stay optional
|
|
86
|
-
const replaceModel = omitOrPickScalars(resolveDefaultScalars(typebox_1.Type.Composite([
|
|
210
|
+
const replaceModel = omitOrPickScalars(resolveDefaultScalars(typebox_1.Type.Composite([
|
|
211
|
+
scalarsSchema,
|
|
212
|
+
geoInputSchema,
|
|
213
|
+
typebox_1.Type.Partial(virtualSchema)
|
|
214
|
+
]), config), config.update);
|
|
87
215
|
const { readOneModel, readManyModel } = buildOutputModels(baseReadModel, relationsModel, filesModel, config);
|
|
88
216
|
const readOneNullableModel = buildNullableOutputModel(name);
|
|
89
217
|
const { createOneModel, updateOneModel, replaceOneModel, relationCreateModel, relationUpdateModel } = buildInputModels(createModel, updateModel, replaceModel, relationsModel, idSchema, config);
|
|
90
218
|
const { fileUploadModel, fileDeleteModel } = buildFileInputModels(config);
|
|
219
|
+
const seriesModel = buildSeriesModel(config.series);
|
|
91
220
|
const resourceModel = {
|
|
92
221
|
name,
|
|
93
222
|
config: config,
|
|
@@ -107,7 +236,8 @@ function buildModel(config) {
|
|
|
107
236
|
relationCreateModel,
|
|
108
237
|
relationUpdateModel,
|
|
109
238
|
fileUploadModel,
|
|
110
|
-
fileDeleteModel
|
|
239
|
+
fileDeleteModel,
|
|
240
|
+
seriesModel
|
|
111
241
|
};
|
|
112
242
|
for (const value of Object.values(resourceModel)) {
|
|
113
243
|
if ((0, common_1.isPlainObject)(value)) {
|
|
@@ -103,6 +103,14 @@ function createService(config, override = false) {
|
|
|
103
103
|
}
|
|
104
104
|
return super.checkAccess(action, resource);
|
|
105
105
|
}
|
|
106
|
+
async eventAccess(event) {
|
|
107
|
+
const policy = (0, core_1.injectPolicy)(name, false);
|
|
108
|
+
if (policy?.events) {
|
|
109
|
+
const user = (0, core_1.currentAuthUser)() ?? null;
|
|
110
|
+
return policy.events(user, event);
|
|
111
|
+
}
|
|
112
|
+
return super.eventAccess(event);
|
|
113
|
+
}
|
|
106
114
|
}
|
|
107
115
|
Object.defineProperty(Service, 'name', {
|
|
108
116
|
value: `${name}Service`,
|
package/index.d.ts
CHANGED
|
@@ -7,11 +7,14 @@ export * from './factory/create-service';
|
|
|
7
7
|
export * from './resource/model-schema';
|
|
8
8
|
export * from './resource/resource-loader';
|
|
9
9
|
export * from './resource/resource-service';
|
|
10
|
+
export { matchesWhere, queryFilterWhere } from './resource/utils/where-util';
|
|
10
11
|
export * from './resource/schemas';
|
|
11
12
|
export * from './security/create-auth-resources';
|
|
12
13
|
export * from './security/helper';
|
|
13
14
|
export * from './seeder';
|
|
15
|
+
export * from './spatial/spatial-service';
|
|
14
16
|
export * from './storage/file-service';
|
|
17
|
+
export * from './timeseries';
|
|
15
18
|
export * from './types/auth';
|
|
16
19
|
export * from './types/generated';
|
|
17
20
|
export * from './types/storage';
|
package/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.queryFilterWhere = exports.matchesWhere = void 0;
|
|
17
18
|
__exportStar(require("./config"), exports);
|
|
18
19
|
__exportStar(require("./database"), exports);
|
|
19
20
|
__exportStar(require("./export/export-service"), exports);
|
|
@@ -23,11 +24,16 @@ __exportStar(require("./factory/create-service"), exports);
|
|
|
23
24
|
__exportStar(require("./resource/model-schema"), exports);
|
|
24
25
|
__exportStar(require("./resource/resource-loader"), exports);
|
|
25
26
|
__exportStar(require("./resource/resource-service"), exports);
|
|
27
|
+
var where_util_1 = require("./resource/utils/where-util");
|
|
28
|
+
Object.defineProperty(exports, "matchesWhere", { enumerable: true, get: function () { return where_util_1.matchesWhere; } });
|
|
29
|
+
Object.defineProperty(exports, "queryFilterWhere", { enumerable: true, get: function () { return where_util_1.queryFilterWhere; } });
|
|
26
30
|
__exportStar(require("./resource/schemas"), exports);
|
|
27
31
|
__exportStar(require("./security/create-auth-resources"), exports);
|
|
28
32
|
__exportStar(require("./security/helper"), exports);
|
|
29
33
|
__exportStar(require("./seeder"), exports);
|
|
34
|
+
__exportStar(require("./spatial/spatial-service"), exports);
|
|
30
35
|
__exportStar(require("./storage/file-service"), exports);
|
|
36
|
+
__exportStar(require("./timeseries"), exports);
|
|
31
37
|
__exportStar(require("./types/auth"), exports);
|
|
32
38
|
__exportStar(require("./types/generated"), exports);
|
|
33
39
|
__exportStar(require("./types/storage"), exports);
|
package/internal.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
/** The internals of data the CLI builds on, which can change in a minor release. */
|
|
2
2
|
export { pruneUnusedModels } from './resource/utils/prune-util';
|
|
3
|
+
export { setupDatabase } from './database/setup-database';
|
|
4
|
+
export type { SetupDatabaseParams, SetupDatabaseResult } from './database/setup-database';
|
package/internal.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pruneUnusedModels = void 0;
|
|
3
|
+
exports.setupDatabase = exports.pruneUnusedModels = void 0;
|
|
4
4
|
/** The internals of data the CLI builds on, which can change in a minor release. */
|
|
5
5
|
var prune_util_1 = require("./resource/utils/prune-util");
|
|
6
6
|
Object.defineProperty(exports, "pruneUnusedModels", { enumerable: true, get: function () { return prune_util_1.pruneUnusedModels; } });
|
|
7
|
+
var setup_database_1 = require("./database/setup-database");
|
|
8
|
+
Object.defineProperty(exports, "setupDatabase", { enumerable: true, get: function () { return setup_database_1.setupDatabase; } });
|
package/module.js
CHANGED
|
@@ -38,7 +38,10 @@ const database_config_1 = require("./database/database-config");
|
|
|
38
38
|
const export_config_1 = require("./export/export-config");
|
|
39
39
|
const resource_config_1 = require("./resource/resource-config");
|
|
40
40
|
const auth_config_1 = require("./security/auth-config");
|
|
41
|
+
const spatial_config_1 = require("./spatial/spatial-config");
|
|
41
42
|
const image_config_1 = require("./storage/image-config");
|
|
43
|
+
const database_series_config_1 = require("./timeseries/database-series-config");
|
|
44
|
+
const timescale_config_1 = require("./timeseries/timescale-config");
|
|
42
45
|
/** The database, the resources and the auth data model, built on Prisma. */
|
|
43
46
|
exports.default = (0, common_1.defineModule)({
|
|
44
47
|
name: '@appweaver/data',
|
|
@@ -50,9 +53,13 @@ exports.default = (0, common_1.defineModule)({
|
|
|
50
53
|
auth_config_1.passwordConfig,
|
|
51
54
|
auth_config_1.apiKeyConfig,
|
|
52
55
|
auth_config_1.connectedAccountConfig,
|
|
53
|
-
auth_config_1.
|
|
56
|
+
auth_config_1.twoFactorModelConfig,
|
|
57
|
+
auth_config_1.systemConfig,
|
|
58
|
+
database_series_config_1.databaseSeriesConfig,
|
|
59
|
+
timescale_config_1.timescaleConfig,
|
|
60
|
+
spatial_config_1.spatialConfig
|
|
54
61
|
],
|
|
55
|
-
loggers: ['database', 'resource', 'storage'],
|
|
62
|
+
loggers: ['database', 'resource', 'storage', 'timeseries', 'spatial'],
|
|
56
63
|
contracts: [
|
|
57
64
|
{ contract: common_1.Database, provider: () => database_config_1.databaseConfig.PROVIDER },
|
|
58
65
|
{ contract: common_1.ImageProcessor, provider: () => image_config_1.imageConfig.PROVIDER }
|
|
@@ -68,6 +75,18 @@ exports.default = (0, common_1.defineModule)({
|
|
|
68
75
|
name: 'database',
|
|
69
76
|
load: () => Promise.resolve().then(() => __importStar(require('./security/store/database-security-store'))),
|
|
70
77
|
auto: 'fallback'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
contract: common_1.TimeSeries,
|
|
81
|
+
name: 'database',
|
|
82
|
+
load: () => Promise.resolve().then(() => __importStar(require('./timeseries/database-time-series'))),
|
|
83
|
+
auto: 'fallback'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
contract: common_1.TimeSeries,
|
|
87
|
+
name: 'timescale',
|
|
88
|
+
load: () => Promise.resolve().then(() => __importStar(require('./timeseries/timescale-time-series'))),
|
|
89
|
+
auto: false
|
|
71
90
|
}
|
|
72
91
|
],
|
|
73
92
|
services: [
|
|
@@ -75,7 +94,8 @@ exports.default = (0, common_1.defineModule)({
|
|
|
75
94
|
load: () => Promise.resolve().then(() => __importStar(require('./storage/file-service'))),
|
|
76
95
|
requires: [common_1.Database, common_1.Storage]
|
|
77
96
|
},
|
|
78
|
-
{ load: () => Promise.resolve().then(() => __importStar(require('./export/export-service'))), requires: [common_1.Database] }
|
|
97
|
+
{ load: () => Promise.resolve().then(() => __importStar(require('./export/export-service'))), requires: [common_1.Database] },
|
|
98
|
+
{ load: () => Promise.resolve().then(() => __importStar(require('./spatial/spatial-service'))), requires: [common_1.Database] }
|
|
79
99
|
],
|
|
80
100
|
setup: async (context) => (await Promise.resolve().then(() => __importStar(require('./resource/load-data-resources')))).loadDataResources(context),
|
|
81
101
|
resources: () => Promise.resolve().then(() => __importStar(require('./resources')))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appweaver/data",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Appweaver - the backend framework for AI-first development (@data)",
|
|
5
5
|
"author": "Luka Matosevic",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"csv-stringify": "6.8.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@appweaver/common": "^2.
|
|
55
|
-
"@appweaver/core": "^2.
|
|
54
|
+
"@appweaver/common": "^2.6.0",
|
|
55
|
+
"@appweaver/core": "^2.6.0",
|
|
56
56
|
"@prisma/client": "^7.9.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
@@ -27,6 +27,16 @@ export type Permission = Prisma.PermissionModel;
|
|
|
27
27
|
*
|
|
28
28
|
*/
|
|
29
29
|
export type Role = Prisma.RoleModel;
|
|
30
|
+
/**
|
|
31
|
+
* Model TwoFactorMethod
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export type TwoFactorMethod = Prisma.TwoFactorMethodModel;
|
|
35
|
+
/**
|
|
36
|
+
* Model TwoFactorRecoveryCode
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export type TwoFactorRecoveryCode = Prisma.TwoFactorRecoveryCodeModel;
|
|
30
40
|
/**
|
|
31
41
|
* Model Seeder
|
|
32
42
|
*
|
|
@@ -46,6 +46,16 @@ export type Permission = Prisma.PermissionModel;
|
|
|
46
46
|
*
|
|
47
47
|
*/
|
|
48
48
|
export type Role = Prisma.RoleModel;
|
|
49
|
+
/**
|
|
50
|
+
* Model TwoFactorMethod
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
export type TwoFactorMethod = Prisma.TwoFactorMethodModel;
|
|
54
|
+
/**
|
|
55
|
+
* Model TwoFactorRecoveryCode
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export type TwoFactorRecoveryCode = Prisma.TwoFactorRecoveryCodeModel;
|
|
49
59
|
/**
|
|
50
60
|
* Model Seeder
|
|
51
61
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as runtime from "@prisma/client/runtime/client";
|
|
2
|
+
import * as $Enums from "./enums";
|
|
2
3
|
import type * as Prisma from "./internal/prismaNamespace";
|
|
3
4
|
export type IntFilter<$PrismaModel = never> = {
|
|
4
5
|
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
@@ -171,6 +172,46 @@ export type JsonWithAggregatesFilterBase<$PrismaModel = never> = {
|
|
|
171
172
|
_min?: Prisma.NestedJsonFilter<$PrismaModel>;
|
|
172
173
|
_max?: Prisma.NestedJsonFilter<$PrismaModel>;
|
|
173
174
|
};
|
|
175
|
+
export type EnumTwoFactorMethodTypeFilter<$PrismaModel = never> = {
|
|
176
|
+
equals?: $Enums.TwoFactorMethodType | Prisma.EnumTwoFactorMethodTypeFieldRefInput<$PrismaModel>;
|
|
177
|
+
in?: $Enums.TwoFactorMethodType[];
|
|
178
|
+
notIn?: $Enums.TwoFactorMethodType[];
|
|
179
|
+
not?: Prisma.NestedEnumTwoFactorMethodTypeFilter<$PrismaModel> | $Enums.TwoFactorMethodType;
|
|
180
|
+
};
|
|
181
|
+
export type IntNullableFilter<$PrismaModel = never> = {
|
|
182
|
+
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null;
|
|
183
|
+
in?: number[] | null;
|
|
184
|
+
notIn?: number[] | null;
|
|
185
|
+
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
186
|
+
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
187
|
+
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
188
|
+
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
189
|
+
not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null;
|
|
190
|
+
};
|
|
191
|
+
export type EnumTwoFactorMethodTypeWithAggregatesFilter<$PrismaModel = never> = {
|
|
192
|
+
equals?: $Enums.TwoFactorMethodType | Prisma.EnumTwoFactorMethodTypeFieldRefInput<$PrismaModel>;
|
|
193
|
+
in?: $Enums.TwoFactorMethodType[];
|
|
194
|
+
notIn?: $Enums.TwoFactorMethodType[];
|
|
195
|
+
not?: Prisma.NestedEnumTwoFactorMethodTypeWithAggregatesFilter<$PrismaModel> | $Enums.TwoFactorMethodType;
|
|
196
|
+
_count?: Prisma.NestedIntFilter<$PrismaModel>;
|
|
197
|
+
_min?: Prisma.NestedEnumTwoFactorMethodTypeFilter<$PrismaModel>;
|
|
198
|
+
_max?: Prisma.NestedEnumTwoFactorMethodTypeFilter<$PrismaModel>;
|
|
199
|
+
};
|
|
200
|
+
export type IntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
|
201
|
+
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null;
|
|
202
|
+
in?: number[] | null;
|
|
203
|
+
notIn?: number[] | null;
|
|
204
|
+
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
205
|
+
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
206
|
+
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
207
|
+
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
208
|
+
not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null;
|
|
209
|
+
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>;
|
|
210
|
+
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>;
|
|
211
|
+
_sum?: Prisma.NestedIntNullableFilter<$PrismaModel>;
|
|
212
|
+
_min?: Prisma.NestedIntNullableFilter<$PrismaModel>;
|
|
213
|
+
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>;
|
|
214
|
+
};
|
|
174
215
|
export type NestedIntFilter<$PrismaModel = never> = {
|
|
175
216
|
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
176
217
|
in?: number[];
|
|
@@ -343,3 +384,43 @@ export type NestedJsonFilterBase<$PrismaModel = never> = {
|
|
|
343
384
|
array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null;
|
|
344
385
|
not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter;
|
|
345
386
|
};
|
|
387
|
+
export type NestedEnumTwoFactorMethodTypeFilter<$PrismaModel = never> = {
|
|
388
|
+
equals?: $Enums.TwoFactorMethodType | Prisma.EnumTwoFactorMethodTypeFieldRefInput<$PrismaModel>;
|
|
389
|
+
in?: $Enums.TwoFactorMethodType[];
|
|
390
|
+
notIn?: $Enums.TwoFactorMethodType[];
|
|
391
|
+
not?: Prisma.NestedEnumTwoFactorMethodTypeFilter<$PrismaModel> | $Enums.TwoFactorMethodType;
|
|
392
|
+
};
|
|
393
|
+
export type NestedEnumTwoFactorMethodTypeWithAggregatesFilter<$PrismaModel = never> = {
|
|
394
|
+
equals?: $Enums.TwoFactorMethodType | Prisma.EnumTwoFactorMethodTypeFieldRefInput<$PrismaModel>;
|
|
395
|
+
in?: $Enums.TwoFactorMethodType[];
|
|
396
|
+
notIn?: $Enums.TwoFactorMethodType[];
|
|
397
|
+
not?: Prisma.NestedEnumTwoFactorMethodTypeWithAggregatesFilter<$PrismaModel> | $Enums.TwoFactorMethodType;
|
|
398
|
+
_count?: Prisma.NestedIntFilter<$PrismaModel>;
|
|
399
|
+
_min?: Prisma.NestedEnumTwoFactorMethodTypeFilter<$PrismaModel>;
|
|
400
|
+
_max?: Prisma.NestedEnumTwoFactorMethodTypeFilter<$PrismaModel>;
|
|
401
|
+
};
|
|
402
|
+
export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
|
403
|
+
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null;
|
|
404
|
+
in?: number[] | null;
|
|
405
|
+
notIn?: number[] | null;
|
|
406
|
+
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
407
|
+
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
408
|
+
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
409
|
+
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>;
|
|
410
|
+
not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null;
|
|
411
|
+
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>;
|
|
412
|
+
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>;
|
|
413
|
+
_sum?: Prisma.NestedIntNullableFilter<$PrismaModel>;
|
|
414
|
+
_min?: Prisma.NestedIntNullableFilter<$PrismaModel>;
|
|
415
|
+
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>;
|
|
416
|
+
};
|
|
417
|
+
export type NestedFloatNullableFilter<$PrismaModel = never> = {
|
|
418
|
+
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel> | null;
|
|
419
|
+
in?: number[] | null;
|
|
420
|
+
notIn?: number[] | null;
|
|
421
|
+
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>;
|
|
422
|
+
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>;
|
|
423
|
+
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>;
|
|
424
|
+
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>;
|
|
425
|
+
not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null;
|
|
426
|
+
};
|
package/prisma/client/enums.d.ts
CHANGED
package/prisma/client/enums.js
CHANGED
|
@@ -172,6 +172,28 @@ export interface PrismaClient<in LogOpts extends Prisma.LogLevel = never, in out
|
|
|
172
172
|
get role(): Prisma.RoleDelegate<ExtArgs, {
|
|
173
173
|
omit: OmitOpts;
|
|
174
174
|
}>;
|
|
175
|
+
/**
|
|
176
|
+
* `prisma.twoFactorMethod`: Exposes CRUD operations for the **TwoFactorMethod** model.
|
|
177
|
+
* Example usage:
|
|
178
|
+
* ```ts
|
|
179
|
+
* // Fetch zero or more TwoFactorMethods
|
|
180
|
+
* const twoFactorMethods = await prisma.twoFactorMethod.findMany()
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
get twoFactorMethod(): Prisma.TwoFactorMethodDelegate<ExtArgs, {
|
|
184
|
+
omit: OmitOpts;
|
|
185
|
+
}>;
|
|
186
|
+
/**
|
|
187
|
+
* `prisma.twoFactorRecoveryCode`: Exposes CRUD operations for the **TwoFactorRecoveryCode** model.
|
|
188
|
+
* Example usage:
|
|
189
|
+
* ```ts
|
|
190
|
+
* // Fetch zero or more TwoFactorRecoveryCodes
|
|
191
|
+
* const twoFactorRecoveryCodes = await prisma.twoFactorRecoveryCode.findMany()
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
get twoFactorRecoveryCode(): Prisma.TwoFactorRecoveryCodeDelegate<ExtArgs, {
|
|
195
|
+
omit: OmitOpts;
|
|
196
|
+
}>;
|
|
175
197
|
/**
|
|
176
198
|
* `prisma.seeder`: Exposes CRUD operations for the **Seeder** model.
|
|
177
199
|
* Example usage:
|