@rvoh/dream 2.1.4 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/Dream.js +40 -2
- package/dist/cjs/src/dream/Query.js +132 -42
- package/dist/cjs/src/dream-app/index.js +4 -0
- package/dist/cjs/src/errors/dream-app/DreamAppInitMissingPackageManager.js +24 -0
- package/dist/esm/src/Dream.js +40 -2
- package/dist/esm/src/dream/Query.js +132 -42
- package/dist/esm/src/dream-app/index.js +4 -0
- package/dist/esm/src/errors/dream-app/DreamAppInitMissingPackageManager.js +24 -0
- package/dist/types/src/Dream.d.ts +40 -4
- package/dist/types/src/dream/Query.d.ts +45 -4
- package/dist/types/src/errors/dream-app/DreamAppInitMissingPackageManager.d.ts +4 -0
- package/dist/types/src/helpers/EnvInternal.d.ts +2 -2
- package/dist/types/src/types/query.d.ts +2 -2
- package/dist/types/src/types/query.ts +2 -2
- package/docs/assets/search.js +1 -1
- package/docs/classes/db.DreamMigrationHelpers.html +9 -9
- package/docs/classes/db.KyselyQueryDriver.html +32 -32
- package/docs/classes/db.PostgresQueryDriver.html +33 -33
- package/docs/classes/db.QueryDriverBase.html +31 -31
- package/docs/classes/errors.CheckConstraintViolation.html +3 -3
- package/docs/classes/errors.ColumnOverflow.html +3 -3
- package/docs/classes/errors.CreateOrFindByFailedToCreateAndFind.html +3 -3
- package/docs/classes/errors.DataIncompatibleWithDatabaseField.html +3 -3
- package/docs/classes/errors.DataTypeColumnTypeMismatch.html +3 -3
- package/docs/classes/errors.GlobalNameNotSet.html +3 -3
- package/docs/classes/errors.InvalidCalendarDate.html +2 -2
- package/docs/classes/errors.MissingSerializersDefinition.html +3 -3
- package/docs/classes/errors.NonLoadedAssociation.html +3 -3
- package/docs/classes/errors.NotNullViolation.html +3 -3
- package/docs/classes/errors.RecordNotFound.html +3 -3
- package/docs/classes/errors.ValidationError.html +3 -3
- package/docs/classes/index.CalendarDate.html +2 -2
- package/docs/classes/index.Decorators.html +19 -19
- package/docs/classes/index.Dream.html +208 -191
- package/docs/classes/index.DreamApp.html +5 -5
- package/docs/classes/index.DreamTransaction.html +2 -2
- package/docs/classes/index.Env.html +2 -2
- package/docs/classes/index.Query.html +87 -70
- package/docs/classes/system.CliFileWriter.html +2 -2
- package/docs/classes/system.DreamBin.html +2 -2
- package/docs/classes/system.DreamCLI.html +5 -5
- package/docs/classes/system.DreamImporter.html +2 -2
- package/docs/classes/system.DreamLogos.html +2 -2
- package/docs/classes/system.DreamSerializerBuilder.html +8 -8
- package/docs/classes/system.ObjectSerializerBuilder.html +8 -8
- package/docs/classes/utils.Encrypt.html +2 -2
- package/docs/classes/utils.Range.html +2 -2
- package/docs/functions/db.closeAllDbConnections.html +1 -1
- package/docs/functions/db.dreamDbConnections.html +1 -1
- package/docs/functions/db.untypedDb.html +1 -1
- package/docs/functions/db.validateColumn.html +1 -1
- package/docs/functions/db.validateTable.html +1 -1
- package/docs/functions/errors.pgErrorType.html +1 -1
- package/docs/functions/index.DreamSerializer.html +1 -1
- package/docs/functions/index.ObjectSerializer.html +1 -1
- package/docs/functions/index.ReplicaSafe.html +1 -1
- package/docs/functions/index.STI.html +1 -1
- package/docs/functions/index.SoftDelete.html +1 -1
- package/docs/functions/utils.camelize.html +1 -1
- package/docs/functions/utils.capitalize.html +1 -1
- package/docs/functions/utils.cloneDeepSafe.html +1 -1
- package/docs/functions/utils.compact.html +1 -1
- package/docs/functions/utils.groupBy.html +1 -1
- package/docs/functions/utils.hyphenize.html +1 -1
- package/docs/functions/utils.intersection.html +1 -1
- package/docs/functions/utils.isEmpty.html +1 -1
- package/docs/functions/utils.normalizeUnicode.html +1 -1
- package/docs/functions/utils.pascalize.html +1 -1
- package/docs/functions/utils.percent.html +1 -1
- package/docs/functions/utils.range-1.html +1 -1
- package/docs/functions/utils.round.html +1 -1
- package/docs/functions/utils.sanitizeString.html +1 -1
- package/docs/functions/utils.snakeify.html +1 -1
- package/docs/functions/utils.sort.html +1 -1
- package/docs/functions/utils.sortBy.html +1 -1
- package/docs/functions/utils.sortObjectByKey.html +1 -1
- package/docs/functions/utils.sortObjectByValue.html +1 -1
- package/docs/functions/utils.uncapitalize.html +1 -1
- package/docs/functions/utils.uniq.html +1 -1
- package/docs/interfaces/openapi.OpenapiDescription.html +2 -2
- package/docs/interfaces/openapi.OpenapiSchemaProperties.html +1 -1
- package/docs/interfaces/openapi.OpenapiSchemaPropertiesShorthand.html +1 -1
- package/docs/interfaces/openapi.OpenapiTypeFieldObject.html +1 -1
- package/docs/interfaces/types.BelongsToStatement.html +2 -2
- package/docs/interfaces/types.DecoratorContext.html +2 -2
- package/docs/interfaces/types.DreamAppInitOptions.html +2 -2
- package/docs/interfaces/types.DreamAppOpts.html +2 -2
- package/docs/interfaces/types.EncryptOptions.html +2 -2
- package/docs/interfaces/types.InternalAnyTypedSerializerRendersMany.html +2 -2
- package/docs/interfaces/types.InternalAnyTypedSerializerRendersOne.html +2 -2
- package/docs/interfaces/types.SerializerRendererOpts.html +2 -2
- package/docs/modules/db.html +1 -1
- package/docs/modules/errors.html +1 -1
- package/docs/modules/index.html +1 -1
- package/docs/modules/openapi.html +1 -1
- package/docs/modules/system.html +1 -1
- package/docs/modules/types.html +1 -1
- package/docs/modules/utils.html +1 -1
- package/docs/types/index.DateTime.html +1 -1
- package/docs/types/openapi.CommonOpenapiSchemaObjectFields.html +1 -1
- package/docs/types/openapi.OpenapiAllTypes.html +1 -1
- package/docs/types/openapi.OpenapiFormats.html +1 -1
- package/docs/types/openapi.OpenapiNumberFormats.html +1 -1
- package/docs/types/openapi.OpenapiPrimitiveBaseTypes.html +1 -1
- package/docs/types/openapi.OpenapiPrimitiveTypes.html +1 -1
- package/docs/types/openapi.OpenapiSchemaArray.html +1 -1
- package/docs/types/openapi.OpenapiSchemaArrayShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBase.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBody.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBodyShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaCommonFields.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaInteger.html +1 -1
- package/docs/types/openapi.OpenapiSchemaNull.html +1 -1
- package/docs/types/openapi.OpenapiSchemaNumber.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObject.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAllOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAnyOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectBase.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectBaseShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectOneOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaPrimitiveGeneric.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
- package/docs/types/openapi.OpenapiSchemaString.html +1 -1
- package/docs/types/openapi.OpenapiShorthandAllTypes.html +1 -1
- package/docs/types/openapi.OpenapiShorthandPrimitiveBaseTypes.html +1 -1
- package/docs/types/openapi.OpenapiShorthandPrimitiveTypes.html +1 -1
- package/docs/types/openapi.OpenapiTypeField.html +1 -1
- package/docs/types/system.DreamAppAllowedPackageManagersEnum.html +1 -1
- package/docs/types/types.Camelized.html +1 -1
- package/docs/types/types.DbConnectionType.html +1 -1
- package/docs/types/types.DbTypes.html +1 -1
- package/docs/types/types.DreamAssociationMetadata.html +1 -1
- package/docs/types/types.DreamAttributes.html +1 -1
- package/docs/types/types.DreamClassAssociationAndStatement.html +1 -1
- package/docs/types/types.DreamClassColumn.html +1 -1
- package/docs/types/types.DreamColumn.html +1 -1
- package/docs/types/types.DreamColumnNames.html +1 -1
- package/docs/types/types.DreamLogLevel.html +1 -1
- package/docs/types/types.DreamLogger.html +1 -1
- package/docs/types/types.DreamModelSerializerType.html +1 -1
- package/docs/types/types.DreamOrViewModelClassSerializerKey.html +1 -1
- package/docs/types/types.DreamOrViewModelSerializerKey.html +1 -1
- package/docs/types/types.DreamParamSafeAttributes.html +1 -1
- package/docs/types/types.DreamParamSafeColumnNames.html +1 -1
- package/docs/types/types.DreamSerializable.html +1 -1
- package/docs/types/types.DreamSerializableArray.html +1 -1
- package/docs/types/types.DreamSerializerKey.html +1 -1
- package/docs/types/types.DreamSerializers.html +1 -1
- package/docs/types/types.DreamVirtualColumns.html +1 -1
- package/docs/types/types.EncryptAlgorithm.html +1 -1
- package/docs/types/types.HasManyStatement.html +1 -1
- package/docs/types/types.HasOneStatement.html +1 -1
- package/docs/types/types.Hyphenized.html +1 -1
- package/docs/types/types.Pascalized.html +1 -1
- package/docs/types/types.PrimaryKeyType.html +1 -1
- package/docs/types/types.RoundingPrecision.html +1 -1
- package/docs/types/types.SerializerCasing.html +1 -1
- package/docs/types/types.SimpleObjectSerializerType.html +1 -1
- package/docs/types/types.Snakeified.html +1 -1
- package/docs/types/types.StrictInterface.html +1 -1
- package/docs/types/types.UpdateableAssociationProperties.html +1 -1
- package/docs/types/types.UpdateableProperties.html +1 -1
- package/docs/types/types.ValidationType.html +1 -1
- package/docs/types/types.ViewModel.html +1 -1
- package/docs/types/types.ViewModelClass.html +1 -1
- package/docs/types/types.WhereStatementForDream.html +1 -1
- package/docs/types/types.WhereStatementForDreamClass.html +1 -1
- package/docs/variables/index.DateTime-1.html +1 -1
- package/docs/variables/index.DreamConst.html +1 -1
- package/docs/variables/index.ops.html +1 -1
- package/docs/variables/openapi.openapiPrimitiveTypes-1.html +1 -1
- package/docs/variables/openapi.openapiShorthandPrimitiveTypes-1.html +1 -1
- package/docs/variables/system.DreamAppAllowedPackageManagersEnumValues.html +1 -1
- package/docs/variables/system.primaryKeyTypes.html +1 -1
- package/package.json +1 -1
package/dist/cjs/src/Dream.js
CHANGED
|
@@ -926,11 +926,15 @@ export default class Dream {
|
|
|
926
926
|
return await this.query().paginate(opts);
|
|
927
927
|
}
|
|
928
928
|
/**
|
|
929
|
-
*
|
|
929
|
+
* @deprecated Use {@link cursorPaginate} instead.
|
|
930
|
+
*
|
|
931
|
+
* Paginates the results of your query using cursor-based pagination,
|
|
930
932
|
* accepting a pageSize and cursor argument. This method
|
|
931
933
|
* provides better performance for large datasets by using cursor-based
|
|
932
934
|
* pagination instead of offset-based pagination.
|
|
933
935
|
*
|
|
936
|
+
* Default order is ascending primary key.
|
|
937
|
+
*
|
|
934
938
|
* ```ts
|
|
935
939
|
* // First page (using undefined to start from beginning)
|
|
936
940
|
* const firstPage = await User.scrollPaginate({ pageSize: 100, cursor: undefined })
|
|
@@ -947,7 +951,7 @@ export default class Dream {
|
|
|
947
951
|
* })
|
|
948
952
|
* ```
|
|
949
953
|
*
|
|
950
|
-
* @param opts -
|
|
954
|
+
* @param opts - scroll pagination options
|
|
951
955
|
* @param opts.pageSize - the number of results per page
|
|
952
956
|
* @param opts.cursor - identifier of where to start the next page; use undefined to start from the beginning
|
|
953
957
|
* @returns A fast pagination result object containing:
|
|
@@ -957,6 +961,40 @@ export default class Dream {
|
|
|
957
961
|
static async scrollPaginate(opts) {
|
|
958
962
|
return await this.query().scrollPaginate(opts);
|
|
959
963
|
}
|
|
964
|
+
/**
|
|
965
|
+
* Paginates the results of your query using cursor-based pagination,
|
|
966
|
+
* accepting a pageSize and cursor argument. This method
|
|
967
|
+
* provides better performance for large datasets by using cursor-based
|
|
968
|
+
* pagination instead of offset-based pagination.
|
|
969
|
+
*
|
|
970
|
+
* Default order is descending primary key.
|
|
971
|
+
*
|
|
972
|
+
* ```ts
|
|
973
|
+
* // First page (using undefined to start from beginning)
|
|
974
|
+
* const firstPage = await User.cursorPaginate({ pageSize: 100, cursor: undefined })
|
|
975
|
+
* firstPage.results
|
|
976
|
+
* // [ { User{id: 777}, User{id: 776}, ...}]
|
|
977
|
+
*
|
|
978
|
+
* firstPage.cursor
|
|
979
|
+
* // "100" (or null if no more pages)
|
|
980
|
+
*
|
|
981
|
+
* // Next page using cursor from previous result
|
|
982
|
+
* const nextPage = await User.cursorPaginate({
|
|
983
|
+
* pageSize: 100,
|
|
984
|
+
* cursor: firstPage.cursor
|
|
985
|
+
* })
|
|
986
|
+
* ```
|
|
987
|
+
*
|
|
988
|
+
* @param opts - cursor pagination options
|
|
989
|
+
* @param opts.pageSize - the number of results per page
|
|
990
|
+
* @param opts.cursor - identifier of where to start the next page; use undefined to start from the beginning
|
|
991
|
+
* @returns A fast pagination result object containing:
|
|
992
|
+
* - `cursor` - identifier for the next page, or null if no more pages
|
|
993
|
+
* - `results` - An array of records for the current page
|
|
994
|
+
*/
|
|
995
|
+
static async cursorPaginate(opts) {
|
|
996
|
+
return await this.query().cursorPaginate(opts);
|
|
997
|
+
}
|
|
960
998
|
/**
|
|
961
999
|
* Forces use of a database connection (e.g. 'primary') during the query.
|
|
962
1000
|
*
|
|
@@ -1225,7 +1225,7 @@ export default class Query {
|
|
|
1225
1225
|
const pageCount = Math.ceil(recordCount / pageSize);
|
|
1226
1226
|
const query = this.orderStatements.length
|
|
1227
1227
|
? this
|
|
1228
|
-
: this.order({ [this.namespacedPrimaryKey]: '
|
|
1228
|
+
: this.order({ [this.namespacedPrimaryKey]: 'desc' });
|
|
1229
1229
|
const results = await query
|
|
1230
1230
|
.limit(pageSize)
|
|
1231
1231
|
.offset(((page - 1) * pageSize))
|
|
@@ -1238,11 +1238,17 @@ export default class Query {
|
|
|
1238
1238
|
};
|
|
1239
1239
|
}
|
|
1240
1240
|
/**
|
|
1241
|
-
*
|
|
1241
|
+
* @deprecated Use {@link cursorPaginate} instead.
|
|
1242
|
+
*
|
|
1243
|
+
* Paginates the results of your query using cursor-based pagination,
|
|
1242
1244
|
* accepting a pageSize and cursor argument. This method
|
|
1243
1245
|
* provides better performance for large datasets by using cursor-based
|
|
1244
1246
|
* pagination instead of offset-based pagination.
|
|
1245
1247
|
*
|
|
1248
|
+
* Default order is ascending primary key. If an order has already been
|
|
1249
|
+
* set on the query, and it includes the primary key (e.g.: `id: 'asc'`),
|
|
1250
|
+
* then the implicit primary key ordering will be omitted.
|
|
1251
|
+
*
|
|
1246
1252
|
* ```ts
|
|
1247
1253
|
* // First page (using undefined to start from beginning)
|
|
1248
1254
|
* const firstPage = await User.order('email').scrollPaginate({ pageSize: 100, cursor: undefined })
|
|
@@ -1259,13 +1265,53 @@ export default class Query {
|
|
|
1259
1265
|
* })
|
|
1260
1266
|
* ```
|
|
1261
1267
|
*
|
|
1262
|
-
* @param opts -
|
|
1268
|
+
* @param opts - scroll pagination options
|
|
1263
1269
|
* @param opts.pageSize - the number of results per page (optional)
|
|
1264
1270
|
* @param opts.cursor - identifier of where to start the next page; undefined to start from the beginning; null when no more pages
|
|
1265
1271
|
* @returns results.cursor - identifier for the next page, or null if no more pages
|
|
1266
1272
|
* @returns results.results - An array of records for the current page
|
|
1267
1273
|
*/
|
|
1268
1274
|
async scrollPaginate(opts) {
|
|
1275
|
+
const orderIncludesPrimaryKey = this.orderStatements.some(orderStatement => orderStatement.column === this.dreamClass.primaryKey ||
|
|
1276
|
+
orderStatement.column === this.namespacedPrimaryKey);
|
|
1277
|
+
const query = orderIncludesPrimaryKey
|
|
1278
|
+
? this
|
|
1279
|
+
: this.order({ [this.namespacedPrimaryKey]: 'asc' });
|
|
1280
|
+
return await query.cursorPaginate(opts);
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Paginates the results of your query using cursor-based pagination,
|
|
1284
|
+
* accepting a pageSize and cursor argument. This method
|
|
1285
|
+
* provides better performance for large datasets by using cursor-based
|
|
1286
|
+
* pagination instead of offset-based pagination.
|
|
1287
|
+
*
|
|
1288
|
+
* Default order is descending primary key. If an order has already been
|
|
1289
|
+
* set on the query, and it includes the primary key (e.g.: `id: 'asc'`),
|
|
1290
|
+
* then the implicit primary key ordering will be omitted.
|
|
1291
|
+
*
|
|
1292
|
+
* ```ts
|
|
1293
|
+
* // First page (using undefined to start from beginning)
|
|
1294
|
+
* const firstPage = await User.order('email').cursorPaginate({ pageSize: 100, cursor: undefined })
|
|
1295
|
+
* firstPage.results
|
|
1296
|
+
* // [ { User{id: 777}, User{id: 776}, ...}]
|
|
1297
|
+
*
|
|
1298
|
+
* firstPage.cursor
|
|
1299
|
+
* // "100" (or null if no more pages)
|
|
1300
|
+
*
|
|
1301
|
+
* // Next page using cursor from previous result
|
|
1302
|
+
* const nextPage = await User.order('email').cursorPaginate({
|
|
1303
|
+
* pageSize: 100,
|
|
1304
|
+
* cursor: firstPage.cursor
|
|
1305
|
+
* })
|
|
1306
|
+
* ```
|
|
1307
|
+
*
|
|
1308
|
+
* @param opts - cursor pagination options
|
|
1309
|
+
* @param opts.pageSize - the number of results per page (optional)
|
|
1310
|
+
* @param opts.cursor - identifier of where to start the next page; undefined to start from the beginning; null when no more pages
|
|
1311
|
+
* @returns results.cursor - identifier for the next page, or null if no more pages
|
|
1312
|
+
* @returns results.results - An array of records for the current page
|
|
1313
|
+
*/
|
|
1314
|
+
async cursorPaginate(opts) {
|
|
1269
1315
|
const options = opts;
|
|
1270
1316
|
const pageSize = Math.max(0, options.pageSize ?? 0) || DreamApp.getOrFail().paginationPageSize;
|
|
1271
1317
|
if (options === null)
|
|
@@ -1280,53 +1326,97 @@ export default class Query {
|
|
|
1280
1326
|
orderStatement.column === this.namespacedPrimaryKey);
|
|
1281
1327
|
let query = orderIncludesPrimaryKey
|
|
1282
1328
|
? this
|
|
1283
|
-
: this.order({ [this.namespacedPrimaryKey]: '
|
|
1329
|
+
: this.order({ [this.namespacedPrimaryKey]: 'desc' });
|
|
1284
1330
|
if (options.cursor) {
|
|
1285
1331
|
const orderStatements = query.orderStatements;
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1332
|
+
if (orderStatements.length === 1) {
|
|
1333
|
+
/**
|
|
1334
|
+
* Since we add a primary key above if it wasn't already included, we know
|
|
1335
|
+
* that if there is only one order statement, then it must be ordering on
|
|
1336
|
+
* the primary key
|
|
1337
|
+
*/
|
|
1338
|
+
const orderStatement = orderStatements[0];
|
|
1339
|
+
switch (orderStatement.direction) {
|
|
1340
|
+
case 'asc':
|
|
1341
|
+
query = query.where({
|
|
1342
|
+
[orderStatement.column]: ops.greaterThan(options.cursor),
|
|
1343
|
+
});
|
|
1344
|
+
break;
|
|
1345
|
+
case 'desc':
|
|
1346
|
+
query = query.where({
|
|
1347
|
+
[orderStatement.column]: ops.lessThan(options.cursor),
|
|
1348
|
+
});
|
|
1349
|
+
break;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
else {
|
|
1353
|
+
const endOfPreviousPageComparisonValues = (await query
|
|
1293
1354
|
.removeDefaultScopeExceptOnAssociations(SOFT_DELETE_SCOPE_NAME)
|
|
1294
1355
|
.where({ [this.namespacedPrimaryKey]: options.cursor })
|
|
1295
1356
|
.limit(1)
|
|
1296
1357
|
.order(null)
|
|
1297
|
-
.pluck(...orderStatements.map(orderStatement => orderStatement.column)))[0]
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1358
|
+
.pluck(...orderStatements.map(orderStatement => orderStatement.column)))[0];
|
|
1359
|
+
if (endOfPreviousPageComparisonValues) {
|
|
1360
|
+
const whereAnyMaybeEqualArray = [];
|
|
1361
|
+
for (let index = 0; index < endOfPreviousPageComparisonValues.length; index++) {
|
|
1362
|
+
/**
|
|
1363
|
+
* This nested loop enables us to give priority to the left-most order clause,
|
|
1364
|
+
* then the left-most and next left-most, etc., replicating what ordering on
|
|
1365
|
+
* multiple clauses does:
|
|
1366
|
+
*
|
|
1367
|
+
* const results = await Pet.query()
|
|
1368
|
+
* .leftJoin('user')
|
|
1369
|
+
* // The primary key is implicitly added if not explicitly present, so these two
|
|
1370
|
+
* // order clauses appear in the query with an additional primary key clause.
|
|
1371
|
+
* // This supports pagination when the earlier order clauses match multiple records.
|
|
1372
|
+
* .order({ 'pets.name': 'asc', 'user.id': 'asc' })
|
|
1373
|
+
* .cursorPaginate({ pageSize: 2, cursor: undefined })
|
|
1374
|
+
*
|
|
1375
|
+
* Results in:
|
|
1376
|
+
*
|
|
1377
|
+
* SELECT
|
|
1378
|
+
* "pets".*
|
|
1379
|
+
* FROM
|
|
1380
|
+
* "pets"
|
|
1381
|
+
* LEFT JOIN "users" AS "user" ON "pets"."user_id" = "user"."id"
|
|
1382
|
+
* AND "user"."deleted_at" IS NULL
|
|
1383
|
+
* WHERE ("pets"."deleted_at" IS NULL
|
|
1384
|
+
* AND (
|
|
1385
|
+
* "pets"."name" > $1
|
|
1386
|
+
* OR (
|
|
1387
|
+
* "pets"."name" = $2 AND "user"."id" > $3
|
|
1388
|
+
* ) OR (
|
|
1389
|
+
* "pets"."name" = $4 AND "user"."id" = $5 AND "pets"."id" < $6
|
|
1390
|
+
* )))
|
|
1391
|
+
* ORDER BY
|
|
1392
|
+
* "pets"."name" ASC nulls FIRST,
|
|
1393
|
+
* "user"."id" ASC nulls FIRST,
|
|
1394
|
+
* "pets"."id" DESC nulls LAST
|
|
1395
|
+
* LIMIT $7
|
|
1396
|
+
*/
|
|
1397
|
+
const whereAnyMaybeEqual = {};
|
|
1398
|
+
whereAnyMaybeEqualArray.push(whereAnyMaybeEqual);
|
|
1399
|
+
for (let nestedIndex = 0; nestedIndex <= index; nestedIndex++) {
|
|
1400
|
+
const valueToCompare = endOfPreviousPageComparisonValues[nestedIndex];
|
|
1401
|
+
const orderStatement = orderStatements[nestedIndex];
|
|
1402
|
+
if (nestedIndex < index) {
|
|
1403
|
+
whereAnyMaybeEqual[orderStatement.column] = valueToCompare;
|
|
1404
|
+
}
|
|
1405
|
+
else if (nestedIndex === index) {
|
|
1406
|
+
switch (orderStatement.direction) {
|
|
1407
|
+
case 'asc':
|
|
1408
|
+
whereAnyMaybeEqual[orderStatement.column] = ops.greaterThan(valueToCompare);
|
|
1409
|
+
break;
|
|
1410
|
+
case 'desc':
|
|
1411
|
+
whereAnyMaybeEqual[orderStatement.column] = ops.lessThan(valueToCompare);
|
|
1412
|
+
break;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1327
1416
|
}
|
|
1417
|
+
query = query.whereAny(whereAnyMaybeEqualArray);
|
|
1328
1418
|
}
|
|
1329
|
-
}
|
|
1419
|
+
}
|
|
1330
1420
|
}
|
|
1331
1421
|
const results = await query.limit(pageSize).all();
|
|
1332
1422
|
return {
|
|
@@ -21,6 +21,7 @@ import { cacheDreamApp, getCachedDreamAppOrFail } from './cache.js';
|
|
|
21
21
|
import importModels, { getModelsOrFail } from './helpers/importers/importModels.js';
|
|
22
22
|
import importSerializers, { getSerializersOrFail, setCachedSerializers, } from './helpers/importers/importSerializers.js';
|
|
23
23
|
import lookupClassByGlobalName from './helpers/lookupClassByGlobalName.js';
|
|
24
|
+
import DreamAppInitMissingPackageManager from '../errors/dream-app/DreamAppInitMissingPackageManager.js';
|
|
24
25
|
// this needs to be done top-level to ensure proper configuration
|
|
25
26
|
Settings.defaultZone = 'UTC';
|
|
26
27
|
export default class DreamApp {
|
|
@@ -110,6 +111,9 @@ export default class DreamApp {
|
|
|
110
111
|
throw new DreamAppInitMissingCallToLoadModels();
|
|
111
112
|
if (this.encryption?.columns?.current)
|
|
112
113
|
DreamApp.checkKey('columns', this.encryption.columns.current.key, this.encryption.columns.current.algorithm);
|
|
114
|
+
if (!DreamAppAllowedPackageManagersEnumValues.includes(this.packageManager) &&
|
|
115
|
+
!EnvInternal.boolean('DREAM_BYPASS_PACKAGE_MANAGER_CHECK'))
|
|
116
|
+
throw new DreamAppInitMissingPackageManager();
|
|
113
117
|
if (!bypassDreamIntegrityChecks)
|
|
114
118
|
this.validateApplicationModels();
|
|
115
119
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default class DreamAppInitMissingPackageManager extends Error {
|
|
2
|
+
constructor() {
|
|
3
|
+
super();
|
|
4
|
+
}
|
|
5
|
+
get message() {
|
|
6
|
+
return `
|
|
7
|
+
must set packageManager when initializing a new DreamApp.
|
|
8
|
+
|
|
9
|
+
within conf/app.ts or conf/dream.ts, you must have a call to "#set('packageManager', '<YOUR_CHOSEN_PACKAGE_MANAGER>')", i.e.
|
|
10
|
+
|
|
11
|
+
// conf/app.ts
|
|
12
|
+
export default async (psy: PsychicApp) => {
|
|
13
|
+
psy.set('packageManager', 'pnpm')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
If you are in a dream-only app, this would be done in your dream conf:
|
|
17
|
+
|
|
18
|
+
// conf/dream.ts
|
|
19
|
+
export default async (dreamApp: DreamApp) => {
|
|
20
|
+
dreamApp.set('packageManager', 'pnpm')
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/esm/src/Dream.js
CHANGED
|
@@ -926,11 +926,15 @@ export default class Dream {
|
|
|
926
926
|
return await this.query().paginate(opts);
|
|
927
927
|
}
|
|
928
928
|
/**
|
|
929
|
-
*
|
|
929
|
+
* @deprecated Use {@link cursorPaginate} instead.
|
|
930
|
+
*
|
|
931
|
+
* Paginates the results of your query using cursor-based pagination,
|
|
930
932
|
* accepting a pageSize and cursor argument. This method
|
|
931
933
|
* provides better performance for large datasets by using cursor-based
|
|
932
934
|
* pagination instead of offset-based pagination.
|
|
933
935
|
*
|
|
936
|
+
* Default order is ascending primary key.
|
|
937
|
+
*
|
|
934
938
|
* ```ts
|
|
935
939
|
* // First page (using undefined to start from beginning)
|
|
936
940
|
* const firstPage = await User.scrollPaginate({ pageSize: 100, cursor: undefined })
|
|
@@ -947,7 +951,7 @@ export default class Dream {
|
|
|
947
951
|
* })
|
|
948
952
|
* ```
|
|
949
953
|
*
|
|
950
|
-
* @param opts -
|
|
954
|
+
* @param opts - scroll pagination options
|
|
951
955
|
* @param opts.pageSize - the number of results per page
|
|
952
956
|
* @param opts.cursor - identifier of where to start the next page; use undefined to start from the beginning
|
|
953
957
|
* @returns A fast pagination result object containing:
|
|
@@ -957,6 +961,40 @@ export default class Dream {
|
|
|
957
961
|
static async scrollPaginate(opts) {
|
|
958
962
|
return await this.query().scrollPaginate(opts);
|
|
959
963
|
}
|
|
964
|
+
/**
|
|
965
|
+
* Paginates the results of your query using cursor-based pagination,
|
|
966
|
+
* accepting a pageSize and cursor argument. This method
|
|
967
|
+
* provides better performance for large datasets by using cursor-based
|
|
968
|
+
* pagination instead of offset-based pagination.
|
|
969
|
+
*
|
|
970
|
+
* Default order is descending primary key.
|
|
971
|
+
*
|
|
972
|
+
* ```ts
|
|
973
|
+
* // First page (using undefined to start from beginning)
|
|
974
|
+
* const firstPage = await User.cursorPaginate({ pageSize: 100, cursor: undefined })
|
|
975
|
+
* firstPage.results
|
|
976
|
+
* // [ { User{id: 777}, User{id: 776}, ...}]
|
|
977
|
+
*
|
|
978
|
+
* firstPage.cursor
|
|
979
|
+
* // "100" (or null if no more pages)
|
|
980
|
+
*
|
|
981
|
+
* // Next page using cursor from previous result
|
|
982
|
+
* const nextPage = await User.cursorPaginate({
|
|
983
|
+
* pageSize: 100,
|
|
984
|
+
* cursor: firstPage.cursor
|
|
985
|
+
* })
|
|
986
|
+
* ```
|
|
987
|
+
*
|
|
988
|
+
* @param opts - cursor pagination options
|
|
989
|
+
* @param opts.pageSize - the number of results per page
|
|
990
|
+
* @param opts.cursor - identifier of where to start the next page; use undefined to start from the beginning
|
|
991
|
+
* @returns A fast pagination result object containing:
|
|
992
|
+
* - `cursor` - identifier for the next page, or null if no more pages
|
|
993
|
+
* - `results` - An array of records for the current page
|
|
994
|
+
*/
|
|
995
|
+
static async cursorPaginate(opts) {
|
|
996
|
+
return await this.query().cursorPaginate(opts);
|
|
997
|
+
}
|
|
960
998
|
/**
|
|
961
999
|
* Forces use of a database connection (e.g. 'primary') during the query.
|
|
962
1000
|
*
|
|
@@ -1225,7 +1225,7 @@ export default class Query {
|
|
|
1225
1225
|
const pageCount = Math.ceil(recordCount / pageSize);
|
|
1226
1226
|
const query = this.orderStatements.length
|
|
1227
1227
|
? this
|
|
1228
|
-
: this.order({ [this.namespacedPrimaryKey]: '
|
|
1228
|
+
: this.order({ [this.namespacedPrimaryKey]: 'desc' });
|
|
1229
1229
|
const results = await query
|
|
1230
1230
|
.limit(pageSize)
|
|
1231
1231
|
.offset(((page - 1) * pageSize))
|
|
@@ -1238,11 +1238,17 @@ export default class Query {
|
|
|
1238
1238
|
};
|
|
1239
1239
|
}
|
|
1240
1240
|
/**
|
|
1241
|
-
*
|
|
1241
|
+
* @deprecated Use {@link cursorPaginate} instead.
|
|
1242
|
+
*
|
|
1243
|
+
* Paginates the results of your query using cursor-based pagination,
|
|
1242
1244
|
* accepting a pageSize and cursor argument. This method
|
|
1243
1245
|
* provides better performance for large datasets by using cursor-based
|
|
1244
1246
|
* pagination instead of offset-based pagination.
|
|
1245
1247
|
*
|
|
1248
|
+
* Default order is ascending primary key. If an order has already been
|
|
1249
|
+
* set on the query, and it includes the primary key (e.g.: `id: 'asc'`),
|
|
1250
|
+
* then the implicit primary key ordering will be omitted.
|
|
1251
|
+
*
|
|
1246
1252
|
* ```ts
|
|
1247
1253
|
* // First page (using undefined to start from beginning)
|
|
1248
1254
|
* const firstPage = await User.order('email').scrollPaginate({ pageSize: 100, cursor: undefined })
|
|
@@ -1259,13 +1265,53 @@ export default class Query {
|
|
|
1259
1265
|
* })
|
|
1260
1266
|
* ```
|
|
1261
1267
|
*
|
|
1262
|
-
* @param opts -
|
|
1268
|
+
* @param opts - scroll pagination options
|
|
1263
1269
|
* @param opts.pageSize - the number of results per page (optional)
|
|
1264
1270
|
* @param opts.cursor - identifier of where to start the next page; undefined to start from the beginning; null when no more pages
|
|
1265
1271
|
* @returns results.cursor - identifier for the next page, or null if no more pages
|
|
1266
1272
|
* @returns results.results - An array of records for the current page
|
|
1267
1273
|
*/
|
|
1268
1274
|
async scrollPaginate(opts) {
|
|
1275
|
+
const orderIncludesPrimaryKey = this.orderStatements.some(orderStatement => orderStatement.column === this.dreamClass.primaryKey ||
|
|
1276
|
+
orderStatement.column === this.namespacedPrimaryKey);
|
|
1277
|
+
const query = orderIncludesPrimaryKey
|
|
1278
|
+
? this
|
|
1279
|
+
: this.order({ [this.namespacedPrimaryKey]: 'asc' });
|
|
1280
|
+
return await query.cursorPaginate(opts);
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Paginates the results of your query using cursor-based pagination,
|
|
1284
|
+
* accepting a pageSize and cursor argument. This method
|
|
1285
|
+
* provides better performance for large datasets by using cursor-based
|
|
1286
|
+
* pagination instead of offset-based pagination.
|
|
1287
|
+
*
|
|
1288
|
+
* Default order is descending primary key. If an order has already been
|
|
1289
|
+
* set on the query, and it includes the primary key (e.g.: `id: 'asc'`),
|
|
1290
|
+
* then the implicit primary key ordering will be omitted.
|
|
1291
|
+
*
|
|
1292
|
+
* ```ts
|
|
1293
|
+
* // First page (using undefined to start from beginning)
|
|
1294
|
+
* const firstPage = await User.order('email').cursorPaginate({ pageSize: 100, cursor: undefined })
|
|
1295
|
+
* firstPage.results
|
|
1296
|
+
* // [ { User{id: 777}, User{id: 776}, ...}]
|
|
1297
|
+
*
|
|
1298
|
+
* firstPage.cursor
|
|
1299
|
+
* // "100" (or null if no more pages)
|
|
1300
|
+
*
|
|
1301
|
+
* // Next page using cursor from previous result
|
|
1302
|
+
* const nextPage = await User.order('email').cursorPaginate({
|
|
1303
|
+
* pageSize: 100,
|
|
1304
|
+
* cursor: firstPage.cursor
|
|
1305
|
+
* })
|
|
1306
|
+
* ```
|
|
1307
|
+
*
|
|
1308
|
+
* @param opts - cursor pagination options
|
|
1309
|
+
* @param opts.pageSize - the number of results per page (optional)
|
|
1310
|
+
* @param opts.cursor - identifier of where to start the next page; undefined to start from the beginning; null when no more pages
|
|
1311
|
+
* @returns results.cursor - identifier for the next page, or null if no more pages
|
|
1312
|
+
* @returns results.results - An array of records for the current page
|
|
1313
|
+
*/
|
|
1314
|
+
async cursorPaginate(opts) {
|
|
1269
1315
|
const options = opts;
|
|
1270
1316
|
const pageSize = Math.max(0, options.pageSize ?? 0) || DreamApp.getOrFail().paginationPageSize;
|
|
1271
1317
|
if (options === null)
|
|
@@ -1280,53 +1326,97 @@ export default class Query {
|
|
|
1280
1326
|
orderStatement.column === this.namespacedPrimaryKey);
|
|
1281
1327
|
let query = orderIncludesPrimaryKey
|
|
1282
1328
|
? this
|
|
1283
|
-
: this.order({ [this.namespacedPrimaryKey]: '
|
|
1329
|
+
: this.order({ [this.namespacedPrimaryKey]: 'desc' });
|
|
1284
1330
|
if (options.cursor) {
|
|
1285
1331
|
const orderStatements = query.orderStatements;
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1332
|
+
if (orderStatements.length === 1) {
|
|
1333
|
+
/**
|
|
1334
|
+
* Since we add a primary key above if it wasn't already included, we know
|
|
1335
|
+
* that if there is only one order statement, then it must be ordering on
|
|
1336
|
+
* the primary key
|
|
1337
|
+
*/
|
|
1338
|
+
const orderStatement = orderStatements[0];
|
|
1339
|
+
switch (orderStatement.direction) {
|
|
1340
|
+
case 'asc':
|
|
1341
|
+
query = query.where({
|
|
1342
|
+
[orderStatement.column]: ops.greaterThan(options.cursor),
|
|
1343
|
+
});
|
|
1344
|
+
break;
|
|
1345
|
+
case 'desc':
|
|
1346
|
+
query = query.where({
|
|
1347
|
+
[orderStatement.column]: ops.lessThan(options.cursor),
|
|
1348
|
+
});
|
|
1349
|
+
break;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
else {
|
|
1353
|
+
const endOfPreviousPageComparisonValues = (await query
|
|
1293
1354
|
.removeDefaultScopeExceptOnAssociations(SOFT_DELETE_SCOPE_NAME)
|
|
1294
1355
|
.where({ [this.namespacedPrimaryKey]: options.cursor })
|
|
1295
1356
|
.limit(1)
|
|
1296
1357
|
.order(null)
|
|
1297
|
-
.pluck(...orderStatements.map(orderStatement => orderStatement.column)))[0]
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1358
|
+
.pluck(...orderStatements.map(orderStatement => orderStatement.column)))[0];
|
|
1359
|
+
if (endOfPreviousPageComparisonValues) {
|
|
1360
|
+
const whereAnyMaybeEqualArray = [];
|
|
1361
|
+
for (let index = 0; index < endOfPreviousPageComparisonValues.length; index++) {
|
|
1362
|
+
/**
|
|
1363
|
+
* This nested loop enables us to give priority to the left-most order clause,
|
|
1364
|
+
* then the left-most and next left-most, etc., replicating what ordering on
|
|
1365
|
+
* multiple clauses does:
|
|
1366
|
+
*
|
|
1367
|
+
* const results = await Pet.query()
|
|
1368
|
+
* .leftJoin('user')
|
|
1369
|
+
* // The primary key is implicitly added if not explicitly present, so these two
|
|
1370
|
+
* // order clauses appear in the query with an additional primary key clause.
|
|
1371
|
+
* // This supports pagination when the earlier order clauses match multiple records.
|
|
1372
|
+
* .order({ 'pets.name': 'asc', 'user.id': 'asc' })
|
|
1373
|
+
* .cursorPaginate({ pageSize: 2, cursor: undefined })
|
|
1374
|
+
*
|
|
1375
|
+
* Results in:
|
|
1376
|
+
*
|
|
1377
|
+
* SELECT
|
|
1378
|
+
* "pets".*
|
|
1379
|
+
* FROM
|
|
1380
|
+
* "pets"
|
|
1381
|
+
* LEFT JOIN "users" AS "user" ON "pets"."user_id" = "user"."id"
|
|
1382
|
+
* AND "user"."deleted_at" IS NULL
|
|
1383
|
+
* WHERE ("pets"."deleted_at" IS NULL
|
|
1384
|
+
* AND (
|
|
1385
|
+
* "pets"."name" > $1
|
|
1386
|
+
* OR (
|
|
1387
|
+
* "pets"."name" = $2 AND "user"."id" > $3
|
|
1388
|
+
* ) OR (
|
|
1389
|
+
* "pets"."name" = $4 AND "user"."id" = $5 AND "pets"."id" < $6
|
|
1390
|
+
* )))
|
|
1391
|
+
* ORDER BY
|
|
1392
|
+
* "pets"."name" ASC nulls FIRST,
|
|
1393
|
+
* "user"."id" ASC nulls FIRST,
|
|
1394
|
+
* "pets"."id" DESC nulls LAST
|
|
1395
|
+
* LIMIT $7
|
|
1396
|
+
*/
|
|
1397
|
+
const whereAnyMaybeEqual = {};
|
|
1398
|
+
whereAnyMaybeEqualArray.push(whereAnyMaybeEqual);
|
|
1399
|
+
for (let nestedIndex = 0; nestedIndex <= index; nestedIndex++) {
|
|
1400
|
+
const valueToCompare = endOfPreviousPageComparisonValues[nestedIndex];
|
|
1401
|
+
const orderStatement = orderStatements[nestedIndex];
|
|
1402
|
+
if (nestedIndex < index) {
|
|
1403
|
+
whereAnyMaybeEqual[orderStatement.column] = valueToCompare;
|
|
1404
|
+
}
|
|
1405
|
+
else if (nestedIndex === index) {
|
|
1406
|
+
switch (orderStatement.direction) {
|
|
1407
|
+
case 'asc':
|
|
1408
|
+
whereAnyMaybeEqual[orderStatement.column] = ops.greaterThan(valueToCompare);
|
|
1409
|
+
break;
|
|
1410
|
+
case 'desc':
|
|
1411
|
+
whereAnyMaybeEqual[orderStatement.column] = ops.lessThan(valueToCompare);
|
|
1412
|
+
break;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1327
1416
|
}
|
|
1417
|
+
query = query.whereAny(whereAnyMaybeEqualArray);
|
|
1328
1418
|
}
|
|
1329
|
-
}
|
|
1419
|
+
}
|
|
1330
1420
|
}
|
|
1331
1421
|
const results = await query.limit(pageSize).all();
|
|
1332
1422
|
return {
|
|
@@ -21,6 +21,7 @@ import { cacheDreamApp, getCachedDreamAppOrFail } from './cache.js';
|
|
|
21
21
|
import importModels, { getModelsOrFail } from './helpers/importers/importModels.js';
|
|
22
22
|
import importSerializers, { getSerializersOrFail, setCachedSerializers, } from './helpers/importers/importSerializers.js';
|
|
23
23
|
import lookupClassByGlobalName from './helpers/lookupClassByGlobalName.js';
|
|
24
|
+
import DreamAppInitMissingPackageManager from '../errors/dream-app/DreamAppInitMissingPackageManager.js';
|
|
24
25
|
// this needs to be done top-level to ensure proper configuration
|
|
25
26
|
Settings.defaultZone = 'UTC';
|
|
26
27
|
export default class DreamApp {
|
|
@@ -110,6 +111,9 @@ export default class DreamApp {
|
|
|
110
111
|
throw new DreamAppInitMissingCallToLoadModels();
|
|
111
112
|
if (this.encryption?.columns?.current)
|
|
112
113
|
DreamApp.checkKey('columns', this.encryption.columns.current.key, this.encryption.columns.current.algorithm);
|
|
114
|
+
if (!DreamAppAllowedPackageManagersEnumValues.includes(this.packageManager) &&
|
|
115
|
+
!EnvInternal.boolean('DREAM_BYPASS_PACKAGE_MANAGER_CHECK'))
|
|
116
|
+
throw new DreamAppInitMissingPackageManager();
|
|
113
117
|
if (!bypassDreamIntegrityChecks)
|
|
114
118
|
this.validateApplicationModels();
|
|
115
119
|
}
|