@rvoh/dream 2.2.3 → 2.3.0-alpha.2
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 +5 -5
- package/dist/cjs/src/db/dataTypes.js +1 -0
- package/dist/cjs/src/db/index.js +2 -2
- package/dist/cjs/src/dream/QueryDriver/Base.js +2 -2
- package/dist/cjs/src/dream/QueryDriver/Kysely.js +2 -2
- package/dist/cjs/src/dream/QueryDriver/helpers/kysely/checkForNeedToBeRunMigrations.js +2 -2
- package/dist/cjs/src/dream/QueryDriver/helpers/kysely/migrationFolderPath.js +6 -1
- package/dist/cjs/src/dream/QueryDriver/helpers/kysely/runMigration.js +2 -2
- package/dist/cjs/src/dream/internal/saveDream.js +1 -1
- package/dist/cjs/src/dream/internal/softDeleteDream.js +1 -1
- package/dist/cjs/src/dream-app/helpers/globalModelKeyFromPath.js +5 -2
- package/dist/cjs/src/dream-app/helpers/globalSerializerKeyFromPath.js +5 -2
- package/dist/cjs/src/dream-app/helpers/normalizeFilePath.js +3 -0
- package/dist/cjs/src/dream-app/index.js +3 -3
- package/dist/cjs/src/helpers/areEqual.js +2 -2
- package/dist/cjs/src/helpers/cli/ASTBuilder.js +2 -2
- package/dist/cjs/src/helpers/cloneDeepSafe.js +2 -2
- package/dist/cjs/src/helpers/customPgParsers.js +2 -2
- package/dist/cjs/src/helpers/loadRepl.js +2 -2
- package/dist/cjs/src/helpers/path/PathHelpers.js +27 -0
- package/dist/cjs/src/helpers/path/convertToFileURL.js +7 -0
- package/dist/cjs/src/helpers/path/windowsSafePath.js +22 -0
- package/dist/cjs/src/helpers/sortBy.js +2 -2
- package/dist/cjs/src/helpers/sqlAttributes.js +2 -2
- package/dist/cjs/src/helpers/stringCasing.js +2 -2
- package/dist/cjs/src/package-exports/errors.js +2 -1
- package/dist/cjs/src/package-exports/index.js +2 -2
- package/dist/cjs/src/package-exports/system.js +1 -0
- package/dist/cjs/src/serializer/SerializerRenderer.js +2 -2
- package/dist/cjs/src/types/calendardate.js +1 -0
- package/dist/cjs/src/types/datetime.js +1 -0
- package/dist/cjs/src/utils/datetime/CalendarDate.js +489 -0
- package/dist/cjs/src/utils/datetime/DateTime.js +1140 -0
- package/dist/cjs/src/utils/datetime/helpers/isoTimeDecimalString.js +8 -0
- package/dist/cjs/src/utils/datetime/helpers/microsecondParts.js +16 -0
- package/dist/cjs/src/utils/datetime/helpers/replaceISOMicroseconds.js +10 -0
- package/dist/esm/src/Dream.js +5 -5
- package/dist/esm/src/db/dataTypes.js +1 -0
- package/dist/esm/src/db/index.js +2 -2
- package/dist/esm/src/dream/QueryDriver/Base.js +2 -2
- package/dist/esm/src/dream/QueryDriver/Kysely.js +2 -2
- package/dist/esm/src/dream/QueryDriver/helpers/kysely/checkForNeedToBeRunMigrations.js +2 -2
- package/dist/esm/src/dream/QueryDriver/helpers/kysely/migrationFolderPath.js +6 -1
- package/dist/esm/src/dream/QueryDriver/helpers/kysely/runMigration.js +2 -2
- package/dist/esm/src/dream/internal/saveDream.js +1 -1
- package/dist/esm/src/dream/internal/softDeleteDream.js +1 -1
- package/dist/esm/src/dream-app/helpers/globalModelKeyFromPath.js +5 -2
- package/dist/esm/src/dream-app/helpers/globalSerializerKeyFromPath.js +5 -2
- package/dist/esm/src/dream-app/helpers/normalizeFilePath.js +3 -0
- package/dist/esm/src/dream-app/index.js +3 -3
- package/dist/esm/src/helpers/areEqual.js +2 -2
- package/dist/esm/src/helpers/cli/ASTBuilder.js +2 -2
- package/dist/esm/src/helpers/cloneDeepSafe.js +2 -2
- package/dist/esm/src/helpers/customPgParsers.js +2 -2
- package/dist/esm/src/helpers/loadRepl.js +2 -2
- package/dist/esm/src/helpers/path/PathHelpers.js +27 -0
- package/dist/esm/src/helpers/path/convertToFileURL.js +7 -0
- package/dist/esm/src/helpers/path/windowsSafePath.js +22 -0
- package/dist/esm/src/helpers/sortBy.js +2 -2
- package/dist/esm/src/helpers/sqlAttributes.js +2 -2
- package/dist/esm/src/helpers/stringCasing.js +2 -2
- package/dist/esm/src/package-exports/errors.js +2 -1
- package/dist/esm/src/package-exports/index.js +2 -2
- package/dist/esm/src/package-exports/system.js +1 -0
- package/dist/esm/src/serializer/SerializerRenderer.js +2 -2
- package/dist/esm/src/types/calendardate.js +1 -0
- package/dist/esm/src/types/datetime.js +1 -0
- package/dist/esm/src/utils/datetime/CalendarDate.js +489 -0
- package/dist/esm/src/utils/datetime/DateTime.js +1140 -0
- package/dist/esm/src/utils/datetime/helpers/isoTimeDecimalString.js +8 -0
- package/dist/esm/src/utils/datetime/helpers/microsecondParts.js +16 -0
- package/dist/esm/src/utils/datetime/helpers/replaceISOMicroseconds.js +10 -0
- package/dist/types/src/Dream.d.ts +1 -1
- package/dist/types/src/db/dataTypes.d.ts +2 -2
- package/dist/types/src/dream-app/helpers/normalizeFilePath.d.ts +1 -0
- package/dist/types/src/helpers/customPgParsers.d.ts +3 -2
- package/dist/types/src/helpers/path/PathHelpers.d.ts +21 -0
- package/dist/types/src/helpers/path/convertToFileURL.d.ts +1 -0
- package/dist/types/src/helpers/path/windowsSafePath.d.ts +20 -0
- package/dist/types/src/helpers/range.d.ts +2 -2
- package/dist/types/src/helpers/sort.d.ts +2 -2
- package/dist/types/src/helpers/sortBy.d.ts +2 -2
- package/dist/types/src/package-exports/errors.d.ts +2 -1
- package/dist/types/src/package-exports/index.d.ts +2 -2
- package/dist/types/src/package-exports/system.d.ts +1 -0
- package/dist/types/src/package-exports/types.d.ts +2 -0
- package/dist/types/src/types/associations/shared.d.ts +2 -2
- package/dist/types/src/types/associations/shared.ts +2 -2
- package/dist/types/src/types/calendardate.d.ts +4 -0
- package/dist/types/src/types/calendardate.ts +8 -0
- package/dist/types/src/types/datetime.d.ts +102 -0
- package/dist/types/src/types/datetime.ts +141 -0
- package/dist/types/src/types/dream.d.ts +2 -2
- package/dist/types/src/types/dream.ts +2 -2
- package/dist/types/src/types/moduleDeclarations/luxon.d.ts +5 -6
- package/dist/types/src/utils/datetime/CalendarDate.d.ts +375 -0
- package/dist/types/src/utils/datetime/DateTime.d.ts +773 -0
- package/dist/types/src/utils/datetime/helpers/isoTimeDecimalString.d.ts +4 -0
- package/dist/types/src/utils/datetime/helpers/microsecondParts.d.ts +10 -0
- package/dist/types/src/utils/datetime/helpers/replaceISOMicroseconds.d.ts +3 -0
- package/docs/assets/highlight.css +7 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/db.DreamMigrationHelpers.html +9 -9
- package/docs/classes/db.KyselyQueryDriver.html +33 -33
- package/docs/classes/db.PostgresQueryDriver.html +34 -34
- package/docs/classes/db.QueryDriverBase.html +32 -32
- 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 +7 -2
- package/docs/classes/errors.InvalidDateTime.html +17 -0
- 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 +195 -2
- package/docs/classes/index.DateTime.html +485 -0
- package/docs/classes/index.Decorators.html +19 -19
- package/docs/classes/index.Dream.html +121 -121
- 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 +59 -59
- 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/system.PathHelpers.html +13 -0
- 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 +2 -2
- 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.DurationObject.html +12 -0
- 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 +2 -1
- package/docs/modules/index.html +3 -4
- package/docs/modules/openapi.html +1 -1
- package/docs/modules/system.html +2 -1
- package/docs/modules/types.html +6 -2
- package/docs/modules/utils.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.CalendarDateDurationUnit.html +1 -0
- 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.DurationUnit.html +4 -0
- 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.WeekdayName.html +2 -0
- package/docs/types/types.WhereStatementForDream.html +1 -1
- package/docs/types/types.WhereStatementForDreamClass.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 +3 -2
- package/dist/cjs/src/helpers/CalendarDate.js +0 -151
- package/dist/cjs/src/helpers/DateTime.js +0 -4
- package/dist/esm/src/helpers/CalendarDate.js +0 -151
- package/dist/esm/src/helpers/DateTime.js +0 -4
- package/dist/types/src/helpers/CalendarDate.d.ts +0 -56
- package/dist/types/src/helpers/DateTime.d.ts +0 -6
- package/dist/types/src/types/luxon/_util.d.ts +0 -20
- package/dist/types/src/types/luxon/datetime.d.ts +0 -1759
- package/dist/types/src/types/luxon/duration.d.ts +0 -494
- package/dist/types/src/types/luxon/info.d.ts +0 -217
- package/dist/types/src/types/luxon/interval.d.ts +0 -357
- package/dist/types/src/types/luxon/misc.d.ts +0 -67
- package/dist/types/src/types/luxon/settings.d.ts +0 -91
- package/dist/types/src/types/luxon/zone.d.ts +0 -172
- package/docs/types/index.DateTime.html +0 -1
- package/docs/variables/index.DateTime-1.html +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default function isoTimeDecimalString(datetime, { nullIfZero }) {
|
|
2
|
+
const milliseconds = datetime.millisecond;
|
|
3
|
+
const microseconds = datetime.microsecond;
|
|
4
|
+
const totalMicroseconds = milliseconds * 1000 + microseconds;
|
|
5
|
+
if (totalMicroseconds === 0 && nullIfZero)
|
|
6
|
+
return null;
|
|
7
|
+
return totalMicroseconds.toString().padStart(6, '0');
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InvalidDateTime } from '../DateTime.js';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a microsecond value: values > 999 become whole milliseconds + remainder (0–999).
|
|
4
|
+
* Throws for negative.
|
|
5
|
+
*/
|
|
6
|
+
export function microsecondParts(microsecondInput, { errorIfNegative = true } = {}) {
|
|
7
|
+
if (errorIfNegative && microsecondInput < 0) {
|
|
8
|
+
throw new InvalidDateTime(new Error(`microsecond must be a non-negative integer, got: ${String(microsecondInput)}`));
|
|
9
|
+
}
|
|
10
|
+
const totalMicroseconds = Math.round(microsecondInput);
|
|
11
|
+
const milliseconds = Math.floor(totalMicroseconds / 1000);
|
|
12
|
+
return {
|
|
13
|
+
milliseconds,
|
|
14
|
+
microseconds: totalMicroseconds - milliseconds * 1000,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import isoTimeDecimalString from './isoTimeDecimalString.js';
|
|
2
|
+
export default function replaceISOMicroseconds(timeObj, isoString, opts) {
|
|
3
|
+
const decimalString = isoTimeDecimalString(timeObj, { nullIfZero: opts?.suppressMilliseconds });
|
|
4
|
+
if (decimalString === null)
|
|
5
|
+
return isoString;
|
|
6
|
+
// Match time in both ISO format (with T) and SQL format (with space)
|
|
7
|
+
// Matches: "T12:34:56.123" or " 12:34:56.123" or "12:34:56.123" at start
|
|
8
|
+
const regexp = /((?:^|T| )\d\d(?::\d\d){1,2})(?:\.\d+)?/;
|
|
9
|
+
return isoString.replace(regexp, '$1.' + decimalString);
|
|
10
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function dataTypes(): readonly ["bigint", "bigserial", "bit", "bit varying", "boolean", "box", "bytea", "character", "character varying", "char", "cidr", "circle", "citext", "date", "double precision", "inet", "integer", "interval", "json", "jsonb", "line", "lseg", "macaddr", "money", "numeric", "path", "point", "polygon", "real", "smallint", "smallserial", "serial", "text", "time", "time with time zone", "timestamp", "timestamp with time zone", "timestamp without time zone", "tsquery", "tsvector", "txid_snapshot", "uuid", "xml"];
|
|
1
|
+
export default function dataTypes(): readonly ["bigint", "bigserial", "bit", "bit varying", "boolean", "box", "bytea", "character", "character varying", "char", "cidr", "circle", "citext", "date", "double precision", "inet", "integer", "interval", "json", "jsonb", "line", "lseg", "macaddr", "money", "numeric", "path", "point", "polygon", "real", "smallint", "smallserial", "serial", "text", "time", "time with time zone", "time without time zone", "timestamp", "timestamp with time zone", "timestamp without time zone", "tsquery", "tsvector", "txid_snapshot", "uuid", "xml"];
|
|
2
2
|
export declare function isPrimitiveDataType(type: string): boolean;
|
|
3
|
-
export declare const postgresDatatypes: readonly ["bigint", "bigserial", "bit", "bit varying", "boolean", "box", "bytea", "character", "character varying", "char", "cidr", "circle", "citext", "date", "double precision", "inet", "integer", "interval", "json", "jsonb", "line", "lseg", "macaddr", "money", "numeric", "path", "point", "polygon", "real", "smallint", "smallserial", "serial", "text", "time", "time with time zone", "timestamp", "timestamp with time zone", "timestamp without time zone", "tsquery", "tsvector", "txid_snapshot", "uuid", "xml"];
|
|
3
|
+
export declare const postgresDatatypes: readonly ["bigint", "bigserial", "bit", "bit varying", "boolean", "box", "bytea", "character", "character varying", "char", "cidr", "circle", "citext", "date", "double precision", "inet", "integer", "interval", "json", "jsonb", "line", "lseg", "macaddr", "money", "numeric", "path", "point", "polygon", "real", "smallint", "smallserial", "serial", "text", "time", "time with time zone", "time without time zone", "timestamp", "timestamp with time zone", "timestamp without time zone", "tsquery", "tsvector", "txid_snapshot", "uuid", "xml"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function normalizeFilePath(filepath: string): string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
|
-
import CalendarDate from '
|
|
2
|
+
import CalendarDate from '../utils/datetime/CalendarDate.js';
|
|
3
|
+
import { DateTime } from '../utils/datetime/DateTime.js';
|
|
3
4
|
export declare function findEnumArrayOids(kyselyDb: Kysely<any>): Promise<number[]>;
|
|
4
5
|
export declare function findCitextArrayOid(kyselyDb: Kysely<any>): Promise<number | undefined>;
|
|
5
6
|
export declare function findCorrespondingArrayOid(kyselyDb: Kysely<any>, oid: number): Promise<number | undefined>;
|
|
6
7
|
export declare function parsePostgresDate(dateString: string | null): string | CalendarDate | null;
|
|
7
|
-
export declare function parsePostgresDatetime(datetimeString: string | null): string |
|
|
8
|
+
export declare function parsePostgresDatetime(datetimeString: string | null): string | DateTime | null;
|
|
8
9
|
export declare function parsePostgresDecimal(numberString: string | null): string | number | null;
|
|
9
10
|
export declare function parsePostgresBigint(numberString: string | null): string | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default class PathHelpers {
|
|
2
|
+
/**
|
|
3
|
+
* converts a filepath with windows path delimiters into a path with linux/unix path delimiters
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* PathHelpers.normalize("\My\Path\To\File.ts")
|
|
7
|
+
* // "/My/Path/To/File.ts"
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @param filepath - string
|
|
11
|
+
* @returns the same filepath, with any windows path delimiters replaced to their linux/unix counterparts
|
|
12
|
+
*/
|
|
13
|
+
static normalize(filepath: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* uses node's pathToFileURL to convert filepaths
|
|
16
|
+
*
|
|
17
|
+
* @param filepath - string
|
|
18
|
+
* @returns the filepath, converted using pathToFileURL, returning the href property
|
|
19
|
+
*/
|
|
20
|
+
static fileUrl(filepath: string): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function convertToFileURL(filepath: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
declare const windowsSafePath: {
|
|
3
|
+
join: (...paths: string[]) => string;
|
|
4
|
+
resolve: (...paths: string[]) => string;
|
|
5
|
+
normalize: (p: string) => string;
|
|
6
|
+
matchesGlob(path: string, pattern: string): boolean;
|
|
7
|
+
isAbsolute(path: string): boolean;
|
|
8
|
+
relative(from: string, to: string): string;
|
|
9
|
+
dirname(path: string): string;
|
|
10
|
+
basename(path: string, suffix?: string): string;
|
|
11
|
+
extname(path: string): string;
|
|
12
|
+
sep: "\\" | "/";
|
|
13
|
+
delimiter: ";" | ":";
|
|
14
|
+
parse(path: string): path.ParsedPath;
|
|
15
|
+
format(pathObject: path.FormatInputPathObject): string;
|
|
16
|
+
toNamespacedPath(path: string): string;
|
|
17
|
+
posix: path.PlatformPath;
|
|
18
|
+
win32: path.PlatformPath;
|
|
19
|
+
};
|
|
20
|
+
export default windowsSafePath;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CalendarDate from '
|
|
2
|
-
import { DateTime } from '
|
|
1
|
+
import CalendarDate from '../utils/datetime/CalendarDate.js';
|
|
2
|
+
import { DateTime } from '../utils/datetime/DateTime.js';
|
|
3
3
|
export default function range<T, U extends T extends null ? any : T extends DateTime | CalendarDate ? DateTime | CalendarDate : T>(begin: T, end?: U | null, excludeEnd?: boolean): Range<T, U>;
|
|
4
4
|
export declare class Range<T, U extends T extends null ? any : T extends DateTime | CalendarDate ? DateTime | CalendarDate : T = T extends null ? any : T extends DateTime | CalendarDate ? DateTime | CalendarDate : T> {
|
|
5
5
|
readonly begin: T | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CalendarDate from '
|
|
2
|
-
import { DateTime } from '
|
|
1
|
+
import CalendarDate from '../utils/datetime/CalendarDate.js';
|
|
2
|
+
import { DateTime } from '../utils/datetime/DateTime.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns a copy of array containing strings, numbers, bigints, sorted in ascending order.
|
|
5
5
|
* To sort other types use {@link sortBy}.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CalendarDate from '
|
|
2
|
-
import { DateTime } from '
|
|
1
|
+
import CalendarDate from '../utils/datetime/CalendarDate.js';
|
|
2
|
+
import { DateTime } from '../utils/datetime/DateTime.js';
|
|
3
3
|
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => number): T[];
|
|
4
4
|
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => bigint): T[];
|
|
5
5
|
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => string): T[];
|
|
@@ -10,4 +10,5 @@ export { default as GlobalNameNotSet } from '../errors/dream-app/GlobalNameNotSe
|
|
|
10
10
|
export { default as RecordNotFound } from '../errors/RecordNotFound.js';
|
|
11
11
|
export { default as MissingSerializersDefinition } from '../errors/serializers/MissingSerializersDefinition.js';
|
|
12
12
|
export { default as ValidationError } from '../errors/ValidationError.js';
|
|
13
|
-
export { InvalidCalendarDate } from '../
|
|
13
|
+
export { InvalidCalendarDate } from '../utils/datetime/CalendarDate.js';
|
|
14
|
+
export { InvalidDateTime } from '../utils/datetime/DateTime.js';
|
|
@@ -7,9 +7,9 @@ export { default as Dream } from '../Dream.js';
|
|
|
7
7
|
export { DreamConst } from '../dream/constants.js';
|
|
8
8
|
export { default as DreamTransaction } from '../dream/DreamTransaction.js';
|
|
9
9
|
export { default as Query } from '../dream/Query.js';
|
|
10
|
-
export { default as CalendarDate } from '../helpers/CalendarDate.js';
|
|
11
|
-
export { DateTime } from '../helpers/DateTime.js';
|
|
12
10
|
export { default as Env } from '../helpers/Env.js';
|
|
13
11
|
export { default as ops } from '../ops/index.js';
|
|
14
12
|
export { default as DreamSerializer } from '../serializer/DreamSerializer.js';
|
|
15
13
|
export { default as ObjectSerializer } from '../serializer/ObjectSerializer.js';
|
|
14
|
+
export { default as CalendarDate } from '../utils/datetime/CalendarDate.js';
|
|
15
|
+
export { DateTime } from '../utils/datetime/DateTime.js';
|
|
@@ -5,5 +5,6 @@ export { default as DreamImporter } from '../dream-app/helpers/DreamImporter.js'
|
|
|
5
5
|
export { DreamAppAllowedPackageManagersEnumValues, type DreamAppAllowedPackageManagersEnum, } from '../dream-app/index.js';
|
|
6
6
|
export { primaryKeyTypes } from '../dream/constants.js';
|
|
7
7
|
export { default as DreamLogos } from '../helpers/DreamLogos/DreamLogos.js';
|
|
8
|
+
export { default as PathHelpers } from '../helpers/path/PathHelpers.js';
|
|
8
9
|
export { default as DreamSerializerBuilder } from '../serializer/builders/DreamSerializerBuilder.js';
|
|
9
10
|
export { default as ObjectSerializerBuilder } from '../serializer/builders/ObjectSerializerBuilder.js';
|
|
@@ -8,6 +8,8 @@ export { type HasManyStatement } from '../types/associations/hasMany.js';
|
|
|
8
8
|
export { type HasOneStatement } from '../types/associations/hasOne.js';
|
|
9
9
|
export { type DbConnectionType, type DbTypes, type PrimaryKeyType } from '../types/db.js';
|
|
10
10
|
export { type StrictInterface } from '../types/utils.js';
|
|
11
|
+
export { type DurationObject, type DurationUnit, type WeekdayName } from '../types/datetime.js';
|
|
12
|
+
export { type CalendarDateDurationUnit } from '../types/calendardate.js';
|
|
11
13
|
export { type DreamAssociationMetadata, type DreamAttributes, type DreamClassAssociationAndStatement, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelClassSerializerKey, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializable, type DreamSerializableArray, type DreamSerializerKey, type DreamSerializers, type DreamVirtualColumns, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModel, type ViewModelClass, } from '../types/dream.js';
|
|
12
14
|
export { type DreamModelSerializerType, type InternalAnyTypedSerializerRendersMany, type InternalAnyTypedSerializerRendersOne, type SerializerCasing, type SimpleObjectSerializerType, } from '../types/serializer.js';
|
|
13
15
|
export { type ValidationType } from '../types/validation.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ComparisonOperatorExpression as KyselyComparisonOperatorExpression, Selectable, SelectQueryBuilder } from 'kysely';
|
|
2
2
|
import Dream from '../../Dream.js';
|
|
3
3
|
import { DreamConst } from '../../dream/constants.js';
|
|
4
|
-
import CalendarDate from '../../helpers/CalendarDate.js';
|
|
5
|
-
import { DateTime } from '../../helpers/DateTime.js';
|
|
6
4
|
import { Range } from '../../helpers/range.js';
|
|
7
5
|
import CurriedOpsStatement from '../../ops/curried-ops-statement.js';
|
|
8
6
|
import OpsStatement, { ExtraSimilarityArgs } from '../../ops/ops-statement.js';
|
|
7
|
+
import CalendarDate from '../../utils/datetime/CalendarDate.js';
|
|
8
|
+
import { DateTime } from '../../utils/datetime/DateTime.js';
|
|
9
9
|
import { AssociationTableNames } from '../db.js';
|
|
10
10
|
import { DefaultScopeName, DefaultScopeNameForTable, DreamBelongsToAssociationMetadata, DreamColumnNames, GlobalModelNameTableMap, ModelColumnType, OrderDir, TableColumnEnumTypeArray, TableColumnNames, TableColumnType, TableNameForGlobalModelName, TrigramOperator } from '../dream.js';
|
|
11
11
|
import { Inc, MergeUnionOfRecordTypes, ReadonlyTail, UnionToIntersection } from '../utils.js';
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
} from 'kysely'
|
|
6
6
|
import Dream from '../../Dream.js'
|
|
7
7
|
import { DreamConst } from '../../dream/constants.js'
|
|
8
|
-
import CalendarDate from '../../helpers/CalendarDate.js'
|
|
9
|
-
import { DateTime } from '../../helpers/DateTime.js'
|
|
10
8
|
import { Range } from '../../helpers/range.js'
|
|
11
9
|
import CurriedOpsStatement from '../../ops/curried-ops-statement.js'
|
|
12
10
|
import OpsStatement, { ExtraSimilarityArgs } from '../../ops/ops-statement.js'
|
|
11
|
+
import CalendarDate from '../../utils/datetime/CalendarDate.js'
|
|
12
|
+
import { DateTime } from '../../utils/datetime/DateTime.js'
|
|
13
13
|
import { AssociationTableNames } from '../db.js'
|
|
14
14
|
import {
|
|
15
15
|
DefaultScopeName,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DateTimeUnit, DurationLikeObject } from './datetime.js';
|
|
2
|
+
export type CalendarDateDurationLike = Pick<DurationLikeObject, 'year' | 'years' | 'quarter' | 'quarters' | 'month' | 'months' | 'week' | 'weeks' | 'day' | 'days'>;
|
|
3
|
+
export type CalendarDateDurationUnit = 'years' | 'quarters' | 'months' | 'weeks' | 'days';
|
|
4
|
+
export type CalendarDateUnit = Extract<DateTimeUnit, 'year' | 'quarter' | 'month' | 'week' | 'day'>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DateTimeUnit, DurationLikeObject } from './datetime.js'
|
|
2
|
+
|
|
3
|
+
export type CalendarDateDurationLike = Pick<
|
|
4
|
+
DurationLikeObject,
|
|
5
|
+
'year' | 'years' | 'quarter' | 'quarters' | 'month' | 'months' | 'week' | 'weeks' | 'day' | 'days'
|
|
6
|
+
>
|
|
7
|
+
export type CalendarDateDurationUnit = 'years' | 'quarters' | 'months' | 'weeks' | 'days'
|
|
8
|
+
export type CalendarDateUnit = Extract<DateTimeUnit, 'year' | 'quarter' | 'month' | 'week' | 'day'>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as luxon from 'luxon';
|
|
2
|
+
export interface DateTimeOptions {
|
|
3
|
+
zone?: string | Zone;
|
|
4
|
+
setZone?: boolean;
|
|
5
|
+
locale?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DateTimeJSOptions {
|
|
8
|
+
zone?: string | Zone | undefined;
|
|
9
|
+
locale?: string | undefined;
|
|
10
|
+
outputCalendar?: string | undefined;
|
|
11
|
+
numberingSystem?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface LocaleOptions {
|
|
14
|
+
locale?: string;
|
|
15
|
+
outputCalendar?: string;
|
|
16
|
+
numberingSystem?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DateTimeObject {
|
|
19
|
+
year?: number;
|
|
20
|
+
month?: number;
|
|
21
|
+
day?: number;
|
|
22
|
+
ordinal?: number;
|
|
23
|
+
weekYear?: number;
|
|
24
|
+
weekNumber?: number;
|
|
25
|
+
weekday?: number;
|
|
26
|
+
hour?: number;
|
|
27
|
+
minute?: number;
|
|
28
|
+
second?: number;
|
|
29
|
+
millisecond?: number;
|
|
30
|
+
microsecond?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ToISOTimeOptions {
|
|
33
|
+
suppressMilliseconds?: boolean;
|
|
34
|
+
suppressSeconds?: boolean;
|
|
35
|
+
includeOffset?: boolean;
|
|
36
|
+
includePrefix?: boolean;
|
|
37
|
+
format?: 'basic' | 'extended';
|
|
38
|
+
}
|
|
39
|
+
export interface ToSQLOptions {
|
|
40
|
+
includeZone?: boolean;
|
|
41
|
+
includeOffset?: boolean;
|
|
42
|
+
includeOffsetSpace?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface DateTimeFormatOptions {
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
export type DateTimeUnit = 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
48
|
+
/**
|
|
49
|
+
* Weekday name type (lowercase).
|
|
50
|
+
*/
|
|
51
|
+
export type WeekdayName = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
|
|
52
|
+
export type Zone = luxon.Zone;
|
|
53
|
+
/**
|
|
54
|
+
* Duration units that can be used in diff operations.
|
|
55
|
+
* Note: quarters and months are excluded because they don't have fixed relationships
|
|
56
|
+
* with other time units (months vary from 28-31 days).
|
|
57
|
+
*/
|
|
58
|
+
export type DurationUnit = 'years' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds' | 'microseconds';
|
|
59
|
+
/**
|
|
60
|
+
* Complete duration object with all possible units returned by diff.
|
|
61
|
+
* Note: quarters and months are excluded because they don't have fixed relationships
|
|
62
|
+
* with other time units (months vary from 28-31 days).
|
|
63
|
+
*/
|
|
64
|
+
export interface DurationObject {
|
|
65
|
+
years?: number;
|
|
66
|
+
weeks?: number;
|
|
67
|
+
days?: number;
|
|
68
|
+
hours?: number;
|
|
69
|
+
minutes?: number;
|
|
70
|
+
seconds?: number;
|
|
71
|
+
milliseconds?: number;
|
|
72
|
+
microseconds?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Helper type to extract only the units specified in the unit parameter.
|
|
76
|
+
* If unit is a single string, returns an object with just that key.
|
|
77
|
+
* If unit is an array, returns an object with keys for each unit in the array.
|
|
78
|
+
* If unit is undefined, returns the full DurationObject.
|
|
79
|
+
*/
|
|
80
|
+
export type DiffResult<U extends DurationUnit | readonly DurationUnit[] | undefined> = U extends undefined ? DurationObject : U extends DurationUnit ? Pick<Required<DurationObject>, U> : U extends readonly DurationUnit[] ? Pick<Required<DurationObject>, U[number]> : never;
|
|
81
|
+
export interface DurationLikeObject {
|
|
82
|
+
year?: number;
|
|
83
|
+
years?: number;
|
|
84
|
+
quarter?: number;
|
|
85
|
+
quarters?: number;
|
|
86
|
+
month?: number;
|
|
87
|
+
months?: number;
|
|
88
|
+
week?: number;
|
|
89
|
+
weeks?: number;
|
|
90
|
+
day?: number;
|
|
91
|
+
days?: number;
|
|
92
|
+
hour?: number;
|
|
93
|
+
hours?: number;
|
|
94
|
+
minute?: number;
|
|
95
|
+
minutes?: number;
|
|
96
|
+
second?: number;
|
|
97
|
+
seconds?: number;
|
|
98
|
+
millisecond?: number;
|
|
99
|
+
milliseconds?: number;
|
|
100
|
+
microsecond?: number;
|
|
101
|
+
microseconds?: number;
|
|
102
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as luxon from 'luxon'
|
|
2
|
+
|
|
3
|
+
// Export our own interfaces to avoid depending on Luxon types
|
|
4
|
+
|
|
5
|
+
export interface DateTimeOptions {
|
|
6
|
+
zone?: string | Zone
|
|
7
|
+
setZone?: boolean
|
|
8
|
+
locale?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface DateTimeJSOptions {
|
|
12
|
+
zone?: string | Zone | undefined
|
|
13
|
+
locale?: string | undefined
|
|
14
|
+
outputCalendar?: string | undefined
|
|
15
|
+
numberingSystem?: string | undefined
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LocaleOptions {
|
|
19
|
+
locale?: string
|
|
20
|
+
outputCalendar?: string
|
|
21
|
+
numberingSystem?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface DateTimeObject {
|
|
25
|
+
year?: number
|
|
26
|
+
month?: number
|
|
27
|
+
day?: number
|
|
28
|
+
ordinal?: number
|
|
29
|
+
weekYear?: number
|
|
30
|
+
weekNumber?: number
|
|
31
|
+
weekday?: number
|
|
32
|
+
hour?: number
|
|
33
|
+
minute?: number
|
|
34
|
+
second?: number
|
|
35
|
+
millisecond?: number
|
|
36
|
+
microsecond?: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ToISOTimeOptions {
|
|
40
|
+
suppressMilliseconds?: boolean
|
|
41
|
+
suppressSeconds?: boolean
|
|
42
|
+
includeOffset?: boolean
|
|
43
|
+
includePrefix?: boolean
|
|
44
|
+
format?: 'basic' | 'extended'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ToSQLOptions {
|
|
48
|
+
includeZone?: boolean
|
|
49
|
+
includeOffset?: boolean
|
|
50
|
+
includeOffsetSpace?: boolean
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface DateTimeFormatOptions {
|
|
54
|
+
[key: string]: unknown
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type DateTimeUnit =
|
|
58
|
+
| 'year'
|
|
59
|
+
| 'quarter'
|
|
60
|
+
| 'month'
|
|
61
|
+
| 'week'
|
|
62
|
+
| 'day'
|
|
63
|
+
| 'hour'
|
|
64
|
+
| 'minute'
|
|
65
|
+
| 'second'
|
|
66
|
+
| 'millisecond'
|
|
67
|
+
/**
|
|
68
|
+
* Weekday name type (lowercase).
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
export type WeekdayName = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday'
|
|
72
|
+
|
|
73
|
+
export type Zone = luxon.Zone
|
|
74
|
+
/**
|
|
75
|
+
* Duration units that can be used in diff operations.
|
|
76
|
+
* Note: quarters and months are excluded because they don't have fixed relationships
|
|
77
|
+
* with other time units (months vary from 28-31 days).
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
export type DurationUnit =
|
|
81
|
+
| 'years'
|
|
82
|
+
| 'weeks'
|
|
83
|
+
| 'days'
|
|
84
|
+
| 'hours'
|
|
85
|
+
| 'minutes'
|
|
86
|
+
| 'seconds'
|
|
87
|
+
| 'milliseconds'
|
|
88
|
+
| 'microseconds'
|
|
89
|
+
/**
|
|
90
|
+
* Complete duration object with all possible units returned by diff.
|
|
91
|
+
* Note: quarters and months are excluded because they don't have fixed relationships
|
|
92
|
+
* with other time units (months vary from 28-31 days).
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
export interface DurationObject {
|
|
96
|
+
years?: number
|
|
97
|
+
weeks?: number
|
|
98
|
+
days?: number
|
|
99
|
+
hours?: number
|
|
100
|
+
minutes?: number
|
|
101
|
+
seconds?: number
|
|
102
|
+
milliseconds?: number
|
|
103
|
+
microseconds?: number
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Helper type to extract only the units specified in the unit parameter.
|
|
107
|
+
* If unit is a single string, returns an object with just that key.
|
|
108
|
+
* If unit is an array, returns an object with keys for each unit in the array.
|
|
109
|
+
* If unit is undefined, returns the full DurationObject.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
export type DiffResult<U extends DurationUnit | readonly DurationUnit[] | undefined> = U extends undefined
|
|
113
|
+
? DurationObject
|
|
114
|
+
: U extends DurationUnit
|
|
115
|
+
? Pick<Required<DurationObject>, U>
|
|
116
|
+
: U extends readonly DurationUnit[]
|
|
117
|
+
? Pick<Required<DurationObject>, U[number]>
|
|
118
|
+
: never
|
|
119
|
+
|
|
120
|
+
export interface DurationLikeObject {
|
|
121
|
+
year?: number
|
|
122
|
+
years?: number
|
|
123
|
+
quarter?: number
|
|
124
|
+
quarters?: number
|
|
125
|
+
month?: number
|
|
126
|
+
months?: number
|
|
127
|
+
week?: number
|
|
128
|
+
weeks?: number
|
|
129
|
+
day?: number
|
|
130
|
+
days?: number
|
|
131
|
+
hour?: number
|
|
132
|
+
hours?: number
|
|
133
|
+
minute?: number
|
|
134
|
+
minutes?: number
|
|
135
|
+
second?: number
|
|
136
|
+
seconds?: number
|
|
137
|
+
millisecond?: number
|
|
138
|
+
milliseconds?: number
|
|
139
|
+
microsecond?: number
|
|
140
|
+
microseconds?: number
|
|
141
|
+
}
|
|
@@ -2,9 +2,9 @@ import { ColumnType, Updateable } from 'kysely';
|
|
|
2
2
|
import { STI_SCOPE_NAME } from '../decorators/class/STI.js';
|
|
3
3
|
import Dream from '../Dream.js';
|
|
4
4
|
import { TRIGRAM_OPERATORS } from '../dream/constants.js';
|
|
5
|
-
import CalendarDate from '../helpers/CalendarDate.js';
|
|
6
|
-
import { DateTime } from '../helpers/DateTime.js';
|
|
7
5
|
import OpsStatement from '../ops/ops-statement.js';
|
|
6
|
+
import CalendarDate from '../utils/datetime/CalendarDate.js';
|
|
7
|
+
import { DateTime } from '../utils/datetime/DateTime.js';
|
|
8
8
|
import { AssociatedModelParam, AssociationStatement, OnStatementForAssociation, WhereStatement } from './associations/shared.js';
|
|
9
9
|
import { AssociationTableNames } from './db.js';
|
|
10
10
|
import { FindEachOpts } from './query.js';
|
|
@@ -2,9 +2,9 @@ import { ColumnType, Updateable } from 'kysely'
|
|
|
2
2
|
import { STI_SCOPE_NAME } from '../decorators/class/STI.js'
|
|
3
3
|
import Dream from '../Dream.js'
|
|
4
4
|
import { TRIGRAM_OPERATORS } from '../dream/constants.js'
|
|
5
|
-
import CalendarDate from '../helpers/CalendarDate.js'
|
|
6
|
-
import { DateTime } from '../helpers/DateTime.js'
|
|
7
5
|
import OpsStatement from '../ops/ops-statement.js'
|
|
6
|
+
import CalendarDate from '../utils/datetime/CalendarDate.js'
|
|
7
|
+
import { DateTime } from '../utils/datetime/DateTime.js'
|
|
8
8
|
import {
|
|
9
9
|
AssociatedModelParam,
|
|
10
10
|
AssociationStatement,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import 'luxon'
|
|
2
|
+
|
|
1
3
|
declare module 'luxon' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const Interval: (typeof import('../luxon/interval.js'))['Interval']
|
|
6
|
-
const Settings: (typeof import('../luxon/settings.js'))['Settings']
|
|
7
|
-
const Zone: (typeof import('../luxon/zone.js'))['Zone']
|
|
4
|
+
interface TSSettings {
|
|
5
|
+
throwOnInvalid: true
|
|
6
|
+
}
|
|
8
7
|
}
|