diff --git a/examples/servers/node-hono-sqlite/README.md b/examples/servers/node-hono-sqlite/README.md index 1ff69076..e2e5ae4b 100644 --- a/examples/servers/node-hono-sqlite/README.md +++ b/examples/servers/node-hono-sqlite/README.md @@ -31,7 +31,7 @@ enable it with: import { croner } from '@tinyrack/tinyauth-server/scheduler/croner'; await createApp({ - scheduler: croner({ cron: '0 2 * * *' }), + scheduler: croner({ cleanupCron: '0 2 * * *' }), }); ``` diff --git a/packages/homepage/src/content/docs/en/reference/configuration-schema.mdx b/packages/homepage/src/content/docs/en/reference/configuration-schema.mdx index fb41c6e6..b5ea5d22 100644 --- a/packages/homepage/src/content/docs/en/reference/configuration-schema.mdx +++ b/packages/homepage/src/content/docs/en/reference/configuration-schema.mdx @@ -77,6 +77,20 @@ Within each localized `content` item, `type` must be `link` or `text`. | `description` | `string` | `'OpenID Connect Provider API'` | OpenAPI document description. | | `ui_title` | `string` | `'TinyAuth API Reference'` | Browser page title for the live Scalar API reference UI. | +## `scheduler` + +| Field | Type | Default | Description | +|------|------|--------|------| +| `enabled` | `boolean` | `true` | Enables the internal scheduler. | +| `mode` | `'croner' \| 'database'` | `'croner'` | Scheduler backend. Use `database` for multi-instance lease-based execution. | +| `cleanup_cron` | `string` | `'0 2 * * *'` | Cron expression for built-in cleanup jobs. | +| `poll_interval_ms` | `number` | `5000` | Database scheduler polling interval in milliseconds. | +| `lock_ttl_ms` | `number` | `60000` | Database scheduler lease TTL in milliseconds. | +| `background_retry_delay_ms` | `number` | `1000` | Database scheduler retry delay for failed background jobs in milliseconds. | +| `background_max_attempts` | `integer` | `3` | Database scheduler maximum attempts before a background job is marked failed. | +| `background_retention_ms` | `number` | `604800000` | Retention for terminal background jobs (`succeeded`/`failed`) in milliseconds. Pending/running jobs are not deleted by this cleanup. | +| `instance_id` | `string` | generated | Database scheduler lease owner id. Leave empty to generate a unique per-process id. | + ## `frontend` | Field | Type | Default | Description | diff --git a/packages/homepage/src/content/docs/ko/configuration/scheduler.mdx b/packages/homepage/src/content/docs/ko/configuration/scheduler.mdx index 5a0036c6..a23b18be 100644 --- a/packages/homepage/src/content/docs/ko/configuration/scheduler.mdx +++ b/packages/homepage/src/content/docs/ko/configuration/scheduler.mdx @@ -13,14 +13,33 @@ description: Tinyauth의 데이터 정리 스케줄러 및 정리 정책 구성 # config.yaml scheduler: enabled: true - cron: '0 2 * * *' + mode: croner + cleanup_cron: '0 2 * * *' + # mode: database 를 사용할 때만 적용돼요. + poll_interval_ms: 5000 + lock_ttl_ms: 60000 + background_retry_delay_ms: 1000 + background_max_attempts: 3 + background_retention_ms: 604800000 + instance_id: '' ``` - `scheduler.enabled`: 내장 스케줄러를 활성화할지 여부예요. 기본값은 `true`예요. -- `scheduler.cron`: 정리 작업 실행 주기예요. 표준 5필드 cron 형식(`분 시 일 월 요일`)을 사용해요. 기본값은 `0 2 * * *`(매일 오전 2시)예요. +- `scheduler.mode`: 스케줄러 백엔드예요. `croner`는 단일 프로세스용 인메모리 스케줄러이고, `database`는 DB lease를 사용해 여러 인스턴스 중 하나만 작업을 획득하도록 하는 분산 스케줄러예요. 기본값은 `croner`예요. +- `scheduler.cleanup_cron`: 내장 정리 작업 실행 주기예요. 표준 5필드 cron 형식(`분 시 일 월 요일`)을 사용해요. 기본값은 `0 2 * * *`(매일 오전 2시)예요. +- `scheduler.poll_interval_ms`: `database` 모드에서 due job을 확인하는 주기예요. 기본값은 `5000`이에요. +- `scheduler.lock_ttl_ms`: `database` 모드에서 job lease가 유효한 시간이에요. 작업이 오래 걸리면 실행 중 lease가 자동 갱신돼요. 기본값은 `60000`이에요. +- `scheduler.background_retry_delay_ms`: `database` 모드에서 실패한 background job을 다시 실행하기 전 대기 시간이에요. 기본값은 `1000`이에요. +- `scheduler.background_max_attempts`: `database` 모드에서 background job을 최종 실패로 표시하기 전 최대 시도 횟수예요. 기본값은 `3`이에요. +- `scheduler.background_retention_ms`: `database` 모드에서 완료된 background job(`succeeded`/`failed`)을 보존하는 기간(ms)이에요. 기본값은 `604800000`(7일)이에요. `pending`/`running` job은 이 정리 정책으로 삭제하지 않아요. +- `scheduler.instance_id`: `database` 모드에서 lease 소유자를 식별하는 값이에요. 비워두면 프로세스마다 고유한 값이 자동 생성돼요. 직접 지정할 경우 replica/process마다 반드시 고유해야 해요. :::note -Kubernetes 환경에서는 내장 스케줄러 대신 CronJob을 사용하는 것이 좋아요. 이 경우 `scheduler.enabled: false`로 설정하고, 외부에서 `tinyauth cleanup` CLI 명령을 실행하세요. 자세한 내용은 [Kubernetes 배포 가이드](/ko/deployment/kubernetes)를 참고해 주세요. +Kubernetes 환경에서는 단일 실행 보장이 필요하면 `scheduler.mode: database`를 사용하거나, 내장 스케줄러 대신 CronJob을 사용하는 것이 좋아요. CronJob을 사용할 경우 `scheduler.enabled: false`로 설정하고 외부에서 `tinyauth cleanup` CLI 명령을 실행하세요. 자세한 내용은 [Kubernetes 배포 가이드](/ko/deployment/kubernetes)를 참고해 주세요. +::: + +:::caution +`database` 모드에서 모든 작업은 at-least-once 방식으로 실행돼요. lease가 만료되면 다른 인스턴스가 같은 작업을 다시 획득할 수 있으므로 scheduled/background job handler는 가능하면 멱등적으로 작성하세요. ::: --- @@ -128,7 +147,8 @@ account_deletion: scheduler: enabled: true - cron: '0 2 * * *' + mode: croner + cleanup_cron: '0 2 * * *' cleanup: revoked_tokens: diff --git a/packages/homepage/src/content/docs/ko/reference/configuration-schema.mdx b/packages/homepage/src/content/docs/ko/reference/configuration-schema.mdx index e4a6982c..39a3e251 100644 --- a/packages/homepage/src/content/docs/ko/reference/configuration-schema.mdx +++ b/packages/homepage/src/content/docs/ko/reference/configuration-schema.mdx @@ -203,7 +203,14 @@ description: 전체 config.yaml 스키마 레퍼런스 | 항목 | 유형 | 기본값 | 환경 변수 | 설명 | |------|------|--------|-----------|------| | `enabled` | `boolean` | `true` | `SCHEDULER_ENABLED` | 내장 스케줄러 활성화 | -| `cron` | `string` | `'0 2 * * *'` | `SCHEDULER_CRON` | cron 표현식 | +| `mode` | `'croner' \| 'database'` | `'croner'` | `SCHEDULER_MODE` | 스케줄러 백엔드 | +| `cleanup_cron` | `string` | `'0 2 * * *'` | `SCHEDULER_CLEANUP_CRON` | 정리 작업 cron 표현식 | +| `poll_interval_ms` | `number` | `5000` | `SCHEDULER_POLL_INTERVAL_MS` | `database` 모드 polling 주기(ms) | +| `lock_ttl_ms` | `number` | `60000` | `SCHEDULER_LOCK_TTL_MS` | `database` 모드 lease TTL(ms) | +| `background_retry_delay_ms` | `number` | `1000` | `SCHEDULER_BACKGROUND_RETRY_DELAY_MS` | `database` 모드 background job 재시도 대기 시간(ms) | +| `background_max_attempts` | `integer` | `3` | `SCHEDULER_BACKGROUND_MAX_ATTEMPTS` | `database` 모드 background job 최대 시도 횟수 | +| `background_retention_ms` | `number` | `604800000` | `SCHEDULER_BACKGROUND_RETENTION_MS` | 완료된 background job(`succeeded`/`failed`) 보존 기간(ms). `pending`/`running` job은 삭제하지 않음 | +| `instance_id` | `string` | 자동 생성 | `SCHEDULER_INSTANCE_ID` | `database` 모드 lease 소유자 식별자 | ## `cleanup` diff --git a/packages/server/package.json b/packages/server/package.json index 3682ec61..95786b64 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -43,6 +43,10 @@ "types": "./dist/entrypoints/scheduler/croner.d.ts", "default": "./dist/entrypoints/scheduler/croner.js" }, + "./scheduler/database": { + "types": "./dist/entrypoints/scheduler/database.d.ts", + "default": "./dist/entrypoints/scheduler/database.js" + }, "./identity-providers/github": { "types": "./dist/entrypoints/identity-providers/github.d.ts", "default": "./dist/entrypoints/identity-providers/github.js" @@ -117,6 +121,11 @@ "types": "./dist/entrypoints/scheduler/croner.d.ts", "default": "./dist/entrypoints/scheduler/croner.js" }, + "./scheduler/database": { + "@tinyauth/source": "./src/entrypoints/scheduler/database.ts", + "types": "./dist/entrypoints/scheduler/database.d.ts", + "default": "./dist/entrypoints/scheduler/database.js" + }, "./identity-providers/github": { "@tinyauth/source": "./src/entrypoints/identity-providers/github.ts", "types": "./dist/entrypoints/identity-providers/github.d.ts", diff --git a/packages/server/src/entities/background-job.entity.ts b/packages/server/src/entities/background-job.entity.ts new file mode 100644 index 00000000..d4b7e990 --- /dev/null +++ b/packages/server/src/entities/background-job.entity.ts @@ -0,0 +1,51 @@ +import { defineEntity, type InferEntity } from '@mikro-orm/core'; +import { BackgroundJobRepository } from '../repositories/background-job.repository.ts'; +import { BaseSchema } from './base.entity.ts'; + +export type BackgroundJobStatus = + | 'pending' + | 'running' + | 'succeeded' + | 'failed'; + +export const BackgroundJobEntitySchema = defineEntity({ + name: 'BackgroundJobEntity', + tableName: 'background_jobs', + comment: 'Durable background job queue', + extends: BaseSchema, + repository: () => BackgroundJobRepository, + properties: (p) => ({ + id: p.string().primary().comment('Stable background job execution id'), + jobId: p.string().comment('Registered background job identifier'), + payload: p.text().comment('Serialized JSON job payload'), + status: p.string().comment('Background job status').default('pending'), + availableAt: p.datetime().comment('Earliest time this job can run'), + lockedBy: p + .string() + .comment('Scheduler instance holding the lease') + .nullable(), + lockedUntil: p.datetime().comment('Lease expiration timestamp').nullable(), + attemptCount: p.integer().comment('Total run attempts').default(0), + maxAttempts: p.integer().comment('Maximum run attempts').default(3), + lastError: p.text().comment('Last failure message').nullable(), + completedAt: p.datetime().comment('Completion timestamp').nullable(), + }), + indexes: [ + { + name: 'background_jobs_status_available_at_idx', + properties: ['status', 'availableAt'], + }, + { + name: 'background_jobs_locked_until_idx', + properties: ['lockedUntil'], + }, + { + name: 'background_jobs_job_id_idx', + properties: ['jobId'], + }, + ], +}); + +export type IBackgroundJobEntity = InferEntity< + typeof BackgroundJobEntitySchema +>; diff --git a/packages/server/src/entities/scheduler-job.entity.ts b/packages/server/src/entities/scheduler-job.entity.ts new file mode 100644 index 00000000..3772f38a --- /dev/null +++ b/packages/server/src/entities/scheduler-job.entity.ts @@ -0,0 +1,50 @@ +import { defineEntity, type InferEntity } from '@mikro-orm/core'; +import { SchedulerJobRepository } from '../repositories/scheduler-job.repository.ts'; +import { BaseSchema } from './base.entity.ts'; + +export const SchedulerJobEntitySchema = defineEntity({ + name: 'SchedulerJobEntity', + tableName: 'scheduled_jobs', + comment: 'Persistent scheduler jobs and leases', + extends: BaseSchema, + repository: () => SchedulerJobRepository, + properties: (p) => ({ + id: p.string().primary().comment('Stable scheduler job identifier'), + name: p.string().comment('Human-readable scheduler job name'), + enabled: p + .boolean() + .comment('Whether the scheduler job is enabled') + .default(true), + cron: p.string().comment('Cron expression for the job schedule'), + nextRunAt: p.datetime().comment('Next scheduled run timestamp').nullable(), + lastRunAt: p.datetime().comment('Last run start timestamp').nullable(), + lastSuccessAt: p + .datetime() + .comment('Last successful completion timestamp') + .nullable(), + lastErrorAt: p + .datetime() + .comment('Last failed completion timestamp') + .nullable(), + lastError: p.text().comment('Last failure message').nullable(), + lockedBy: p + .string() + .comment('Scheduler instance holding the lease') + .nullable(), + lockedUntil: p.datetime().comment('Lease expiration timestamp').nullable(), + runCount: p.integer().comment('Total run attempts').default(0), + failureCount: p.integer().comment('Total failed run attempts').default(0), + }), + indexes: [ + { + name: 'scheduled_jobs_enabled_next_run_at_idx', + properties: ['enabled', 'nextRunAt'], + }, + { + name: 'scheduled_jobs_locked_until_idx', + properties: ['lockedUntil'], + }, + ], +}); + +export type ISchedulerJobEntity = InferEntity; diff --git a/packages/server/src/entrypoints/database/migrations.test.ts b/packages/server/src/entrypoints/database/migrations.test.ts index a42c23d0..431a052c 100644 --- a/packages/server/src/entrypoints/database/migrations.test.ts +++ b/packages/server/src/entrypoints/database/migrations.test.ts @@ -1,8 +1,10 @@ import { describe, expect, test } from 'vitest'; import { POSTGRES_MIGRATIONS } from '../../migrations/postgres/index.ts'; import { Migration20260509171036_initial as PostgresInitialMigration } from '../../migrations/postgres/Migration20260509171036_initial.ts'; +import { Migration20260512120000_add_scheduler_jobs as PostgresSchedulerJobsMigration } from '../../migrations/postgres/Migration20260512120000_add_scheduler_jobs.ts'; import { SQLITE_MIGRATIONS } from '../../migrations/sqlite/index.ts'; import { Migration20260509171226_initial as SqliteInitialMigration } from '../../migrations/sqlite/Migration20260509171226_initial.ts'; +import { Migration20260512120000_add_scheduler_jobs as SqliteSchedulerJobsMigration } from '../../migrations/sqlite/Migration20260512120000_add_scheduler_jobs.ts'; import { postgres } from './postgres/postgres.ts'; import { sqlite } from './sqlite/sqlite.ts'; @@ -16,7 +18,10 @@ describe('database migrations', () => { user: 'tinyauth', }).getMikroOrmOptions(); - expect(POSTGRES_MIGRATIONS).toEqual([PostgresInitialMigration]); + expect(POSTGRES_MIGRATIONS).toEqual([ + PostgresInitialMigration, + PostgresSchedulerJobsMigration, + ]); expect(options.migrations?.migrationsList).toBe(POSTGRES_MIGRATIONS); expect(options.migrations?.path).toBeUndefined(); expect(options.migrations?.pathTs).toBeUndefined(); @@ -47,7 +52,10 @@ describe('database migrations', () => { test: false, }).getMikroOrmOptions(); - expect(SQLITE_MIGRATIONS).toEqual([SqliteInitialMigration]); + expect(SQLITE_MIGRATIONS).toEqual([ + SqliteInitialMigration, + SqliteSchedulerJobsMigration, + ]); expect(options.migrations?.migrationsList).toBe(SQLITE_MIGRATIONS); expect(options.migrations?.path).toBeUndefined(); expect(options.migrations?.pathTs).toBeUndefined(); diff --git a/packages/server/src/entrypoints/database/postgres/compiled-functions.js b/packages/server/src/entrypoints/database/postgres/compiled-functions.js index 193e89b5..56d9b53b 100644 --- a/packages/server/src/entrypoints/database/postgres/compiled-functions.js +++ b/packages/server/src/entrypoints/database/postgres/compiled-functions.js @@ -1,6 +1,6 @@ export default { __version: '7.0.14', - 'hydrator-user_totp_recovery_code_5000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_3, user_4) { + 'hydrator-user_totp_recovery_code_6000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_3, user_4) { // compiled hydrator for entity UserTotpRecoveryCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -67,7 +67,7 @@ export default { } } }, - 'hydrator-user_totp_recovery_code_5000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_11, user_12) { + 'hydrator-user_totp_recovery_code_6000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_11, user_12) { // compiled hydrator for entity UserTotpRecoveryCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -134,100 +134,100 @@ export default { } } }, - 'comparator-user_totp_recovery_code_5000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_totp_recovery_code_6000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserTotpRecoveryCodeEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.code_hash === null && last.code_hash === undefined) { diff.code_hash = current.code_hash; } else if (current.code_hash == null && last.code_hash == null) { - + } else if ((current.code_hash != null && last.code_hash == null) || (current.code_hash == null && last.code_hash != null)) { diff.code_hash = current.code_hash; } else if (last.code_hash !== current.code_hash) { diff.code_hash = current.code_hash; } - + if (current.used === null && last.used === undefined) { diff.used = current.used; } else if (current.used == null && last.used == null) { - + } else if ((current.used != null && last.used == null) || (current.used == null && last.used != null)) { diff.used = current.used; } else if (!compareBooleans(last.used, current.used)) { diff.used = current.used; } - + if (current.used_at === null && last.used_at === undefined) { diff.used_at = current.used_at; } else if (current.used_at == null && last.used_at == null) { - + } else if ((current.used_at != null && last.used_at == null) || (current.used_at == null && last.used_at != null)) { diff.used_at = current.used_at; } else if (last.used_at.valueOf() !== current.used_at.valueOf()) { diff.used_at = current.used_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_totp_recovery_code_5000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-user_totp_recovery_code_6000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -237,23 +237,23 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.code_hash !== 'undefined') { ret.code_hash = entity.code_hash; } - + if (typeof entity.used !== 'undefined') { ret.used = entity.used; } - + if (typeof entity.used_at !== 'undefined') { ret.used_at = clone(processDateProperty(entity.used_at)); } - + return ret; } }, - 'resultMapper-user_totp_recovery_code_5000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_totp_recovery_code_6000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserTotpRecoveryCodeEntity return function(result) { const ret = {}; @@ -314,7 +314,7 @@ export default { return ret; } }, - 'hydrator-user_totp_recovery_code_5000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_totp_recovery_code_6000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTotpRecoveryCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -329,7 +329,7 @@ export default { } } }, - 'hydrator-user_totp_recovery_code_5000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_totp_recovery_code_6000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTotpRecoveryCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -344,26 +344,26 @@ export default { } } }, - 'pkGetter-user_totp_recovery_code_5000': function(isEntityOrRef) { + 'pkGetter-user_totp_recovery_code_6000': function(isEntityOrRef) { // compiled pk getter for entity UserTotpRecoveryCodeEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_totp_recovery_code_5000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_totp_recovery_code_6000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserTotpRecoveryCodeEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_totp_recovery_code_5000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_totp_recovery_code_6000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserTotpRecoveryCodeEntity return function(entity) { const val_0 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_0); } }, - 'hydrator-user_totp_4000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_21, user_22) { + 'hydrator-user_totp_5000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_21, user_22) { // compiled hydrator for entity UserTotpEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -424,7 +424,7 @@ export default { } } }, - 'hydrator-user_totp_4000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_29, user_30) { + 'hydrator-user_totp_5000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_29, user_30) { // compiled hydrator for entity UserTotpEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -485,100 +485,100 @@ export default { } } }, - 'comparator-user_totp_4000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_totp_5000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserTotpEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.secret === null && last.secret === undefined) { diff.secret = current.secret; } else if (current.secret == null && last.secret == null) { - + } else if ((current.secret != null && last.secret == null) || (current.secret == null && last.secret != null)) { diff.secret = current.secret; } else if (last.secret !== current.secret) { diff.secret = current.secret; } - + if (current.verified === null && last.verified === undefined) { diff.verified = current.verified; } else if (current.verified == null && last.verified == null) { - + } else if ((current.verified != null && last.verified == null) || (current.verified == null && last.verified != null)) { diff.verified = current.verified; } else if (!compareBooleans(last.verified, current.verified)) { diff.verified = current.verified; } - + if (current.recovery_confirmed === null && last.recovery_confirmed === undefined) { diff.recovery_confirmed = current.recovery_confirmed; } else if (current.recovery_confirmed == null && last.recovery_confirmed == null) { - + } else if ((current.recovery_confirmed != null && last.recovery_confirmed == null) || (current.recovery_confirmed == null && last.recovery_confirmed != null)) { diff.recovery_confirmed = current.recovery_confirmed; } else if (!compareBooleans(last.recovery_confirmed, current.recovery_confirmed)) { diff.recovery_confirmed = current.recovery_confirmed; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_totp_4000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-user_totp_5000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -588,23 +588,23 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.secret !== 'undefined') { ret.secret = entity.secret; } - + if (typeof entity.verified !== 'undefined') { ret.verified = entity.verified; } - + if (typeof entity.recovery_confirmed !== 'undefined') { ret.recovery_confirmed = entity.recovery_confirmed; } - + return ret; } }, - 'resultMapper-user_totp_4000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_totp_5000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserTotpEntity return function(result) { const ret = {}; @@ -657,7 +657,7 @@ export default { return ret; } }, - 'hydrator-user_totp_4000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_totp_5000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTotpEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -672,7 +672,7 @@ export default { } } }, - 'hydrator-user_totp_4000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_totp_5000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTotpEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -687,26 +687,26 @@ export default { } } }, - 'pkGetter-user_totp_4000': function(isEntityOrRef) { + 'pkGetter-user_totp_5000': function(isEntityOrRef) { // compiled pk getter for entity UserTotpEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_totp_4000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_totp_5000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserTotpEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_totp_4000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_totp_5000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserTotpEntity return function(entity) { const val_1 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_1); } }, - 'hydrator-user_terms_consent_16000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_39, user_40, terms_41, terms_42) { + 'hydrator-user_terms_consent_18000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_39, user_40, terms_41, terms_42) { // compiled hydrator for entity UserTermsConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -787,7 +787,7 @@ export default { } } }, - 'hydrator-user_terms_consent_16000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_50, user_51, terms_52, terms_53) { + 'hydrator-user_terms_consent_18000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_50, user_51, terms_52, terms_53) { // compiled hydrator for entity UserTermsConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -868,120 +868,120 @@ export default { } } }, - 'comparator-user_terms_consent_16000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_terms_consent_18000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserTermsConsentEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.terms === null && last.terms === undefined) { diff.terms = current.terms; } else if (current.terms == null && last.terms == null) { - + } else if ((current.terms != null && last.terms == null) || (current.terms == null && last.terms != null)) { diff.terms = current.terms; } else if (last.terms !== current.terms) { diff.terms = current.terms; } - + if (current.termsVersion === null && last.termsVersion === undefined) { diff.termsVersion = current.termsVersion; } else if (current.termsVersion == null && last.termsVersion == null) { - + } else if ((current.termsVersion != null && last.termsVersion == null) || (current.termsVersion == null && last.termsVersion != null)) { diff.termsVersion = current.termsVersion; } else if (last.termsVersion !== current.termsVersion) { diff.termsVersion = current.termsVersion; } - + if (current.agreed === null && last.agreed === undefined) { diff.agreed = current.agreed; } else if (current.agreed == null && last.agreed == null) { - + } else if ((current.agreed != null && last.agreed == null) || (current.agreed == null && last.agreed != null)) { diff.agreed = current.agreed; } else if (!compareBooleans(last.agreed, current.agreed)) { diff.agreed = current.agreed; } - + if (current.consentType === null && last.consentType === undefined) { diff.consentType = current.consentType; } else if (current.consentType == null && last.consentType == null) { - + } else if ((current.consentType != null && last.consentType == null) || (current.consentType == null && last.consentType != null)) { diff.consentType = current.consentType; } else if (last.consentType !== current.consentType) { diff.consentType = current.consentType; } - + if (current.agreedAt === null && last.agreedAt === undefined) { diff.agreedAt = current.agreedAt; } else if (current.agreedAt == null && last.agreedAt == null) { - + } else if ((current.agreedAt != null && last.agreedAt == null) || (current.agreedAt == null && last.agreedAt != null)) { diff.agreedAt = current.agreedAt; } else if (last.agreedAt.valueOf() !== current.agreedAt.valueOf()) { diff.agreedAt = current.agreedAt; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_terms_consent_16000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-user_terms_consent_18000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -991,7 +991,7 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.terms !== 'undefined') { if (entity.terms === null) { ret.terms = null; @@ -1001,27 +1001,27 @@ export default { ret.terms = toArray(entity.terms.__helper.getPrimaryKey(true)); } } - + if (typeof entity.termsVersion !== 'undefined') { ret.termsVersion = entity.termsVersion; } - + if (typeof entity.agreed !== 'undefined') { ret.agreed = entity.agreed; } - + if (typeof entity.consentType !== 'undefined') { ret.consentType = entity.consentType; } - + if (typeof entity.agreedAt !== 'undefined') { ret.agreedAt = clone(processDateProperty(entity.agreedAt)); } - + return ret; } }, - 'resultMapper-user_terms_consent_16000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_terms_consent_18000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserTermsConsentEntity return function(result) { const ret = {}; @@ -1090,7 +1090,7 @@ export default { return ret; } }, - 'hydrator-user_terms_consent_16000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_terms_consent_18000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTermsConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1105,7 +1105,7 @@ export default { } } }, - 'hydrator-user_terms_consent_16000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_terms_consent_18000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTermsConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1120,26 +1120,26 @@ export default { } } }, - 'pkGetter-user_terms_consent_16000': function(isEntityOrRef) { + 'pkGetter-user_terms_consent_18000': function(isEntityOrRef) { // compiled pk getter for entity UserTermsConsentEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_terms_consent_16000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_terms_consent_18000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserTermsConsentEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_terms_consent_16000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_terms_consent_18000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserTermsConsentEntity return function(entity) { const val_2 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_2); } }, - 'hydrator-user_passkey_3000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_63, user_64, convertToJSValue_transports, convertToDatabaseValue_transports) { + 'hydrator-user_passkey_4000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_63, user_64, convertToJSValue_transports, convertToDatabaseValue_transports) { // compiled hydrator for entity UserPasskeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1231,7 +1231,7 @@ export default { } } }, - 'hydrator-user_passkey_3000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_76, user_77, convertToJSValue_transports, convertToDatabaseValue_transports) { + 'hydrator-user_passkey_4000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_76, user_77, convertToJSValue_transports, convertToDatabaseValue_transports) { // compiled hydrator for entity UserPasskeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1323,150 +1323,150 @@ export default { } } }, - 'comparator-user_passkey_3000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_passkey_4000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserPasskeyEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.credential_id === null && last.credential_id === undefined) { diff.credential_id = current.credential_id; } else if (current.credential_id == null && last.credential_id == null) { - + } else if ((current.credential_id != null && last.credential_id == null) || (current.credential_id == null && last.credential_id != null)) { diff.credential_id = current.credential_id; } else if (last.credential_id !== current.credential_id) { diff.credential_id = current.credential_id; } - + if (current.public_key === null && last.public_key === undefined) { diff.public_key = current.public_key; } else if (current.public_key == null && last.public_key == null) { - + } else if ((current.public_key != null && last.public_key == null) || (current.public_key == null && last.public_key != null)) { diff.public_key = current.public_key; } else if (!equals(last.public_key, current.public_key)) { diff.public_key = current.public_key; } - + if (current.counter === null && last.counter === undefined) { diff.counter = current.counter; } else if (current.counter == null && last.counter == null) { - + } else if ((current.counter != null && last.counter == null) || (current.counter == null && last.counter != null)) { diff.counter = current.counter; } else if (!equals(last.counter, current.counter)) { diff.counter = current.counter; } - + if (current.device_type === null && last.device_type === undefined) { diff.device_type = current.device_type; } else if (current.device_type == null && last.device_type == null) { - + } else if ((current.device_type != null && last.device_type == null) || (current.device_type == null && last.device_type != null)) { diff.device_type = current.device_type; } else if (last.device_type !== current.device_type) { diff.device_type = current.device_type; } - + if (current.backed_up === null && last.backed_up === undefined) { diff.backed_up = current.backed_up; } else if (current.backed_up == null && last.backed_up == null) { - + } else if ((current.backed_up != null && last.backed_up == null) || (current.backed_up == null && last.backed_up != null)) { diff.backed_up = current.backed_up; } else if (!compareBooleans(last.backed_up, current.backed_up)) { diff.backed_up = current.backed_up; } - + if (current.transports === null && last.transports === undefined) { diff.transports = current.transports; } else if (current.transports == null && last.transports == null) { - + } else if ((current.transports != null && last.transports == null) || (current.transports == null && last.transports != null)) { diff.transports = current.transports; } else if (!equals(last.transports, current.transports)) { diff.transports = current.transports; } - + if (current.name === null && last.name === undefined) { diff.name = current.name; } else if (current.name == null && last.name == null) { - + } else if ((current.name != null && last.name == null) || (current.name == null && last.name != null)) { diff.name = current.name; } else if (last.name !== current.name) { diff.name = current.name; } - + if (current.aaguid === null && last.aaguid === undefined) { diff.aaguid = current.aaguid; } else if (current.aaguid == null && last.aaguid == null) { - + } else if ((current.aaguid != null && last.aaguid == null) || (current.aaguid == null && last.aaguid != null)) { diff.aaguid = current.aaguid; } else if (last.aaguid !== current.aaguid) { diff.aaguid = current.aaguid; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_passkey_3000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_transports) { + 'snapshotGenerator-user_passkey_4000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_transports) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -1476,43 +1476,43 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.credential_id !== 'undefined') { ret.credential_id = entity.credential_id; } - + if (typeof entity.public_key !== 'undefined') { ret.public_key = clone(entity.public_key); } - + if (typeof entity.counter !== 'undefined') { ret.counter = clone(entity.counter); } - + if (typeof entity.device_type !== 'undefined') { ret.device_type = entity.device_type; } - + if (typeof entity.backed_up !== 'undefined') { ret.backed_up = entity.backed_up; } - + if (typeof entity.transports !== 'undefined') { ret.transports = clone(convertToDatabaseValue_transports(entity.transports)); } - + if (typeof entity.name !== 'undefined') { ret.name = entity.name; } - + if (typeof entity.aaguid !== 'undefined') { ret.aaguid = entity.aaguid; } - + return ret; } }, - 'resultMapper-user_passkey_3000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_passkey_4000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserPasskeyEntity return function(result) { const ret = {}; @@ -1585,7 +1585,7 @@ export default { return ret; } }, - 'hydrator-user_passkey_3000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_passkey_4000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserPasskeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1600,7 +1600,7 @@ export default { } } }, - 'hydrator-user_passkey_3000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_passkey_4000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserPasskeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1615,26 +1615,26 @@ export default { } } }, - 'pkGetter-user_passkey_3000': function(isEntityOrRef) { + 'pkGetter-user_passkey_4000': function(isEntityOrRef) { // compiled pk getter for entity UserPasskeyEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_passkey_3000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_passkey_4000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserPasskeyEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_passkey_3000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_passkey_4000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserPasskeyEntity return function(entity) { const val_3 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_3); } }, - 'hydrator-user_oauth_2000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_91, user_92) { + 'hydrator-user_oauth_3000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_91, user_92) { // compiled hydrator for entity UserOAuthEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1712,7 +1712,7 @@ export default { } } }, - 'hydrator-user_oauth_2000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_101, user_102) { + 'hydrator-user_oauth_3000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_101, user_102) { // compiled hydrator for entity UserOAuthEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1790,120 +1790,120 @@ export default { } } }, - 'comparator-user_oauth_2000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals, compareValues_4) { + 'comparator-user_oauth_3000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals, compareValues_4) { // compiled comparator for entity UserOAuthEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (!compareValues_4(last.id, current.id)) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.provider_name === null && last.provider_name === undefined) { diff.provider_name = current.provider_name; } else if (current.provider_name == null && last.provider_name == null) { - + } else if ((current.provider_name != null && last.provider_name == null) || (current.provider_name == null && last.provider_name != null)) { diff.provider_name = current.provider_name; } else if (last.provider_name !== current.provider_name) { diff.provider_name = current.provider_name; } - + if (current.provider_user_id === null && last.provider_user_id === undefined) { diff.provider_user_id = current.provider_user_id; } else if (current.provider_user_id == null && last.provider_user_id == null) { - + } else if ((current.provider_user_id != null && last.provider_user_id == null) || (current.provider_user_id == null && last.provider_user_id != null)) { diff.provider_user_id = current.provider_user_id; } else if (last.provider_user_id !== current.provider_user_id) { diff.provider_user_id = current.provider_user_id; } - + if (current.access_token === null && last.access_token === undefined) { diff.access_token = current.access_token; } else if (current.access_token == null && last.access_token == null) { - + } else if ((current.access_token != null && last.access_token == null) || (current.access_token == null && last.access_token != null)) { diff.access_token = current.access_token; } else if (last.access_token !== current.access_token) { diff.access_token = current.access_token; } - + if (current.refresh_token === null && last.refresh_token === undefined) { diff.refresh_token = current.refresh_token; } else if (current.refresh_token == null && last.refresh_token == null) { - + } else if ((current.refresh_token != null && last.refresh_token == null) || (current.refresh_token == null && last.refresh_token != null)) { diff.refresh_token = current.refresh_token; } else if (last.refresh_token !== current.refresh_token) { diff.refresh_token = current.refresh_token; } - + if (current.expires_at === null && last.expires_at === undefined) { diff.expires_at = current.expires_at; } else if (current.expires_at == null && last.expires_at == null) { - + } else if ((current.expires_at != null && last.expires_at == null) || (current.expires_at == null && last.expires_at != null)) { diff.expires_at = current.expires_at; } else if (last.expires_at.valueOf() !== current.expires_at.valueOf()) { diff.expires_at = current.expires_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_oauth_2000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-user_oauth_3000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -1913,31 +1913,31 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.provider_name !== 'undefined') { ret.provider_name = entity.provider_name; } - + if (typeof entity.provider_user_id !== 'undefined') { ret.provider_user_id = entity.provider_user_id; } - + if (typeof entity.access_token !== 'undefined') { ret.access_token = entity.access_token; } - + if (typeof entity.refresh_token !== 'undefined') { ret.refresh_token = entity.refresh_token; } - + if (typeof entity.expires_at !== 'undefined') { ret.expires_at = clone(processDateProperty(entity.expires_at)); } - + return ret; } }, - 'resultMapper-user_oauth_2000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_oauth_3000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserOAuthEntity return function(result) { const ret = {}; @@ -2006,7 +2006,7 @@ export default { return ret; } }, - 'hydrator-user_oauth_2000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_oauth_3000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserOAuthEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -2022,7 +2022,7 @@ export default { } } }, - 'hydrator-user_oauth_2000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_oauth_3000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserOAuthEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -2038,26 +2038,26 @@ export default { } } }, - 'pkGetter-user_oauth_2000': function(isEntityOrRef) { + 'pkGetter-user_oauth_3000': function(isEntityOrRef) { // compiled pk getter for entity UserOAuthEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_oauth_2000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_oauth_3000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserOAuthEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_oauth_2000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_oauth_3000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserOAuthEntity return function(entity) { const val_5 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_5); } }, - 'hydrator-user_6000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, user_oauth_119, user_passkey_120, user_totp_121, user_totp_recovery_code_122) { + 'hydrator-user_7000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, user_oauth_119, user_passkey_120, user_totp_121, user_totp_recovery_code_122) { // compiled hydrator for entity UserEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.sub === null) { @@ -2213,7 +2213,7 @@ export default { } } }, - 'hydrator-user_6000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, user_oauth_132, user_passkey_133, user_totp_134, user_totp_recovery_code_135) { + 'hydrator-user_7000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, user_oauth_132, user_passkey_133, user_totp_134, user_totp_recovery_code_135) { // compiled hydrator for entity UserEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.sub === null) { @@ -2369,148 +2369,148 @@ export default { } } }, - 'comparator-user_6000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_7000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserEntity return function(last, current, options) { const diff = {}; if (current.sub === null && last.sub === undefined) { diff.sub = current.sub; } else if (current.sub == null && last.sub == null) { - + } else if ((current.sub != null && last.sub == null) || (current.sub == null && last.sub != null)) { diff.sub = current.sub; } else if (last.sub !== current.sub) { diff.sub = current.sub; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.email === null && last.email === undefined) { diff.email = current.email; } else if (current.email == null && last.email == null) { - + } else if ((current.email != null && last.email == null) || (current.email == null && last.email != null)) { diff.email = current.email; } else if (last.email !== current.email) { diff.email = current.email; } - + if (current.email_verified === null && last.email_verified === undefined) { diff.email_verified = current.email_verified; } else if (current.email_verified == null && last.email_verified == null) { - + } else if ((current.email_verified != null && last.email_verified == null) || (current.email_verified == null && last.email_verified != null)) { diff.email_verified = current.email_verified; } else if (!compareBooleans(last.email_verified, current.email_verified)) { diff.email_verified = current.email_verified; } - + if (current.password_hash === null && last.password_hash === undefined) { diff.password_hash = current.password_hash; } else if (current.password_hash == null && last.password_hash == null) { - + } else if ((current.password_hash != null && last.password_hash == null) || (current.password_hash == null && last.password_hash != null)) { diff.password_hash = current.password_hash; } else if (last.password_hash !== current.password_hash) { diff.password_hash = current.password_hash; } - + if (current.managed_by === null && last.managed_by === undefined) { diff.managed_by = current.managed_by; } else if (current.managed_by == null && last.managed_by == null) { - + } else if ((current.managed_by != null && last.managed_by == null) || (current.managed_by == null && last.managed_by != null)) { diff.managed_by = current.managed_by; } else if (last.managed_by !== current.managed_by) { diff.managed_by = current.managed_by; } - + if (current.role === null && last.role === undefined) { diff.role = current.role; } else if (current.role == null && last.role == null) { - + } else if ((current.role != null && last.role == null) || (current.role == null && last.role != null)) { diff.role = current.role; } else if (last.role !== current.role) { diff.role = current.role; } - + if (current.deleted_at === null && last.deleted_at === undefined) { diff.deleted_at = current.deleted_at; } else if (current.deleted_at == null && last.deleted_at == null) { - + } else if ((current.deleted_at != null && last.deleted_at == null) || (current.deleted_at == null && last.deleted_at != null)) { diff.deleted_at = current.deleted_at; } else if (last.deleted_at.valueOf() !== current.deleted_at.valueOf()) { diff.deleted_at = current.deleted_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_6000': function(clone, cloneEmbeddable, processDateProperty) { + 'snapshotGenerator-user_7000': function(clone, cloneEmbeddable, processDateProperty) { return function(entity) { const ret = {}; if (typeof entity.sub !== 'undefined') { ret.sub = entity.sub; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.email !== 'undefined') { ret.email = entity.email; } - + if (typeof entity.email_verified !== 'undefined') { ret.email_verified = entity.email_verified; } - + if (typeof entity.password_hash !== 'undefined') { ret.password_hash = entity.password_hash; } - + if (typeof entity.managed_by !== 'undefined') { ret.managed_by = entity.managed_by; } - + if (typeof entity.role !== 'undefined') { ret.role = entity.role; } - + if (typeof entity.deleted_at !== 'undefined') { ret.deleted_at = clone(processDateProperty(entity.deleted_at)); } - + return ret; } }, - 'resultMapper-user_6000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_7000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserEntity return function(result) { const ret = {}; @@ -2579,7 +2579,7 @@ export default { return ret; } }, - 'hydrator-user_6000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-user_7000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity UserEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.sub === null) { @@ -2589,7 +2589,7 @@ export default { } } }, - 'hydrator-user_6000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-user_7000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity UserEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.sub === null) { @@ -2599,25 +2599,25 @@ export default { } } }, - 'pkGetter-user_6000': function(isEntityOrRef) { + 'pkGetter-user_7000': function(isEntityOrRef) { // compiled pk getter for entity UserEntity return function(entity) { return entity.sub; } }, - 'pkGetterConverted-user_6000': function(isEntityOrRef) { + 'pkGetterConverted-user_7000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity UserEntity return function(entity) { return entity.sub; } }, - 'pkSerializer-user_6000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-user_7000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity UserEntity return function(entity) { return '' + entity.sub; } }, - 'hydrator-user_consent_11000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_141, user_142, oauth_client_143, oauth_client_144, convertToJSValue_scopes, convertToDatabaseValue_scopes) { + 'hydrator-user_consent_12000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_141, user_142, oauth_client_143, oauth_client_144, convertToJSValue_scopes, convertToDatabaseValue_scopes) { // compiled hydrator for entity UserConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -2705,7 +2705,7 @@ export default { } } }, - 'hydrator-user_consent_11000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_151, user_152, oauth_client_153, oauth_client_154, convertToJSValue_scopes, convertToDatabaseValue_scopes) { + 'hydrator-user_consent_12000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_151, user_152, oauth_client_153, oauth_client_154, convertToJSValue_scopes, convertToDatabaseValue_scopes) { // compiled hydrator for entity UserConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -2793,110 +2793,110 @@ export default { } } }, - 'comparator-user_consent_11000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_consent_12000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserConsentEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.client === null && last.client === undefined) { diff.client = current.client; } else if (current.client == null && last.client == null) { - + } else if ((current.client != null && last.client == null) || (current.client == null && last.client != null)) { diff.client = current.client; } else if (last.client !== current.client) { diff.client = current.client; } - + if (current.scopes === null && last.scopes === undefined) { diff.scopes = current.scopes; } else if (current.scopes == null && last.scopes == null) { - + } else if ((current.scopes != null && last.scopes == null) || (current.scopes == null && last.scopes != null)) { diff.scopes = current.scopes; } else if (!equals(last.scopes, current.scopes)) { diff.scopes = current.scopes; } - + if (current.granted_at === null && last.granted_at === undefined) { diff.granted_at = current.granted_at; } else if (current.granted_at == null && last.granted_at == null) { - + } else if ((current.granted_at != null && last.granted_at == null) || (current.granted_at == null && last.granted_at != null)) { diff.granted_at = current.granted_at; } else if (last.granted_at.valueOf() !== current.granted_at.valueOf()) { diff.granted_at = current.granted_at; } - + if (current.revoked_at === null && last.revoked_at === undefined) { diff.revoked_at = current.revoked_at; } else if (current.revoked_at == null && last.revoked_at == null) { - + } else if ((current.revoked_at != null && last.revoked_at == null) || (current.revoked_at == null && last.revoked_at != null)) { diff.revoked_at = current.revoked_at; } else if (last.revoked_at.valueOf() !== current.revoked_at.valueOf()) { diff.revoked_at = current.revoked_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_consent_11000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_scopes) { + 'snapshotGenerator-user_consent_12000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_scopes) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -2906,7 +2906,7 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.client !== 'undefined') { if (entity.client === null) { ret.client = null; @@ -2916,23 +2916,23 @@ export default { ret.client = toArray(entity.client.__helper.getPrimaryKey(true)); } } - + if (typeof entity.scopes !== 'undefined') { ret.scopes = clone(convertToDatabaseValue_scopes(entity.scopes)); } - + if (typeof entity.granted_at !== 'undefined') { ret.granted_at = clone(processDateProperty(entity.granted_at)); } - + if (typeof entity.revoked_at !== 'undefined') { ret.revoked_at = clone(processDateProperty(entity.revoked_at)); } - + return ret; } }, - 'resultMapper-user_consent_11000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_consent_12000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserConsentEntity return function(result) { const ret = {}; @@ -3005,7 +3005,7 @@ export default { return ret; } }, - 'hydrator-user_consent_11000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_consent_12000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3020,7 +3020,7 @@ export default { } } }, - 'hydrator-user_consent_11000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_consent_12000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3035,26 +3035,26 @@ export default { } } }, - 'pkGetter-user_consent_11000': function(isEntityOrRef) { + 'pkGetter-user_consent_12000': function(isEntityOrRef) { // compiled pk getter for entity UserConsentEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_consent_11000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_consent_12000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserConsentEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_consent_11000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_consent_12000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserConsentEntity return function(entity) { const val_6 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_6); } }, - 'hydrator-terms_17000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, terms_content_167, user_terms_consent_168) { + 'hydrator-terms_19000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, terms_content_167, user_terms_consent_168) { // compiled hydrator for entity TermsEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3150,7 +3150,7 @@ export default { } } }, - 'hydrator-terms_17000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, terms_content_176, user_terms_consent_177) { + 'hydrator-terms_19000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, terms_content_176, user_terms_consent_177) { // compiled hydrator for entity TermsEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3246,120 +3246,120 @@ export default { } } }, - 'comparator-terms_17000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-terms_19000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity TermsEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.required === null && last.required === undefined) { diff.required = current.required; } else if (current.required == null && last.required == null) { - + } else if ((current.required != null && last.required == null) || (current.required == null && last.required != null)) { diff.required = current.required; } else if (!compareBooleans(last.required, current.required)) { diff.required = current.required; } - + if (current.consentMode === null && last.consentMode === undefined) { diff.consentMode = current.consentMode; } else if (current.consentMode == null && last.consentMode == null) { - + } else if ((current.consentMode != null && last.consentMode == null) || (current.consentMode == null && last.consentMode != null)) { diff.consentMode = current.consentMode; } else if (last.consentMode !== current.consentMode) { diff.consentMode = current.consentMode; } - + if (current.version === null && last.version === undefined) { diff.version = current.version; } else if (current.version == null && last.version == null) { - + } else if ((current.version != null && last.version == null) || (current.version == null && last.version != null)) { diff.version = current.version; } else if (last.version !== current.version) { diff.version = current.version; } - + if (current.managed_by === null && last.managed_by === undefined) { diff.managed_by = current.managed_by; } else if (current.managed_by == null && last.managed_by == null) { - + } else if ((current.managed_by != null && last.managed_by == null) || (current.managed_by == null && last.managed_by != null)) { diff.managed_by = current.managed_by; } else if (last.managed_by !== current.managed_by) { diff.managed_by = current.managed_by; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-terms_17000': function(clone, cloneEmbeddable, processDateProperty) { + 'snapshotGenerator-terms_19000': function(clone, cloneEmbeddable, processDateProperty) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = entity.id; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.required !== 'undefined') { ret.required = entity.required; } - + if (typeof entity.consentMode !== 'undefined') { ret.consentMode = entity.consentMode; } - + if (typeof entity.version !== 'undefined') { ret.version = entity.version; } - + if (typeof entity.managed_by !== 'undefined') { ret.managed_by = entity.managed_by; } - + return ret; } }, - 'resultMapper-terms_17000': function(PolymorphicRef, parseDate) { + 'resultMapper-terms_19000': function(PolymorphicRef, parseDate) { // compiled mapper for entity TermsEntity return function(result) { const ret = {}; @@ -3412,7 +3412,7 @@ export default { return ret; } }, - 'hydrator-terms_17000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-terms_19000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity TermsEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3422,7 +3422,7 @@ export default { } } }, - 'hydrator-terms_17000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-terms_19000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity TermsEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3432,25 +3432,25 @@ export default { } } }, - 'pkGetter-terms_17000': function(isEntityOrRef) { + 'pkGetter-terms_19000': function(isEntityOrRef) { // compiled pk getter for entity TermsEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-terms_17000': function(isEntityOrRef) { + 'pkGetterConverted-terms_19000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity TermsEntity return function(entity) { return entity.id; } }, - 'pkSerializer-terms_17000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-terms_19000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity TermsEntity return function(entity) { return '' + entity.id; } }, - 'hydrator-terms_content_15000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, terms_183, terms_184) { + 'hydrator-terms_content_17000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, terms_183, terms_184) { // compiled hydrator for entity TermsContentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3516,7 +3516,7 @@ export default { } } }, - 'hydrator-terms_content_15000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, terms_192, terms_193) { + 'hydrator-terms_content_17000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, terms_192, terms_193) { // compiled hydrator for entity TermsContentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3582,110 +3582,110 @@ export default { } } }, - 'comparator-terms_content_15000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-terms_content_17000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity TermsContentEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.terms === null && last.terms === undefined) { diff.terms = current.terms; } else if (current.terms == null && last.terms == null) { - + } else if ((current.terms != null && last.terms == null) || (current.terms == null && last.terms != null)) { diff.terms = current.terms; } else if (last.terms !== current.terms) { diff.terms = current.terms; } - + if (current.lang === null && last.lang === undefined) { diff.lang = current.lang; } else if (current.lang == null && last.lang == null) { - + } else if ((current.lang != null && last.lang == null) || (current.lang == null && last.lang != null)) { diff.lang = current.lang; } else if (last.lang !== current.lang) { diff.lang = current.lang; } - + if (current.title === null && last.title === undefined) { diff.title = current.title; } else if (current.title == null && last.title == null) { - + } else if ((current.title != null && last.title == null) || (current.title == null && last.title != null)) { diff.title = current.title; } else if (last.title !== current.title) { diff.title = current.title; } - + if (current.type === null && last.type === undefined) { diff.type = current.type; } else if (current.type == null && last.type == null) { - + } else if ((current.type != null && last.type == null) || (current.type == null && last.type != null)) { diff.type = current.type; } else if (last.type !== current.type) { diff.type = current.type; } - + if (current.content === null && last.content === undefined) { diff.content = current.content; } else if (current.content == null && last.content == null) { - + } else if ((current.content != null && last.content == null) || (current.content == null && last.content != null)) { diff.content = current.content; } else if (!equals(last.content, current.content)) { diff.content = current.content; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-terms_content_15000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-terms_content_17000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.terms !== 'undefined') { if (entity.terms === null) { ret.terms = null; @@ -3695,27 +3695,27 @@ export default { ret.terms = toArray(entity.terms.__helper.getPrimaryKey(true)); } } - + if (typeof entity.lang !== 'undefined') { ret.lang = entity.lang; } - + if (typeof entity.title !== 'undefined') { ret.title = entity.title; } - + if (typeof entity.type !== 'undefined') { ret.type = entity.type; } - + if (typeof entity.content !== 'undefined') { ret.content = clone(entity.content); } - + return ret; } }, - 'resultMapper-terms_content_15000': function(PolymorphicRef, parseDate) { + 'resultMapper-terms_content_17000': function(PolymorphicRef, parseDate) { // compiled mapper for entity TermsContentEntity return function(result) { const ret = {}; @@ -3772,7 +3772,7 @@ export default { return ret; } }, - 'hydrator-terms_content_15000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-terms_content_17000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity TermsContentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3787,7 +3787,7 @@ export default { } } }, - 'hydrator-terms_content_15000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-terms_content_17000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity TermsContentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3802,26 +3802,658 @@ export default { } } }, - 'pkGetter-terms_content_15000': function(isEntityOrRef) { + 'pkGetter-terms_content_17000': function(isEntityOrRef) { // compiled pk getter for entity TermsContentEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-terms_content_15000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-terms_content_17000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity TermsContentEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-terms_content_15000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-terms_content_17000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity TermsContentEntity return function(entity) { const val_7 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_7); } }, - 'hydrator-revoked_tokens_10000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_205, oauth_client_206, user_207, user_208) { + 'hydrator-scheduled_jobs_16000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity SchedulerJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + if (data.created_at === null) { + entity.created_at = null; + } else if (typeof data.created_at !== 'undefined') { + if (data.created_at instanceof Date) { + entity.created_at = data.created_at; + } else if (typeof data.created_at === 'number' || data.created_at.includes('+') || data.created_at.lastIndexOf('-') > 10 || data.created_at.endsWith('Z')) { + entity.created_at = new Date(data.created_at); + } else { + entity.created_at = new Date(data.created_at + 'Z'); + } + } + if (data.updated_at === null) { + entity.updated_at = null; + } else if (typeof data.updated_at !== 'undefined') { + if (data.updated_at instanceof Date) { + entity.updated_at = data.updated_at; + } else if (typeof data.updated_at === 'number' || data.updated_at.includes('+') || data.updated_at.lastIndexOf('-') > 10 || data.updated_at.endsWith('Z')) { + entity.updated_at = new Date(data.updated_at); + } else { + entity.updated_at = new Date(data.updated_at + 'Z'); + } + } + if (data.name === null) { + entity.name = null; + } else if (typeof data.name !== 'undefined') { + entity.name = data.name; + } + if (data.enabled === null) { + entity.enabled = null; + } else if (typeof data.enabled !== 'undefined') { + entity.enabled = !!data.enabled; + } + if (data.cron === null) { + entity.cron = null; + } else if (typeof data.cron !== 'undefined') { + entity.cron = data.cron; + } + if (data.nextRunAt === null) { + entity.nextRunAt = null; + } else if (typeof data.nextRunAt !== 'undefined') { + if (data.nextRunAt instanceof Date) { + entity.nextRunAt = data.nextRunAt; + } else if (typeof data.nextRunAt === 'number' || data.nextRunAt.includes('+') || data.nextRunAt.lastIndexOf('-') > 10 || data.nextRunAt.endsWith('Z')) { + entity.nextRunAt = new Date(data.nextRunAt); + } else { + entity.nextRunAt = new Date(data.nextRunAt + 'Z'); + } + } + if (data.lastRunAt === null) { + entity.lastRunAt = null; + } else if (typeof data.lastRunAt !== 'undefined') { + if (data.lastRunAt instanceof Date) { + entity.lastRunAt = data.lastRunAt; + } else if (typeof data.lastRunAt === 'number' || data.lastRunAt.includes('+') || data.lastRunAt.lastIndexOf('-') > 10 || data.lastRunAt.endsWith('Z')) { + entity.lastRunAt = new Date(data.lastRunAt); + } else { + entity.lastRunAt = new Date(data.lastRunAt + 'Z'); + } + } + if (data.lastSuccessAt === null) { + entity.lastSuccessAt = null; + } else if (typeof data.lastSuccessAt !== 'undefined') { + if (data.lastSuccessAt instanceof Date) { + entity.lastSuccessAt = data.lastSuccessAt; + } else if (typeof data.lastSuccessAt === 'number' || data.lastSuccessAt.includes('+') || data.lastSuccessAt.lastIndexOf('-') > 10 || data.lastSuccessAt.endsWith('Z')) { + entity.lastSuccessAt = new Date(data.lastSuccessAt); + } else { + entity.lastSuccessAt = new Date(data.lastSuccessAt + 'Z'); + } + } + if (data.lastErrorAt === null) { + entity.lastErrorAt = null; + } else if (typeof data.lastErrorAt !== 'undefined') { + if (data.lastErrorAt instanceof Date) { + entity.lastErrorAt = data.lastErrorAt; + } else if (typeof data.lastErrorAt === 'number' || data.lastErrorAt.includes('+') || data.lastErrorAt.lastIndexOf('-') > 10 || data.lastErrorAt.endsWith('Z')) { + entity.lastErrorAt = new Date(data.lastErrorAt); + } else { + entity.lastErrorAt = new Date(data.lastErrorAt + 'Z'); + } + } + if (data.lastError === null) { + entity.lastError = null; + } else if (typeof data.lastError !== 'undefined') { + entity.lastError = data.lastError; + } + if (data.lockedBy === null) { + entity.lockedBy = null; + } else if (typeof data.lockedBy !== 'undefined') { + entity.lockedBy = data.lockedBy; + } + if (data.lockedUntil === null) { + entity.lockedUntil = null; + } else if (typeof data.lockedUntil !== 'undefined') { + if (data.lockedUntil instanceof Date) { + entity.lockedUntil = data.lockedUntil; + } else if (typeof data.lockedUntil === 'number' || data.lockedUntil.includes('+') || data.lockedUntil.lastIndexOf('-') > 10 || data.lockedUntil.endsWith('Z')) { + entity.lockedUntil = new Date(data.lockedUntil); + } else { + entity.lockedUntil = new Date(data.lockedUntil + 'Z'); + } + } + if (data.runCount === null) { + entity.runCount = null; + } else if (typeof data.runCount !== 'undefined') { + entity.runCount = data.runCount; + } + if (data.failureCount === null) { + entity.failureCount = null; + } else if (typeof data.failureCount !== 'undefined') { + entity.failureCount = data.failureCount; + } + } + }, + 'hydrator-scheduled_jobs_16000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity SchedulerJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + if (data.created_at === null) { + entity.created_at = null; + } else if (typeof data.created_at !== 'undefined') { + if (data.created_at instanceof Date) { + entity.created_at = data.created_at; + } else if (typeof data.created_at === 'number' || data.created_at.includes('+') || data.created_at.lastIndexOf('-') > 10 || data.created_at.endsWith('Z')) { + entity.created_at = new Date(data.created_at); + } else { + entity.created_at = new Date(data.created_at + 'Z'); + } + } + if (data.updated_at === null) { + entity.updated_at = null; + } else if (typeof data.updated_at !== 'undefined') { + if (data.updated_at instanceof Date) { + entity.updated_at = data.updated_at; + } else if (typeof data.updated_at === 'number' || data.updated_at.includes('+') || data.updated_at.lastIndexOf('-') > 10 || data.updated_at.endsWith('Z')) { + entity.updated_at = new Date(data.updated_at); + } else { + entity.updated_at = new Date(data.updated_at + 'Z'); + } + } + if (data.name === null) { + entity.name = null; + } else if (typeof data.name !== 'undefined') { + entity.name = data.name; + } + if (data.enabled === null) { + entity.enabled = null; + } else if (typeof data.enabled !== 'undefined') { + entity.enabled = !!data.enabled; + } + if (data.cron === null) { + entity.cron = null; + } else if (typeof data.cron !== 'undefined') { + entity.cron = data.cron; + } + if (data.nextRunAt === null) { + entity.nextRunAt = null; + } else if (typeof data.nextRunAt !== 'undefined') { + if (data.nextRunAt instanceof Date) { + entity.nextRunAt = data.nextRunAt; + } else if (typeof data.nextRunAt === 'number' || data.nextRunAt.includes('+') || data.nextRunAt.lastIndexOf('-') > 10 || data.nextRunAt.endsWith('Z')) { + entity.nextRunAt = new Date(data.nextRunAt); + } else { + entity.nextRunAt = new Date(data.nextRunAt + 'Z'); + } + } + if (data.lastRunAt === null) { + entity.lastRunAt = null; + } else if (typeof data.lastRunAt !== 'undefined') { + if (data.lastRunAt instanceof Date) { + entity.lastRunAt = data.lastRunAt; + } else if (typeof data.lastRunAt === 'number' || data.lastRunAt.includes('+') || data.lastRunAt.lastIndexOf('-') > 10 || data.lastRunAt.endsWith('Z')) { + entity.lastRunAt = new Date(data.lastRunAt); + } else { + entity.lastRunAt = new Date(data.lastRunAt + 'Z'); + } + } + if (data.lastSuccessAt === null) { + entity.lastSuccessAt = null; + } else if (typeof data.lastSuccessAt !== 'undefined') { + if (data.lastSuccessAt instanceof Date) { + entity.lastSuccessAt = data.lastSuccessAt; + } else if (typeof data.lastSuccessAt === 'number' || data.lastSuccessAt.includes('+') || data.lastSuccessAt.lastIndexOf('-') > 10 || data.lastSuccessAt.endsWith('Z')) { + entity.lastSuccessAt = new Date(data.lastSuccessAt); + } else { + entity.lastSuccessAt = new Date(data.lastSuccessAt + 'Z'); + } + } + if (data.lastErrorAt === null) { + entity.lastErrorAt = null; + } else if (typeof data.lastErrorAt !== 'undefined') { + if (data.lastErrorAt instanceof Date) { + entity.lastErrorAt = data.lastErrorAt; + } else if (typeof data.lastErrorAt === 'number' || data.lastErrorAt.includes('+') || data.lastErrorAt.lastIndexOf('-') > 10 || data.lastErrorAt.endsWith('Z')) { + entity.lastErrorAt = new Date(data.lastErrorAt); + } else { + entity.lastErrorAt = new Date(data.lastErrorAt + 'Z'); + } + } + if (data.lastError === null) { + entity.lastError = null; + } else if (typeof data.lastError !== 'undefined') { + entity.lastError = data.lastError; + } + if (data.lockedBy === null) { + entity.lockedBy = null; + } else if (typeof data.lockedBy !== 'undefined') { + entity.lockedBy = data.lockedBy; + } + if (data.lockedUntil === null) { + entity.lockedUntil = null; + } else if (typeof data.lockedUntil !== 'undefined') { + if (data.lockedUntil instanceof Date) { + entity.lockedUntil = data.lockedUntil; + } else if (typeof data.lockedUntil === 'number' || data.lockedUntil.includes('+') || data.lockedUntil.lastIndexOf('-') > 10 || data.lockedUntil.endsWith('Z')) { + entity.lockedUntil = new Date(data.lockedUntil); + } else { + entity.lockedUntil = new Date(data.lockedUntil + 'Z'); + } + } + if (data.runCount === null) { + entity.runCount = null; + } else if (typeof data.runCount !== 'undefined') { + entity.runCount = data.runCount; + } + if (data.failureCount === null) { + entity.failureCount = null; + } else if (typeof data.failureCount !== 'undefined') { + entity.failureCount = data.failureCount; + } + } + }, + 'comparator-scheduled_jobs_16000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + // compiled comparator for entity SchedulerJobEntity + return function(last, current, options) { + const diff = {}; + if (current.id === null && last.id === undefined) { + diff.id = current.id; + } else if (current.id == null && last.id == null) { + + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { + diff.id = current.id; + } else if (last.id !== current.id) { + diff.id = current.id; + } + + if (current.created_at === null && last.created_at === undefined) { + diff.created_at = current.created_at; + } else if (current.created_at == null && last.created_at == null) { + + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { + diff.created_at = current.created_at; + } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { + diff.created_at = current.created_at; + } + + if (current.updated_at === null && last.updated_at === undefined) { + diff.updated_at = current.updated_at; + } else if (current.updated_at == null && last.updated_at == null) { + + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { + diff.updated_at = current.updated_at; + } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { + diff.updated_at = current.updated_at; + } + + if (current.name === null && last.name === undefined) { + diff.name = current.name; + } else if (current.name == null && last.name == null) { + + } else if ((current.name != null && last.name == null) || (current.name == null && last.name != null)) { + diff.name = current.name; + } else if (last.name !== current.name) { + diff.name = current.name; + } + + if (current.enabled === null && last.enabled === undefined) { + diff.enabled = current.enabled; + } else if (current.enabled == null && last.enabled == null) { + + } else if ((current.enabled != null && last.enabled == null) || (current.enabled == null && last.enabled != null)) { + diff.enabled = current.enabled; + } else if (!compareBooleans(last.enabled, current.enabled)) { + diff.enabled = current.enabled; + } + + if (current.cron === null && last.cron === undefined) { + diff.cron = current.cron; + } else if (current.cron == null && last.cron == null) { + + } else if ((current.cron != null && last.cron == null) || (current.cron == null && last.cron != null)) { + diff.cron = current.cron; + } else if (last.cron !== current.cron) { + diff.cron = current.cron; + } + + if (current.nextRunAt === null && last.nextRunAt === undefined) { + diff.nextRunAt = current.nextRunAt; + } else if (current.nextRunAt == null && last.nextRunAt == null) { + + } else if ((current.nextRunAt != null && last.nextRunAt == null) || (current.nextRunAt == null && last.nextRunAt != null)) { + diff.nextRunAt = current.nextRunAt; + } else if (last.nextRunAt.valueOf() !== current.nextRunAt.valueOf()) { + diff.nextRunAt = current.nextRunAt; + } + + if (current.lastRunAt === null && last.lastRunAt === undefined) { + diff.lastRunAt = current.lastRunAt; + } else if (current.lastRunAt == null && last.lastRunAt == null) { + + } else if ((current.lastRunAt != null && last.lastRunAt == null) || (current.lastRunAt == null && last.lastRunAt != null)) { + diff.lastRunAt = current.lastRunAt; + } else if (last.lastRunAt.valueOf() !== current.lastRunAt.valueOf()) { + diff.lastRunAt = current.lastRunAt; + } + + if (current.lastSuccessAt === null && last.lastSuccessAt === undefined) { + diff.lastSuccessAt = current.lastSuccessAt; + } else if (current.lastSuccessAt == null && last.lastSuccessAt == null) { + + } else if ((current.lastSuccessAt != null && last.lastSuccessAt == null) || (current.lastSuccessAt == null && last.lastSuccessAt != null)) { + diff.lastSuccessAt = current.lastSuccessAt; + } else if (last.lastSuccessAt.valueOf() !== current.lastSuccessAt.valueOf()) { + diff.lastSuccessAt = current.lastSuccessAt; + } + + if (current.lastErrorAt === null && last.lastErrorAt === undefined) { + diff.lastErrorAt = current.lastErrorAt; + } else if (current.lastErrorAt == null && last.lastErrorAt == null) { + + } else if ((current.lastErrorAt != null && last.lastErrorAt == null) || (current.lastErrorAt == null && last.lastErrorAt != null)) { + diff.lastErrorAt = current.lastErrorAt; + } else if (last.lastErrorAt.valueOf() !== current.lastErrorAt.valueOf()) { + diff.lastErrorAt = current.lastErrorAt; + } + + if (current.lastError === null && last.lastError === undefined) { + diff.lastError = current.lastError; + } else if (current.lastError == null && last.lastError == null) { + + } else if ((current.lastError != null && last.lastError == null) || (current.lastError == null && last.lastError != null)) { + diff.lastError = current.lastError; + } else if (!equals(last.lastError, current.lastError)) { + diff.lastError = current.lastError; + } + + if (current.lockedBy === null && last.lockedBy === undefined) { + diff.lockedBy = current.lockedBy; + } else if (current.lockedBy == null && last.lockedBy == null) { + + } else if ((current.lockedBy != null && last.lockedBy == null) || (current.lockedBy == null && last.lockedBy != null)) { + diff.lockedBy = current.lockedBy; + } else if (last.lockedBy !== current.lockedBy) { + diff.lockedBy = current.lockedBy; + } + + if (current.lockedUntil === null && last.lockedUntil === undefined) { + diff.lockedUntil = current.lockedUntil; + } else if (current.lockedUntil == null && last.lockedUntil == null) { + + } else if ((current.lockedUntil != null && last.lockedUntil == null) || (current.lockedUntil == null && last.lockedUntil != null)) { + diff.lockedUntil = current.lockedUntil; + } else if (last.lockedUntil.valueOf() !== current.lockedUntil.valueOf()) { + diff.lockedUntil = current.lockedUntil; + } + + if (current.runCount === null && last.runCount === undefined) { + diff.runCount = current.runCount; + } else if (current.runCount == null && last.runCount == null) { + + } else if ((current.runCount != null && last.runCount == null) || (current.runCount == null && last.runCount != null)) { + diff.runCount = current.runCount; + } else if (!equals(last.runCount, current.runCount)) { + diff.runCount = current.runCount; + } + + if (current.failureCount === null && last.failureCount === undefined) { + diff.failureCount = current.failureCount; + } else if (current.failureCount == null && last.failureCount == null) { + + } else if ((current.failureCount != null && last.failureCount == null) || (current.failureCount == null && last.failureCount != null)) { + diff.failureCount = current.failureCount; + } else if (!equals(last.failureCount, current.failureCount)) { + diff.failureCount = current.failureCount; + } + + if (options?.includeInverseSides) { + } + return diff; + } + }, + 'snapshotGenerator-scheduled_jobs_16000': function(clone, cloneEmbeddable, processDateProperty) { + return function(entity) { + const ret = {}; + if (typeof entity.id !== 'undefined') { + ret.id = entity.id; + } + + if (typeof entity.created_at !== 'undefined') { + ret.created_at = clone(processDateProperty(entity.created_at)); + } + + if (typeof entity.updated_at !== 'undefined') { + ret.updated_at = clone(processDateProperty(entity.updated_at)); + } + + if (typeof entity.name !== 'undefined') { + ret.name = entity.name; + } + + if (typeof entity.enabled !== 'undefined') { + ret.enabled = entity.enabled; + } + + if (typeof entity.cron !== 'undefined') { + ret.cron = entity.cron; + } + + if (typeof entity.nextRunAt !== 'undefined') { + ret.nextRunAt = clone(processDateProperty(entity.nextRunAt)); + } + + if (typeof entity.lastRunAt !== 'undefined') { + ret.lastRunAt = clone(processDateProperty(entity.lastRunAt)); + } + + if (typeof entity.lastSuccessAt !== 'undefined') { + ret.lastSuccessAt = clone(processDateProperty(entity.lastSuccessAt)); + } + + if (typeof entity.lastErrorAt !== 'undefined') { + ret.lastErrorAt = clone(processDateProperty(entity.lastErrorAt)); + } + + if (typeof entity.lastError !== 'undefined') { + ret.lastError = clone(entity.lastError); + } + + if (typeof entity.lockedBy !== 'undefined') { + ret.lockedBy = entity.lockedBy; + } + + if (typeof entity.lockedUntil !== 'undefined') { + ret.lockedUntil = clone(processDateProperty(entity.lockedUntil)); + } + + if (typeof entity.runCount !== 'undefined') { + ret.runCount = clone(entity.runCount); + } + + if (typeof entity.failureCount !== 'undefined') { + ret.failureCount = clone(entity.failureCount); + } + + return ret; + } + }, + 'resultMapper-scheduled_jobs_16000': function(PolymorphicRef, parseDate) { + // compiled mapper for entity SchedulerJobEntity + return function(result) { + const ret = {}; + const mapped = {}; + if (typeof result.id !== 'undefined') { + ret.id = result.id; + mapped.id = true; + } + if (typeof result.created_at !== 'undefined') { + if (result.created_at == null || result.created_at instanceof Date) { + ret.created_at = result.created_at; + } else if (typeof result.created_at === 'bigint') { + ret.created_at = parseDate(Number(result.created_at)); + } else if (typeof result.created_at === 'number' || result.created_at.includes('+') || result.created_at.lastIndexOf('-') > 10 || result.created_at.endsWith('Z')) { + ret.created_at = parseDate(result.created_at); + } else { + ret.created_at = parseDate(result.created_at + 'Z'); + } + mapped.created_at = true; + } + if (typeof result.updated_at !== 'undefined') { + if (result.updated_at == null || result.updated_at instanceof Date) { + ret.updated_at = result.updated_at; + } else if (typeof result.updated_at === 'bigint') { + ret.updated_at = parseDate(Number(result.updated_at)); + } else if (typeof result.updated_at === 'number' || result.updated_at.includes('+') || result.updated_at.lastIndexOf('-') > 10 || result.updated_at.endsWith('Z')) { + ret.updated_at = parseDate(result.updated_at); + } else { + ret.updated_at = parseDate(result.updated_at + 'Z'); + } + mapped.updated_at = true; + } + if (typeof result.name !== 'undefined') { + ret.name = result.name; + mapped.name = true; + } + if (typeof result.enabled !== 'undefined') { + ret.enabled = result.enabled == null ? result.enabled : !!result.enabled; + mapped.enabled = true; + } + if (typeof result.cron !== 'undefined') { + ret.cron = result.cron; + mapped.cron = true; + } + if (typeof result.next_run_at !== 'undefined') { + if (result.next_run_at == null || result.next_run_at instanceof Date) { + ret.nextRunAt = result.next_run_at; + } else if (typeof result.next_run_at === 'bigint') { + ret.nextRunAt = parseDate(Number(result.next_run_at)); + } else if (typeof result.next_run_at === 'number' || result.next_run_at.includes('+') || result.next_run_at.lastIndexOf('-') > 10 || result.next_run_at.endsWith('Z')) { + ret.nextRunAt = parseDate(result.next_run_at); + } else { + ret.nextRunAt = parseDate(result.next_run_at + 'Z'); + } + mapped.next_run_at = true; + } + if (typeof result.last_run_at !== 'undefined') { + if (result.last_run_at == null || result.last_run_at instanceof Date) { + ret.lastRunAt = result.last_run_at; + } else if (typeof result.last_run_at === 'bigint') { + ret.lastRunAt = parseDate(Number(result.last_run_at)); + } else if (typeof result.last_run_at === 'number' || result.last_run_at.includes('+') || result.last_run_at.lastIndexOf('-') > 10 || result.last_run_at.endsWith('Z')) { + ret.lastRunAt = parseDate(result.last_run_at); + } else { + ret.lastRunAt = parseDate(result.last_run_at + 'Z'); + } + mapped.last_run_at = true; + } + if (typeof result.last_success_at !== 'undefined') { + if (result.last_success_at == null || result.last_success_at instanceof Date) { + ret.lastSuccessAt = result.last_success_at; + } else if (typeof result.last_success_at === 'bigint') { + ret.lastSuccessAt = parseDate(Number(result.last_success_at)); + } else if (typeof result.last_success_at === 'number' || result.last_success_at.includes('+') || result.last_success_at.lastIndexOf('-') > 10 || result.last_success_at.endsWith('Z')) { + ret.lastSuccessAt = parseDate(result.last_success_at); + } else { + ret.lastSuccessAt = parseDate(result.last_success_at + 'Z'); + } + mapped.last_success_at = true; + } + if (typeof result.last_error_at !== 'undefined') { + if (result.last_error_at == null || result.last_error_at instanceof Date) { + ret.lastErrorAt = result.last_error_at; + } else if (typeof result.last_error_at === 'bigint') { + ret.lastErrorAt = parseDate(Number(result.last_error_at)); + } else if (typeof result.last_error_at === 'number' || result.last_error_at.includes('+') || result.last_error_at.lastIndexOf('-') > 10 || result.last_error_at.endsWith('Z')) { + ret.lastErrorAt = parseDate(result.last_error_at); + } else { + ret.lastErrorAt = parseDate(result.last_error_at + 'Z'); + } + mapped.last_error_at = true; + } + if (typeof result.last_error !== 'undefined') { + ret.lastError = result.last_error; + mapped.last_error = true; + } + if (typeof result.locked_by !== 'undefined') { + ret.lockedBy = result.locked_by; + mapped.locked_by = true; + } + if (typeof result.locked_until !== 'undefined') { + if (result.locked_until == null || result.locked_until instanceof Date) { + ret.lockedUntil = result.locked_until; + } else if (typeof result.locked_until === 'bigint') { + ret.lockedUntil = parseDate(Number(result.locked_until)); + } else if (typeof result.locked_until === 'number' || result.locked_until.includes('+') || result.locked_until.lastIndexOf('-') > 10 || result.locked_until.endsWith('Z')) { + ret.lockedUntil = parseDate(result.locked_until); + } else { + ret.lockedUntil = parseDate(result.locked_until + 'Z'); + } + mapped.locked_until = true; + } + if (typeof result.run_count !== 'undefined') { + ret.runCount = result.run_count; + mapped.run_count = true; + } + if (typeof result.failure_count !== 'undefined') { + ret.failureCount = result.failure_count; + mapped.failure_count = true; + } + for (let k in result) { if (Object.hasOwn(result, k) && !mapped[k] && ret[k] === undefined) ret[k] = result[k]; } + return ret; + } + }, + 'hydrator-scheduled_jobs_16000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity SchedulerJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + } + }, + 'hydrator-scheduled_jobs_16000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity SchedulerJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + } + }, + 'pkGetter-scheduled_jobs_16000': function(isEntityOrRef) { + // compiled pk getter for entity SchedulerJobEntity + return function(entity) { + return entity.id; + } + }, + 'pkGetterConverted-scheduled_jobs_16000': function(isEntityOrRef) { + // compiled pk getter (with converted custom types) for entity SchedulerJobEntity + return function(entity) { + return entity.id; + } + }, + 'pkSerializer-scheduled_jobs_16000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + // compiled pk serializer for entity SchedulerJobEntity + return function(entity) { + return '' + entity.id; + } + }, + 'hydrator-revoked_tokens_11000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_237, oauth_client_238, user_239, user_240) { // compiled hydrator for entity RevokedTokenEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3870,18 +4502,18 @@ export default { entity.client = null; } else if (typeof data.client !== 'undefined') { if (isPrimaryKey(data.client, true)) { - entity.client = factory.createReference(oauth_client_205, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.createReference(oauth_client_237, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.client && typeof data.client === 'object') { - entity.client = factory.create(oauth_client_206, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.create(oauth_client_238, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.user === null) { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = factory.createReference(user_207, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.user = factory.createReference(user_239, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.user && typeof data.user === 'object') { - entity.user = factory.create(user_208, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.user = factory.create(user_240, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.expires_at === null) { @@ -3908,7 +4540,7 @@ export default { } } }, - 'hydrator-revoked_tokens_10000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_216, oauth_client_217, user_218, user_219) { + 'hydrator-revoked_tokens_11000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_248, oauth_client_249, user_250, user_251) { // compiled hydrator for entity RevokedTokenEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3957,18 +4589,18 @@ export default { entity.client = null; } else if (typeof data.client !== 'undefined') { if (isPrimaryKey(data.client, true)) { - entity.client = factory.createReference(oauth_client_216, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.createReference(oauth_client_248, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.client && typeof data.client === 'object') { - entity.client = factory.create(oauth_client_217, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.create(oauth_client_249, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.user === null) { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = factory.createReference(user_218, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.user = factory.createReference(user_250, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.user && typeof data.user === 'object') { - entity.user = factory.create(user_219, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.user = factory.create(user_251, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.expires_at === null) { @@ -3995,128 +4627,128 @@ export default { } } }, - 'comparator-revoked_tokens_10000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-revoked_tokens_11000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity RevokedTokenEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.jti === null && last.jti === undefined) { diff.jti = current.jti; } else if (current.jti == null && last.jti == null) { - + } else if ((current.jti != null && last.jti == null) || (current.jti == null && last.jti != null)) { diff.jti = current.jti; } else if (last.jti !== current.jti) { diff.jti = current.jti; } - + if (current.token_type === null && last.token_type === undefined) { diff.token_type = current.token_type; } else if (current.token_type == null && last.token_type == null) { - + } else if ((current.token_type != null && last.token_type == null) || (current.token_type == null && last.token_type != null)) { diff.token_type = current.token_type; } else if (last.token_type !== current.token_type) { diff.token_type = current.token_type; } - + if (current.client === null && last.client === undefined) { diff.client = current.client; } else if (current.client == null && last.client == null) { - + } else if ((current.client != null && last.client == null) || (current.client == null && last.client != null)) { diff.client = current.client; } else if (last.client !== current.client) { diff.client = current.client; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.expires_at === null && last.expires_at === undefined) { diff.expires_at = current.expires_at; } else if (current.expires_at == null && last.expires_at == null) { - + } else if ((current.expires_at != null && last.expires_at == null) || (current.expires_at == null && last.expires_at != null)) { diff.expires_at = current.expires_at; } else if (last.expires_at.valueOf() !== current.expires_at.valueOf()) { diff.expires_at = current.expires_at; } - + if (current.revoked_at === null && last.revoked_at === undefined) { diff.revoked_at = current.revoked_at; } else if (current.revoked_at == null && last.revoked_at == null) { - + } else if ((current.revoked_at != null && last.revoked_at == null) || (current.revoked_at == null && last.revoked_at != null)) { diff.revoked_at = current.revoked_at; } else if (last.revoked_at.valueOf() !== current.revoked_at.valueOf()) { diff.revoked_at = current.revoked_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-revoked_tokens_10000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-revoked_tokens_11000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.jti !== 'undefined') { ret.jti = entity.jti; } - + if (typeof entity.token_type !== 'undefined') { ret.token_type = entity.token_type; } - + if (typeof entity.client !== 'undefined') { if (entity.client === null) { ret.client = null; @@ -4126,7 +4758,7 @@ export default { ret.client = toArray(entity.client.__helper.getPrimaryKey(true)); } } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -4136,19 +4768,19 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.expires_at !== 'undefined') { ret.expires_at = clone(processDateProperty(entity.expires_at)); } - + if (typeof entity.revoked_at !== 'undefined') { ret.revoked_at = clone(processDateProperty(entity.revoked_at)); } - + return ret; } }, - 'resultMapper-revoked_tokens_10000': function(PolymorphicRef, parseDate) { + 'resultMapper-revoked_tokens_11000': function(PolymorphicRef, parseDate) { // compiled mapper for entity RevokedTokenEntity return function(result) { const ret = {}; @@ -4225,7 +4857,7 @@ export default { return ret; } }, - 'hydrator-revoked_tokens_10000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-revoked_tokens_11000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity RevokedTokenEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4240,7 +4872,7 @@ export default { } } }, - 'hydrator-revoked_tokens_10000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-revoked_tokens_11000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity RevokedTokenEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4255,26 +4887,26 @@ export default { } } }, - 'pkGetter-revoked_tokens_10000': function(isEntityOrRef) { + 'pkGetter-revoked_tokens_11000': function(isEntityOrRef) { // compiled pk getter for entity RevokedTokenEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-revoked_tokens_10000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-revoked_tokens_11000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity RevokedTokenEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-revoked_tokens_10000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-revoked_tokens_11000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity RevokedTokenEntity return function(entity) { const val_8 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_8); } }, - 'hydrator-pending_oauth_registration_14000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, convertToJSValue_userInfo, convertToDatabaseValue_userInfo) { + 'hydrator-pending_oauth_registration_15000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, convertToJSValue_userInfo, convertToDatabaseValue_userInfo) { // compiled hydrator for entity PendingOAuthRegistrationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4368,7 +5000,7 @@ export default { } } }, - 'hydrator-pending_oauth_registration_14000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, convertToJSValue_userInfo, convertToDatabaseValue_userInfo) { + 'hydrator-pending_oauth_registration_15000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, convertToJSValue_userInfo, convertToDatabaseValue_userInfo) { // compiled hydrator for entity PendingOAuthRegistrationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4462,190 +5094,190 @@ export default { } } }, - 'comparator-pending_oauth_registration_14000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-pending_oauth_registration_15000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity PendingOAuthRegistrationEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.token === null && last.token === undefined) { diff.token = current.token; } else if (current.token == null && last.token == null) { - + } else if ((current.token != null && last.token == null) || (current.token == null && last.token != null)) { diff.token = current.token; } else if (last.token !== current.token) { diff.token = current.token; } - + if (current.providerId === null && last.providerId === undefined) { diff.providerId = current.providerId; } else if (current.providerId == null && last.providerId == null) { - + } else if ((current.providerId != null && last.providerId == null) || (current.providerId == null && last.providerId != null)) { diff.providerId = current.providerId; } else if (last.providerId !== current.providerId) { diff.providerId = current.providerId; } - + if (current.accessToken === null && last.accessToken === undefined) { diff.accessToken = current.accessToken; } else if (current.accessToken == null && last.accessToken == null) { - + } else if ((current.accessToken != null && last.accessToken == null) || (current.accessToken == null && last.accessToken != null)) { diff.accessToken = current.accessToken; } else if (!equals(last.accessToken, current.accessToken)) { diff.accessToken = current.accessToken; } - + if (current.refreshToken === null && last.refreshToken === undefined) { diff.refreshToken = current.refreshToken; } else if (current.refreshToken == null && last.refreshToken == null) { - + } else if ((current.refreshToken != null && last.refreshToken == null) || (current.refreshToken == null && last.refreshToken != null)) { diff.refreshToken = current.refreshToken; } else if (!equals(last.refreshToken, current.refreshToken)) { diff.refreshToken = current.refreshToken; } - + if (current.expiresIn === null && last.expiresIn === undefined) { diff.expiresIn = current.expiresIn; } else if (current.expiresIn == null && last.expiresIn == null) { - + } else if ((current.expiresIn != null && last.expiresIn == null) || (current.expiresIn == null && last.expiresIn != null)) { diff.expiresIn = current.expiresIn; } else if (!equals(last.expiresIn, current.expiresIn)) { diff.expiresIn = current.expiresIn; } - + if (current.tokenType === null && last.tokenType === undefined) { diff.tokenType = current.tokenType; } else if (current.tokenType == null && last.tokenType == null) { - + } else if ((current.tokenType != null && last.tokenType == null) || (current.tokenType == null && last.tokenType != null)) { diff.tokenType = current.tokenType; } else if (last.tokenType !== current.tokenType) { diff.tokenType = current.tokenType; } - + if (current.userInfo === null && last.userInfo === undefined) { diff.userInfo = current.userInfo; } else if (current.userInfo == null && last.userInfo == null) { - + } else if ((current.userInfo != null && last.userInfo == null) || (current.userInfo == null && last.userInfo != null)) { diff.userInfo = current.userInfo; } else if (!equals(last.userInfo, current.userInfo)) { diff.userInfo = current.userInfo; } - + if (current.returnUrl === null && last.returnUrl === undefined) { diff.returnUrl = current.returnUrl; } else if (current.returnUrl == null && last.returnUrl == null) { - + } else if ((current.returnUrl != null && last.returnUrl == null) || (current.returnUrl == null && last.returnUrl != null)) { diff.returnUrl = current.returnUrl; } else if (last.returnUrl !== current.returnUrl) { diff.returnUrl = current.returnUrl; } - + if (current.expiresAt === null && last.expiresAt === undefined) { diff.expiresAt = current.expiresAt; } else if (current.expiresAt == null && last.expiresAt == null) { - + } else if ((current.expiresAt != null && last.expiresAt == null) || (current.expiresAt == null && last.expiresAt != null)) { diff.expiresAt = current.expiresAt; } else if (last.expiresAt.valueOf() !== current.expiresAt.valueOf()) { diff.expiresAt = current.expiresAt; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-pending_oauth_registration_14000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, convertToDatabaseValue_userInfo) { + 'snapshotGenerator-pending_oauth_registration_15000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, convertToDatabaseValue_userInfo) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.token !== 'undefined') { ret.token = entity.token; } - + if (typeof entity.providerId !== 'undefined') { ret.providerId = entity.providerId; } - + if (typeof entity.accessToken !== 'undefined') { ret.accessToken = clone(entity.accessToken); } - + if (typeof entity.refreshToken !== 'undefined') { ret.refreshToken = clone(entity.refreshToken); } - + if (typeof entity.expiresIn !== 'undefined') { ret.expiresIn = clone(entity.expiresIn); } - + if (typeof entity.tokenType !== 'undefined') { ret.tokenType = entity.tokenType; } - + if (typeof entity.userInfo !== 'undefined') { ret.userInfo = clone(convertToDatabaseValue_userInfo(entity.userInfo)); } - + if (typeof entity.returnUrl !== 'undefined') { ret.returnUrl = entity.returnUrl; } - + if (typeof entity.expiresAt !== 'undefined') { ret.expiresAt = clone(processDateProperty(entity.expiresAt)); } - + return ret; } }, - 'resultMapper-pending_oauth_registration_14000': function(PolymorphicRef, parseDate) { + 'resultMapper-pending_oauth_registration_15000': function(PolymorphicRef, parseDate) { // compiled mapper for entity PendingOAuthRegistrationEntity return function(result) { const ret = {}; @@ -4726,7 +5358,7 @@ export default { return ret; } }, - 'hydrator-pending_oauth_registration_14000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-pending_oauth_registration_15000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity PendingOAuthRegistrationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4741,7 +5373,7 @@ export default { } } }, - 'hydrator-pending_oauth_registration_14000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-pending_oauth_registration_15000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity PendingOAuthRegistrationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4756,26 +5388,26 @@ export default { } } }, - 'pkGetter-pending_oauth_registration_14000': function(isEntityOrRef) { + 'pkGetter-pending_oauth_registration_15000': function(isEntityOrRef) { // compiled pk getter for entity PendingOAuthRegistrationEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-pending_oauth_registration_14000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-pending_oauth_registration_15000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity PendingOAuthRegistrationEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-pending_oauth_registration_14000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-pending_oauth_registration_15000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity PendingOAuthRegistrationEntity return function(entity) { const val_9 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_9); } }, - 'hydrator-password_reset_13000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_253, user_254) { + 'hydrator-password_reset_14000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_285, user_286) { // compiled hydrator for entity PasswordResetEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4814,9 +5446,9 @@ export default { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_253, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_285, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_254, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_286, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.token === null) { @@ -4853,7 +5485,7 @@ export default { } } }, - 'hydrator-password_reset_13000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_262, user_263) { + 'hydrator-password_reset_14000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_294, user_295) { // compiled hydrator for entity PasswordResetEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4892,9 +5524,9 @@ export default { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_262, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_294, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_263, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_295, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.token === null) { @@ -4931,110 +5563,110 @@ export default { } } }, - 'comparator-password_reset_13000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-password_reset_14000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity PasswordResetEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.token === null && last.token === undefined) { diff.token = current.token; } else if (current.token == null && last.token == null) { - + } else if ((current.token != null && last.token == null) || (current.token == null && last.token != null)) { diff.token = current.token; } else if (last.token !== current.token) { diff.token = current.token; } - + if (current.expiresAt === null && last.expiresAt === undefined) { diff.expiresAt = current.expiresAt; } else if (current.expiresAt == null && last.expiresAt == null) { - + } else if ((current.expiresAt != null && last.expiresAt == null) || (current.expiresAt == null && last.expiresAt != null)) { diff.expiresAt = current.expiresAt; } else if (last.expiresAt.valueOf() !== current.expiresAt.valueOf()) { diff.expiresAt = current.expiresAt; } - + if (current.used === null && last.used === undefined) { diff.used = current.used; } else if (current.used == null && last.used == null) { - + } else if ((current.used != null && last.used == null) || (current.used == null && last.used != null)) { diff.used = current.used; } else if (!compareBooleans(last.used, current.used)) { diff.used = current.used; } - + if (current.usedAt === null && last.usedAt === undefined) { diff.usedAt = current.usedAt; } else if (current.usedAt == null && last.usedAt == null) { - + } else if ((current.usedAt != null && last.usedAt == null) || (current.usedAt == null && last.usedAt != null)) { diff.usedAt = current.usedAt; } else if (last.usedAt.valueOf() !== current.usedAt.valueOf()) { diff.usedAt = current.usedAt; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-password_reset_13000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-password_reset_14000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -5044,27 +5676,27 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.token !== 'undefined') { ret.token = entity.token; } - + if (typeof entity.expiresAt !== 'undefined') { ret.expiresAt = clone(processDateProperty(entity.expiresAt)); } - + if (typeof entity.used !== 'undefined') { ret.used = entity.used; } - + if (typeof entity.usedAt !== 'undefined') { ret.usedAt = clone(processDateProperty(entity.usedAt)); } - + return ret; } }, - 'resultMapper-password_reset_13000': function(PolymorphicRef, parseDate) { + 'resultMapper-password_reset_14000': function(PolymorphicRef, parseDate) { // compiled mapper for entity PasswordResetEntity return function(result) { const ret = {}; @@ -5137,7 +5769,7 @@ export default { return ret; } }, - 'hydrator-password_reset_13000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-password_reset_14000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity PasswordResetEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5152,7 +5784,7 @@ export default { } } }, - 'hydrator-password_reset_13000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-password_reset_14000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity PasswordResetEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5167,26 +5799,26 @@ export default { } } }, - 'pkGetter-password_reset_13000': function(isEntityOrRef) { + 'pkGetter-password_reset_14000': function(isEntityOrRef) { // compiled pk getter for entity PasswordResetEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-password_reset_13000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-password_reset_14000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity PasswordResetEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-password_reset_13000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-password_reset_14000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity PasswordResetEntity return function(entity) { const val_10 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_10); } }, - 'hydrator-oauth_code_9000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_274, oauth_client_275, user_276, user_277, convertToJSValue_scope, convertToDatabaseValue_scope) { + 'hydrator-oauth_code_10000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_306, oauth_client_307, user_308, user_309, convertToJSValue_scope, convertToDatabaseValue_scope) { // compiled hydrator for entity OAuthCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5230,18 +5862,18 @@ export default { entity.client = null; } else if (typeof data.client !== 'undefined') { if (isPrimaryKey(data.client, true)) { - entity.client = factory.createReference(oauth_client_274, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.createReference(oauth_client_306, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.client && typeof data.client === 'object') { - entity.client = factory.create(oauth_client_275, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.create(oauth_client_307, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.user === null) { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_276, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_308, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_277, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_309, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.redirectUri === null) { @@ -5304,7 +5936,7 @@ export default { } } }, - 'hydrator-oauth_code_9000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_290, oauth_client_291, user_292, user_293, convertToJSValue_scope, convertToDatabaseValue_scope) { + 'hydrator-oauth_code_10000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_322, oauth_client_323, user_324, user_325, convertToJSValue_scope, convertToDatabaseValue_scope) { // compiled hydrator for entity OAuthCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5348,18 +5980,18 @@ export default { entity.client = null; } else if (typeof data.client !== 'undefined') { if (isPrimaryKey(data.client, true)) { - entity.client = factory.createReference(oauth_client_290, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.createReference(oauth_client_322, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.client && typeof data.client === 'object') { - entity.client = factory.create(oauth_client_291, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.create(oauth_client_323, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.user === null) { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_292, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_324, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_293, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_325, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.redirectUri === null) { @@ -5422,174 +6054,174 @@ export default { } } }, - 'comparator-oauth_code_9000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-oauth_code_10000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity OAuthCodeEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.codeHash === null && last.codeHash === undefined) { diff.codeHash = current.codeHash; } else if (current.codeHash == null && last.codeHash == null) { - + } else if ((current.codeHash != null && last.codeHash == null) || (current.codeHash == null && last.codeHash != null)) { diff.codeHash = current.codeHash; } else if (last.codeHash !== current.codeHash) { diff.codeHash = current.codeHash; } - + if (current.client === null && last.client === undefined) { diff.client = current.client; } else if (current.client == null && last.client == null) { - + } else if ((current.client != null && last.client == null) || (current.client == null && last.client != null)) { diff.client = current.client; } else if (last.client !== current.client) { diff.client = current.client; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.redirectUri === null && last.redirectUri === undefined) { diff.redirectUri = current.redirectUri; } else if (current.redirectUri == null && last.redirectUri == null) { - + } else if ((current.redirectUri != null && last.redirectUri == null) || (current.redirectUri == null && last.redirectUri != null)) { diff.redirectUri = current.redirectUri; } else if (last.redirectUri !== current.redirectUri) { diff.redirectUri = current.redirectUri; } - + if (current.scope === null && last.scope === undefined) { diff.scope = current.scope; } else if (current.scope == null && last.scope == null) { - + } else if ((current.scope != null && last.scope == null) || (current.scope == null && last.scope != null)) { diff.scope = current.scope; } else if (!equals(last.scope, current.scope)) { diff.scope = current.scope; } - + if (current.nonce === null && last.nonce === undefined) { diff.nonce = current.nonce; } else if (current.nonce == null && last.nonce == null) { - + } else if ((current.nonce != null && last.nonce == null) || (current.nonce == null && last.nonce != null)) { diff.nonce = current.nonce; } else if (last.nonce !== current.nonce) { diff.nonce = current.nonce; } - + if (current.codeChallenge === null && last.codeChallenge === undefined) { diff.codeChallenge = current.codeChallenge; } else if (current.codeChallenge == null && last.codeChallenge == null) { - + } else if ((current.codeChallenge != null && last.codeChallenge == null) || (current.codeChallenge == null && last.codeChallenge != null)) { diff.codeChallenge = current.codeChallenge; } else if (last.codeChallenge !== current.codeChallenge) { diff.codeChallenge = current.codeChallenge; } - + if (current.codeChallengeMethod === null && last.codeChallengeMethod === undefined) { diff.codeChallengeMethod = current.codeChallengeMethod; } else if (current.codeChallengeMethod == null && last.codeChallengeMethod == null) { - + } else if ((current.codeChallengeMethod != null && last.codeChallengeMethod == null) || (current.codeChallengeMethod == null && last.codeChallengeMethod != null)) { diff.codeChallengeMethod = current.codeChallengeMethod; } else if (last.codeChallengeMethod !== current.codeChallengeMethod) { diff.codeChallengeMethod = current.codeChallengeMethod; } - + if (current.expiredAt === null && last.expiredAt === undefined) { diff.expiredAt = current.expiredAt; } else if (current.expiredAt == null && last.expiredAt == null) { - + } else if ((current.expiredAt != null && last.expiredAt == null) || (current.expiredAt == null && last.expiredAt != null)) { diff.expiredAt = current.expiredAt; } else if (last.expiredAt.valueOf() !== current.expiredAt.valueOf()) { diff.expiredAt = current.expiredAt; } - + if (current.consumedAt === null && last.consumedAt === undefined) { diff.consumedAt = current.consumedAt; } else if (current.consumedAt == null && last.consumedAt == null) { - + } else if ((current.consumedAt != null && last.consumedAt == null) || (current.consumedAt == null && last.consumedAt != null)) { diff.consumedAt = current.consumedAt; } else if (last.consumedAt.valueOf() !== current.consumedAt.valueOf()) { diff.consumedAt = current.consumedAt; } - + if (current.authTime === null && last.authTime === undefined) { diff.authTime = current.authTime; } else if (current.authTime == null && last.authTime == null) { - + } else if ((current.authTime != null && last.authTime == null) || (current.authTime == null && last.authTime != null)) { diff.authTime = current.authTime; } else if (!equals(last.authTime, current.authTime)) { diff.authTime = current.authTime; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-oauth_code_9000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_scope) { + 'snapshotGenerator-oauth_code_10000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_scope) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.codeHash !== 'undefined') { ret.codeHash = entity.codeHash; } - + if (typeof entity.client !== 'undefined') { if (entity.client === null) { ret.client = null; @@ -5599,7 +6231,7 @@ export default { ret.client = toArray(entity.client.__helper.getPrimaryKey(true)); } } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -5609,43 +6241,43 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.redirectUri !== 'undefined') { ret.redirectUri = entity.redirectUri; } - + if (typeof entity.scope !== 'undefined') { ret.scope = clone(convertToDatabaseValue_scope(entity.scope)); } - + if (typeof entity.nonce !== 'undefined') { ret.nonce = entity.nonce; } - + if (typeof entity.codeChallenge !== 'undefined') { ret.codeChallenge = entity.codeChallenge; } - + if (typeof entity.codeChallengeMethod !== 'undefined') { ret.codeChallengeMethod = entity.codeChallengeMethod; } - + if (typeof entity.expiredAt !== 'undefined') { ret.expiredAt = clone(processDateProperty(entity.expiredAt)); } - + if (typeof entity.consumedAt !== 'undefined') { ret.consumedAt = clone(processDateProperty(entity.consumedAt)); } - + if (typeof entity.authTime !== 'undefined') { ret.authTime = clone(entity.authTime); } - + return ret; } }, - 'resultMapper-oauth_code_9000': function(PolymorphicRef, parseDate) { + 'resultMapper-oauth_code_10000': function(PolymorphicRef, parseDate) { // compiled mapper for entity OAuthCodeEntity return function(result) { const ret = {}; @@ -5742,7 +6374,7 @@ export default { return ret; } }, - 'hydrator-oauth_code_9000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-oauth_code_10000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity OAuthCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5757,7 +6389,7 @@ export default { } } }, - 'hydrator-oauth_code_9000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-oauth_code_10000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity OAuthCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5772,26 +6404,26 @@ export default { } } }, - 'pkGetter-oauth_code_9000': function(isEntityOrRef) { + 'pkGetter-oauth_code_10000': function(isEntityOrRef) { // compiled pk getter for entity OAuthCodeEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-oauth_code_9000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-oauth_code_10000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity OAuthCodeEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-oauth_code_9000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-oauth_code_10000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity OAuthCodeEntity return function(entity) { const val_11 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_11); } }, - 'hydrator-oauth_client_12000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_grantTypes, convertToDatabaseValue_grantTypes, convertToJSValue_responseTypes, convertToDatabaseValue_responseTypes, convertToJSValue_scopes, convertToDatabaseValue_scopes, convertToJSValue_redirectUris, convertToDatabaseValue_redirectUris, oauth_code_317, user_consent_318, revoked_tokens_319) { + 'hydrator-oauth_client_13000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_grantTypes, convertToDatabaseValue_grantTypes, convertToJSValue_responseTypes, convertToDatabaseValue_responseTypes, convertToJSValue_scopes, convertToDatabaseValue_scopes, convertToJSValue_redirectUris, convertToDatabaseValue_redirectUris, oauth_code_349, user_consent_350, revoked_tokens_351) { // compiled hydrator for entity OAuthClientEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5896,9 +6528,9 @@ export default { entity.logoUri = data.logoUri; } const createCollectionItem_codes = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(oauth_code_317, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(oauth_code_349, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(oauth_code_317, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(oauth_code_349, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.codes && !Array.isArray(data.codes) && typeof data.codes === 'object') { data.codes = [data.codes]; @@ -5918,9 +6550,9 @@ export default { coll.setDirty(false); } const createCollectionItem_consents = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(user_consent_318, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(user_consent_350, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(user_consent_318, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(user_consent_350, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.consents && !Array.isArray(data.consents) && typeof data.consents === 'object') { data.consents = [data.consents]; @@ -5940,9 +6572,9 @@ export default { coll.setDirty(false); } const createCollectionItem_revokedTokens = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(revoked_tokens_319, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(revoked_tokens_351, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(revoked_tokens_319, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(revoked_tokens_351, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.revokedTokens && !Array.isArray(data.revokedTokens) && typeof data.revokedTokens === 'object') { data.revokedTokens = [data.revokedTokens]; @@ -5963,7 +6595,7 @@ export default { } } }, - 'hydrator-oauth_client_12000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_grantTypes, convertToDatabaseValue_grantTypes, convertToJSValue_responseTypes, convertToDatabaseValue_responseTypes, convertToJSValue_scopes, convertToDatabaseValue_scopes, convertToJSValue_redirectUris, convertToDatabaseValue_redirectUris, oauth_code_333, user_consent_334, revoked_tokens_335) { + 'hydrator-oauth_client_13000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_grantTypes, convertToDatabaseValue_grantTypes, convertToJSValue_responseTypes, convertToDatabaseValue_responseTypes, convertToJSValue_scopes, convertToDatabaseValue_scopes, convertToJSValue_redirectUris, convertToDatabaseValue_redirectUris, oauth_code_365, user_consent_366, revoked_tokens_367) { // compiled hydrator for entity OAuthClientEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -6068,9 +6700,9 @@ export default { entity.logoUri = data.logoUri; } const createCollectionItem_codes = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(oauth_code_333, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(oauth_code_365, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(oauth_code_333, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(oauth_code_365, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.codes && !Array.isArray(data.codes) && typeof data.codes === 'object') { data.codes = [data.codes]; @@ -6090,9 +6722,9 @@ export default { coll.setDirty(false); } const createCollectionItem_consents = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(user_consent_334, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(user_consent_366, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(user_consent_334, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(user_consent_366, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.consents && !Array.isArray(data.consents) && typeof data.consents === 'object') { data.consents = [data.consents]; @@ -6112,9 +6744,9 @@ export default { coll.setDirty(false); } const createCollectionItem_revokedTokens = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(revoked_tokens_335, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(revoked_tokens_367, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(revoked_tokens_335, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(revoked_tokens_367, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.revokedTokens && !Array.isArray(data.revokedTokens) && typeof data.revokedTokens === 'object') { data.revokedTokens = [data.revokedTokens]; @@ -6135,204 +6767,204 @@ export default { } } }, - 'comparator-oauth_client_12000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-oauth_client_13000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity OAuthClientEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.clientId === null && last.clientId === undefined) { diff.clientId = current.clientId; } else if (current.clientId == null && last.clientId == null) { - + } else if ((current.clientId != null && last.clientId == null) || (current.clientId == null && last.clientId != null)) { diff.clientId = current.clientId; } else if (last.clientId !== current.clientId) { diff.clientId = current.clientId; } - + if (current.clientSecretHash === null && last.clientSecretHash === undefined) { diff.clientSecretHash = current.clientSecretHash; } else if (current.clientSecretHash == null && last.clientSecretHash == null) { - + } else if ((current.clientSecretHash != null && last.clientSecretHash == null) || (current.clientSecretHash == null && last.clientSecretHash != null)) { diff.clientSecretHash = current.clientSecretHash; } else if (last.clientSecretHash !== current.clientSecretHash) { diff.clientSecretHash = current.clientSecretHash; } - + if (current.name === null && last.name === undefined) { diff.name = current.name; } else if (current.name == null && last.name == null) { - + } else if ((current.name != null && last.name == null) || (current.name == null && last.name != null)) { diff.name = current.name; } else if (last.name !== current.name) { diff.name = current.name; } - + if (current.grantTypes === null && last.grantTypes === undefined) { diff.grantTypes = current.grantTypes; } else if (current.grantTypes == null && last.grantTypes == null) { - + } else if ((current.grantTypes != null && last.grantTypes == null) || (current.grantTypes == null && last.grantTypes != null)) { diff.grantTypes = current.grantTypes; } else if (!equals(last.grantTypes, current.grantTypes)) { diff.grantTypes = current.grantTypes; } - + if (current.responseTypes === null && last.responseTypes === undefined) { diff.responseTypes = current.responseTypes; } else if (current.responseTypes == null && last.responseTypes == null) { - + } else if ((current.responseTypes != null && last.responseTypes == null) || (current.responseTypes == null && last.responseTypes != null)) { diff.responseTypes = current.responseTypes; } else if (!equals(last.responseTypes, current.responseTypes)) { diff.responseTypes = current.responseTypes; } - + if (current.scopes === null && last.scopes === undefined) { diff.scopes = current.scopes; } else if (current.scopes == null && last.scopes == null) { - + } else if ((current.scopes != null && last.scopes == null) || (current.scopes == null && last.scopes != null)) { diff.scopes = current.scopes; } else if (!equals(last.scopes, current.scopes)) { diff.scopes = current.scopes; } - + if (current.redirectUris === null && last.redirectUris === undefined) { diff.redirectUris = current.redirectUris; } else if (current.redirectUris == null && last.redirectUris == null) { - + } else if ((current.redirectUris != null && last.redirectUris == null) || (current.redirectUris == null && last.redirectUris != null)) { diff.redirectUris = current.redirectUris; } else if (!equals(last.redirectUris, current.redirectUris)) { diff.redirectUris = current.redirectUris; } - + if (current.enabled === null && last.enabled === undefined) { diff.enabled = current.enabled; } else if (current.enabled == null && last.enabled == null) { - + } else if ((current.enabled != null && last.enabled == null) || (current.enabled == null && last.enabled != null)) { diff.enabled = current.enabled; } else if (!compareBooleans(last.enabled, current.enabled)) { diff.enabled = current.enabled; } - + if (current.managed_by === null && last.managed_by === undefined) { diff.managed_by = current.managed_by; } else if (current.managed_by == null && last.managed_by == null) { - + } else if ((current.managed_by != null && last.managed_by == null) || (current.managed_by == null && last.managed_by != null)) { diff.managed_by = current.managed_by; } else if (last.managed_by !== current.managed_by) { diff.managed_by = current.managed_by; } - + if (current.logoUri === null && last.logoUri === undefined) { diff.logoUri = current.logoUri; } else if (current.logoUri == null && last.logoUri == null) { - + } else if ((current.logoUri != null && last.logoUri == null) || (current.logoUri == null && last.logoUri != null)) { diff.logoUri = current.logoUri; } else if (last.logoUri !== current.logoUri) { diff.logoUri = current.logoUri; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-oauth_client_12000': function(clone, cloneEmbeddable, processDateProperty, convertToDatabaseValue_grantTypes, convertToDatabaseValue_responseTypes, convertToDatabaseValue_scopes, convertToDatabaseValue_redirectUris) { + 'snapshotGenerator-oauth_client_13000': function(clone, cloneEmbeddable, processDateProperty, convertToDatabaseValue_grantTypes, convertToDatabaseValue_responseTypes, convertToDatabaseValue_scopes, convertToDatabaseValue_redirectUris) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = entity.id; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.clientId !== 'undefined') { ret.clientId = entity.clientId; } - + if (typeof entity.clientSecretHash !== 'undefined') { ret.clientSecretHash = entity.clientSecretHash; } - + if (typeof entity.name !== 'undefined') { ret.name = entity.name; } - + if (typeof entity.grantTypes !== 'undefined') { ret.grantTypes = clone(convertToDatabaseValue_grantTypes(entity.grantTypes)); } - + if (typeof entity.responseTypes !== 'undefined') { ret.responseTypes = clone(convertToDatabaseValue_responseTypes(entity.responseTypes)); } - + if (typeof entity.scopes !== 'undefined') { ret.scopes = clone(convertToDatabaseValue_scopes(entity.scopes)); } - + if (typeof entity.redirectUris !== 'undefined') { ret.redirectUris = clone(convertToDatabaseValue_redirectUris(entity.redirectUris)); } - + if (typeof entity.enabled !== 'undefined') { ret.enabled = entity.enabled; } - + if (typeof entity.managed_by !== 'undefined') { ret.managed_by = entity.managed_by; } - + if (typeof entity.logoUri !== 'undefined') { ret.logoUri = entity.logoUri; } - + return ret; } }, - 'resultMapper-oauth_client_12000': function(PolymorphicRef, parseDate) { + 'resultMapper-oauth_client_13000': function(PolymorphicRef, parseDate) { // compiled mapper for entity OAuthClientEntity return function(result) { const ret = {}; @@ -6409,7 +7041,7 @@ export default { return ret; } }, - 'hydrator-oauth_client_12000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-oauth_client_13000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity OAuthClientEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -6419,7 +7051,7 @@ export default { } } }, - 'hydrator-oauth_client_12000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-oauth_client_13000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity OAuthClientEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -6429,25 +7061,25 @@ export default { } } }, - 'pkGetter-oauth_client_12000': function(isEntityOrRef) { + 'pkGetter-oauth_client_13000': function(isEntityOrRef) { // compiled pk getter for entity OAuthClientEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-oauth_client_12000': function(isEntityOrRef) { + 'pkGetterConverted-oauth_client_13000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity OAuthClientEntity return function(entity) { return entity.id; } }, - 'pkSerializer-oauth_client_12000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-oauth_client_13000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity OAuthClientEntity return function(entity) { return '' + entity.id; } }, - 'hydrator-jwt_key_8000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-jwt_key_9000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity JwtKeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.kid === null) { @@ -6543,7 +7175,7 @@ export default { } } }, - 'hydrator-jwt_key_8000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-jwt_key_9000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity JwtKeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.kid === null) { @@ -6639,176 +7271,176 @@ export default { } } }, - 'comparator-jwt_key_8000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-jwt_key_9000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity JwtKeyEntity return function(last, current, options) { const diff = {}; if (current.kid === null && last.kid === undefined) { diff.kid = current.kid; } else if (current.kid == null && last.kid == null) { - + } else if ((current.kid != null && last.kid == null) || (current.kid == null && last.kid != null)) { diff.kid = current.kid; } else if (last.kid !== current.kid) { diff.kid = current.kid; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.private_key === null && last.private_key === undefined) { diff.private_key = current.private_key; } else if (current.private_key == null && last.private_key == null) { - + } else if ((current.private_key != null && last.private_key == null) || (current.private_key == null && last.private_key != null)) { diff.private_key = current.private_key; } else if (!equals(last.private_key, current.private_key)) { diff.private_key = current.private_key; } - + if (current.public_key === null && last.public_key === undefined) { diff.public_key = current.public_key; } else if (current.public_key == null && last.public_key == null) { - + } else if ((current.public_key != null && last.public_key == null) || (current.public_key == null && last.public_key != null)) { diff.public_key = current.public_key; } else if (!equals(last.public_key, current.public_key)) { diff.public_key = current.public_key; } - + if (current.algorithm === null && last.algorithm === undefined) { diff.algorithm = current.algorithm; } else if (current.algorithm == null && last.algorithm == null) { - + } else if ((current.algorithm != null && last.algorithm == null) || (current.algorithm == null && last.algorithm != null)) { diff.algorithm = current.algorithm; } else if (last.algorithm !== current.algorithm) { diff.algorithm = current.algorithm; } - + if (current.status === null && last.status === undefined) { diff.status = current.status; } else if (current.status == null && last.status == null) { - + } else if ((current.status != null && last.status == null) || (current.status == null && last.status != null)) { diff.status = current.status; } else if (last.status !== current.status) { diff.status = current.status; } - + if (current.activated_at === null && last.activated_at === undefined) { diff.activated_at = current.activated_at; } else if (current.activated_at == null && last.activated_at == null) { - + } else if ((current.activated_at != null && last.activated_at == null) || (current.activated_at == null && last.activated_at != null)) { diff.activated_at = current.activated_at; } else if (last.activated_at.valueOf() !== current.activated_at.valueOf()) { diff.activated_at = current.activated_at; } - + if (current.deactivated_at === null && last.deactivated_at === undefined) { diff.deactivated_at = current.deactivated_at; } else if (current.deactivated_at == null && last.deactivated_at == null) { - + } else if ((current.deactivated_at != null && last.deactivated_at == null) || (current.deactivated_at == null && last.deactivated_at != null)) { diff.deactivated_at = current.deactivated_at; } else if (last.deactivated_at.valueOf() !== current.deactivated_at.valueOf()) { diff.deactivated_at = current.deactivated_at; } - + if (current.retired_at === null && last.retired_at === undefined) { diff.retired_at = current.retired_at; } else if (current.retired_at == null && last.retired_at == null) { - + } else if ((current.retired_at != null && last.retired_at == null) || (current.retired_at == null && last.retired_at != null)) { diff.retired_at = current.retired_at; } else if (last.retired_at.valueOf() !== current.retired_at.valueOf()) { diff.retired_at = current.retired_at; } - + if (current.expires_at === null && last.expires_at === undefined) { diff.expires_at = current.expires_at; } else if (current.expires_at == null && last.expires_at == null) { - + } else if ((current.expires_at != null && last.expires_at == null) || (current.expires_at == null && last.expires_at != null)) { diff.expires_at = current.expires_at; } else if (last.expires_at.valueOf() !== current.expires_at.valueOf()) { diff.expires_at = current.expires_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-jwt_key_8000': function(clone, cloneEmbeddable, processDateProperty) { + 'snapshotGenerator-jwt_key_9000': function(clone, cloneEmbeddable, processDateProperty) { return function(entity) { const ret = {}; if (typeof entity.kid !== 'undefined') { ret.kid = entity.kid; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.private_key !== 'undefined') { ret.private_key = clone(entity.private_key); } - + if (typeof entity.public_key !== 'undefined') { ret.public_key = clone(entity.public_key); } - + if (typeof entity.algorithm !== 'undefined') { ret.algorithm = entity.algorithm; } - + if (typeof entity.status !== 'undefined') { ret.status = entity.status; } - + if (typeof entity.activated_at !== 'undefined') { ret.activated_at = clone(processDateProperty(entity.activated_at)); } - + if (typeof entity.deactivated_at !== 'undefined') { ret.deactivated_at = clone(processDateProperty(entity.deactivated_at)); } - + if (typeof entity.retired_at !== 'undefined') { ret.retired_at = clone(processDateProperty(entity.retired_at)); } - + if (typeof entity.expires_at !== 'undefined') { ret.expires_at = clone(processDateProperty(entity.expires_at)); } - + return ret; } }, - 'resultMapper-jwt_key_8000': function(PolymorphicRef, parseDate) { + 'resultMapper-jwt_key_9000': function(PolymorphicRef, parseDate) { // compiled mapper for entity JwtKeyEntity return function(result) { const ret = {}; @@ -6909,7 +7541,7 @@ export default { return ret; } }, - 'hydrator-jwt_key_8000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-jwt_key_9000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity JwtKeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.kid === null) { @@ -6919,7 +7551,7 @@ export default { } } }, - 'hydrator-jwt_key_8000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-jwt_key_9000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity JwtKeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.kid === null) { @@ -6929,25 +7561,25 @@ export default { } } }, - 'pkGetter-jwt_key_8000': function(isEntityOrRef) { + 'pkGetter-jwt_key_9000': function(isEntityOrRef) { // compiled pk getter for entity JwtKeyEntity return function(entity) { return entity.kid; } }, - 'pkGetterConverted-jwt_key_8000': function(isEntityOrRef) { + 'pkGetterConverted-jwt_key_9000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity JwtKeyEntity return function(entity) { return entity.kid; } }, - 'pkSerializer-jwt_key_8000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-jwt_key_9000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity JwtKeyEntity return function(entity) { return '' + entity.kid; } }, - 'hydrator-email_verification_7000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_365, user_366) { + 'hydrator-email_verification_8000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_397, user_398) { // compiled hydrator for entity EmailVerificationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -6986,9 +7618,9 @@ export default { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_365, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_397, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_366, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_398, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.token === null) { @@ -7025,7 +7657,7 @@ export default { } } }, - 'hydrator-email_verification_7000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_374, user_375) { + 'hydrator-email_verification_8000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_406, user_407) { // compiled hydrator for entity EmailVerificationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7064,9 +7696,9 @@ export default { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_374, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_406, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_375, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_407, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.token === null) { @@ -7103,110 +7735,110 @@ export default { } } }, - 'comparator-email_verification_7000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-email_verification_8000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity EmailVerificationEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.token === null && last.token === undefined) { diff.token = current.token; } else if (current.token == null && last.token == null) { - + } else if ((current.token != null && last.token == null) || (current.token == null && last.token != null)) { diff.token = current.token; } else if (last.token !== current.token) { diff.token = current.token; } - + if (current.expiresAt === null && last.expiresAt === undefined) { diff.expiresAt = current.expiresAt; } else if (current.expiresAt == null && last.expiresAt == null) { - + } else if ((current.expiresAt != null && last.expiresAt == null) || (current.expiresAt == null && last.expiresAt != null)) { diff.expiresAt = current.expiresAt; } else if (last.expiresAt.valueOf() !== current.expiresAt.valueOf()) { diff.expiresAt = current.expiresAt; } - + if (current.verified === null && last.verified === undefined) { diff.verified = current.verified; } else if (current.verified == null && last.verified == null) { - + } else if ((current.verified != null && last.verified == null) || (current.verified == null && last.verified != null)) { diff.verified = current.verified; } else if (!compareBooleans(last.verified, current.verified)) { diff.verified = current.verified; } - + if (current.verifiedAt === null && last.verifiedAt === undefined) { diff.verifiedAt = current.verifiedAt; } else if (current.verifiedAt == null && last.verifiedAt == null) { - + } else if ((current.verifiedAt != null && last.verifiedAt == null) || (current.verifiedAt == null && last.verifiedAt != null)) { diff.verifiedAt = current.verifiedAt; } else if (last.verifiedAt.valueOf() !== current.verifiedAt.valueOf()) { diff.verifiedAt = current.verifiedAt; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-email_verification_7000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-email_verification_8000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -7216,27 +7848,27 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.token !== 'undefined') { ret.token = entity.token; } - + if (typeof entity.expiresAt !== 'undefined') { ret.expiresAt = clone(processDateProperty(entity.expiresAt)); } - + if (typeof entity.verified !== 'undefined') { ret.verified = entity.verified; } - + if (typeof entity.verifiedAt !== 'undefined') { ret.verifiedAt = clone(processDateProperty(entity.verifiedAt)); } - + return ret; } }, - 'resultMapper-email_verification_7000': function(PolymorphicRef, parseDate) { + 'resultMapper-email_verification_8000': function(PolymorphicRef, parseDate) { // compiled mapper for entity EmailVerificationEntity return function(result) { const ret = {}; @@ -7309,7 +7941,7 @@ export default { return ret; } }, - 'hydrator-email_verification_7000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-email_verification_8000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity EmailVerificationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7324,7 +7956,7 @@ export default { } } }, - 'hydrator-email_verification_7000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-email_verification_8000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity EmailVerificationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7339,26 +7971,26 @@ export default { } } }, - 'pkGetter-email_verification_7000': function(isEntityOrRef) { + 'pkGetter-email_verification_8000': function(isEntityOrRef) { // compiled pk getter for entity EmailVerificationEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-email_verification_7000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-email_verification_8000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity EmailVerificationEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-email_verification_7000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-email_verification_8000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity EmailVerificationEntity return function(entity) { const val_12 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_12); } }, - 'hydrator-bootstrap_state_1000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-bootstrap_state_2000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity BootstrapStateEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7395,7 +8027,7 @@ export default { } } }, - 'hydrator-bootstrap_state_1000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-bootstrap_state_2000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity BootstrapStateEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7432,78 +8064,78 @@ export default { } } }, - 'comparator-bootstrap_state_1000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-bootstrap_state_2000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity BootstrapStateEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.value === null && last.value === undefined) { diff.value = current.value; } else if (current.value == null && last.value == null) { - + } else if ((current.value != null && last.value == null) || (current.value == null && last.value != null)) { diff.value = current.value; } else if (last.value !== current.value) { diff.value = current.value; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-bootstrap_state_1000': function(clone, cloneEmbeddable, processDateProperty) { + 'snapshotGenerator-bootstrap_state_2000': function(clone, cloneEmbeddable, processDateProperty) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = entity.id; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.value !== 'undefined') { ret.value = entity.value; } - + return ret; } }, - 'resultMapper-bootstrap_state_1000': function(PolymorphicRef, parseDate) { + 'resultMapper-bootstrap_state_2000': function(PolymorphicRef, parseDate) { // compiled mapper for entity BootstrapStateEntity return function(result) { const ret = {}; @@ -7544,7 +8176,7 @@ export default { return ret; } }, - 'hydrator-bootstrap_state_1000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-bootstrap_state_2000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity BootstrapStateEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7554,7 +8186,7 @@ export default { } } }, - 'hydrator-bootstrap_state_1000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-bootstrap_state_2000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity BootstrapStateEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7564,22 +8196,558 @@ export default { } } }, - 'pkGetter-bootstrap_state_1000': function(isEntityOrRef) { + 'pkGetter-bootstrap_state_2000': function(isEntityOrRef) { // compiled pk getter for entity BootstrapStateEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-bootstrap_state_1000': function(isEntityOrRef) { + 'pkGetterConverted-bootstrap_state_2000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity BootstrapStateEntity return function(entity) { return entity.id; } }, - 'pkSerializer-bootstrap_state_1000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-bootstrap_state_2000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity BootstrapStateEntity return function(entity) { return '' + entity.id; } + }, + 'hydrator-background_jobs_1000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity BackgroundJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + if (data.created_at === null) { + entity.created_at = null; + } else if (typeof data.created_at !== 'undefined') { + if (data.created_at instanceof Date) { + entity.created_at = data.created_at; + } else if (typeof data.created_at === 'number' || data.created_at.includes('+') || data.created_at.lastIndexOf('-') > 10 || data.created_at.endsWith('Z')) { + entity.created_at = new Date(data.created_at); + } else { + entity.created_at = new Date(data.created_at + 'Z'); + } + } + if (data.updated_at === null) { + entity.updated_at = null; + } else if (typeof data.updated_at !== 'undefined') { + if (data.updated_at instanceof Date) { + entity.updated_at = data.updated_at; + } else if (typeof data.updated_at === 'number' || data.updated_at.includes('+') || data.updated_at.lastIndexOf('-') > 10 || data.updated_at.endsWith('Z')) { + entity.updated_at = new Date(data.updated_at); + } else { + entity.updated_at = new Date(data.updated_at + 'Z'); + } + } + if (data.jobId === null) { + entity.jobId = null; + } else if (typeof data.jobId !== 'undefined') { + entity.jobId = data.jobId; + } + if (data.payload === null) { + entity.payload = null; + } else if (typeof data.payload !== 'undefined') { + entity.payload = data.payload; + } + if (data.status === null) { + entity.status = null; + } else if (typeof data.status !== 'undefined') { + entity.status = data.status; + } + if (data.availableAt === null) { + entity.availableAt = null; + } else if (typeof data.availableAt !== 'undefined') { + if (data.availableAt instanceof Date) { + entity.availableAt = data.availableAt; + } else if (typeof data.availableAt === 'number' || data.availableAt.includes('+') || data.availableAt.lastIndexOf('-') > 10 || data.availableAt.endsWith('Z')) { + entity.availableAt = new Date(data.availableAt); + } else { + entity.availableAt = new Date(data.availableAt + 'Z'); + } + } + if (data.lockedBy === null) { + entity.lockedBy = null; + } else if (typeof data.lockedBy !== 'undefined') { + entity.lockedBy = data.lockedBy; + } + if (data.lockedUntil === null) { + entity.lockedUntil = null; + } else if (typeof data.lockedUntil !== 'undefined') { + if (data.lockedUntil instanceof Date) { + entity.lockedUntil = data.lockedUntil; + } else if (typeof data.lockedUntil === 'number' || data.lockedUntil.includes('+') || data.lockedUntil.lastIndexOf('-') > 10 || data.lockedUntil.endsWith('Z')) { + entity.lockedUntil = new Date(data.lockedUntil); + } else { + entity.lockedUntil = new Date(data.lockedUntil + 'Z'); + } + } + if (data.attemptCount === null) { + entity.attemptCount = null; + } else if (typeof data.attemptCount !== 'undefined') { + entity.attemptCount = data.attemptCount; + } + if (data.maxAttempts === null) { + entity.maxAttempts = null; + } else if (typeof data.maxAttempts !== 'undefined') { + entity.maxAttempts = data.maxAttempts; + } + if (data.lastError === null) { + entity.lastError = null; + } else if (typeof data.lastError !== 'undefined') { + entity.lastError = data.lastError; + } + if (data.completedAt === null) { + entity.completedAt = null; + } else if (typeof data.completedAt !== 'undefined') { + if (data.completedAt instanceof Date) { + entity.completedAt = data.completedAt; + } else if (typeof data.completedAt === 'number' || data.completedAt.includes('+') || data.completedAt.lastIndexOf('-') > 10 || data.completedAt.endsWith('Z')) { + entity.completedAt = new Date(data.completedAt); + } else { + entity.completedAt = new Date(data.completedAt + 'Z'); + } + } + } + }, + 'hydrator-background_jobs_1000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity BackgroundJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + if (data.created_at === null) { + entity.created_at = null; + } else if (typeof data.created_at !== 'undefined') { + if (data.created_at instanceof Date) { + entity.created_at = data.created_at; + } else if (typeof data.created_at === 'number' || data.created_at.includes('+') || data.created_at.lastIndexOf('-') > 10 || data.created_at.endsWith('Z')) { + entity.created_at = new Date(data.created_at); + } else { + entity.created_at = new Date(data.created_at + 'Z'); + } + } + if (data.updated_at === null) { + entity.updated_at = null; + } else if (typeof data.updated_at !== 'undefined') { + if (data.updated_at instanceof Date) { + entity.updated_at = data.updated_at; + } else if (typeof data.updated_at === 'number' || data.updated_at.includes('+') || data.updated_at.lastIndexOf('-') > 10 || data.updated_at.endsWith('Z')) { + entity.updated_at = new Date(data.updated_at); + } else { + entity.updated_at = new Date(data.updated_at + 'Z'); + } + } + if (data.jobId === null) { + entity.jobId = null; + } else if (typeof data.jobId !== 'undefined') { + entity.jobId = data.jobId; + } + if (data.payload === null) { + entity.payload = null; + } else if (typeof data.payload !== 'undefined') { + entity.payload = data.payload; + } + if (data.status === null) { + entity.status = null; + } else if (typeof data.status !== 'undefined') { + entity.status = data.status; + } + if (data.availableAt === null) { + entity.availableAt = null; + } else if (typeof data.availableAt !== 'undefined') { + if (data.availableAt instanceof Date) { + entity.availableAt = data.availableAt; + } else if (typeof data.availableAt === 'number' || data.availableAt.includes('+') || data.availableAt.lastIndexOf('-') > 10 || data.availableAt.endsWith('Z')) { + entity.availableAt = new Date(data.availableAt); + } else { + entity.availableAt = new Date(data.availableAt + 'Z'); + } + } + if (data.lockedBy === null) { + entity.lockedBy = null; + } else if (typeof data.lockedBy !== 'undefined') { + entity.lockedBy = data.lockedBy; + } + if (data.lockedUntil === null) { + entity.lockedUntil = null; + } else if (typeof data.lockedUntil !== 'undefined') { + if (data.lockedUntil instanceof Date) { + entity.lockedUntil = data.lockedUntil; + } else if (typeof data.lockedUntil === 'number' || data.lockedUntil.includes('+') || data.lockedUntil.lastIndexOf('-') > 10 || data.lockedUntil.endsWith('Z')) { + entity.lockedUntil = new Date(data.lockedUntil); + } else { + entity.lockedUntil = new Date(data.lockedUntil + 'Z'); + } + } + if (data.attemptCount === null) { + entity.attemptCount = null; + } else if (typeof data.attemptCount !== 'undefined') { + entity.attemptCount = data.attemptCount; + } + if (data.maxAttempts === null) { + entity.maxAttempts = null; + } else if (typeof data.maxAttempts !== 'undefined') { + entity.maxAttempts = data.maxAttempts; + } + if (data.lastError === null) { + entity.lastError = null; + } else if (typeof data.lastError !== 'undefined') { + entity.lastError = data.lastError; + } + if (data.completedAt === null) { + entity.completedAt = null; + } else if (typeof data.completedAt !== 'undefined') { + if (data.completedAt instanceof Date) { + entity.completedAt = data.completedAt; + } else if (typeof data.completedAt === 'number' || data.completedAt.includes('+') || data.completedAt.lastIndexOf('-') > 10 || data.completedAt.endsWith('Z')) { + entity.completedAt = new Date(data.completedAt); + } else { + entity.completedAt = new Date(data.completedAt + 'Z'); + } + } + } + }, + 'comparator-background_jobs_1000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + // compiled comparator for entity BackgroundJobEntity + return function(last, current, options) { + const diff = {}; + if (current.id === null && last.id === undefined) { + diff.id = current.id; + } else if (current.id == null && last.id == null) { + + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { + diff.id = current.id; + } else if (last.id !== current.id) { + diff.id = current.id; + } + + if (current.created_at === null && last.created_at === undefined) { + diff.created_at = current.created_at; + } else if (current.created_at == null && last.created_at == null) { + + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { + diff.created_at = current.created_at; + } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { + diff.created_at = current.created_at; + } + + if (current.updated_at === null && last.updated_at === undefined) { + diff.updated_at = current.updated_at; + } else if (current.updated_at == null && last.updated_at == null) { + + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { + diff.updated_at = current.updated_at; + } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { + diff.updated_at = current.updated_at; + } + + if (current.jobId === null && last.jobId === undefined) { + diff.jobId = current.jobId; + } else if (current.jobId == null && last.jobId == null) { + + } else if ((current.jobId != null && last.jobId == null) || (current.jobId == null && last.jobId != null)) { + diff.jobId = current.jobId; + } else if (last.jobId !== current.jobId) { + diff.jobId = current.jobId; + } + + if (current.payload === null && last.payload === undefined) { + diff.payload = current.payload; + } else if (current.payload == null && last.payload == null) { + + } else if ((current.payload != null && last.payload == null) || (current.payload == null && last.payload != null)) { + diff.payload = current.payload; + } else if (!equals(last.payload, current.payload)) { + diff.payload = current.payload; + } + + if (current.status === null && last.status === undefined) { + diff.status = current.status; + } else if (current.status == null && last.status == null) { + + } else if ((current.status != null && last.status == null) || (current.status == null && last.status != null)) { + diff.status = current.status; + } else if (last.status !== current.status) { + diff.status = current.status; + } + + if (current.availableAt === null && last.availableAt === undefined) { + diff.availableAt = current.availableAt; + } else if (current.availableAt == null && last.availableAt == null) { + + } else if ((current.availableAt != null && last.availableAt == null) || (current.availableAt == null && last.availableAt != null)) { + diff.availableAt = current.availableAt; + } else if (last.availableAt.valueOf() !== current.availableAt.valueOf()) { + diff.availableAt = current.availableAt; + } + + if (current.lockedBy === null && last.lockedBy === undefined) { + diff.lockedBy = current.lockedBy; + } else if (current.lockedBy == null && last.lockedBy == null) { + + } else if ((current.lockedBy != null && last.lockedBy == null) || (current.lockedBy == null && last.lockedBy != null)) { + diff.lockedBy = current.lockedBy; + } else if (last.lockedBy !== current.lockedBy) { + diff.lockedBy = current.lockedBy; + } + + if (current.lockedUntil === null && last.lockedUntil === undefined) { + diff.lockedUntil = current.lockedUntil; + } else if (current.lockedUntil == null && last.lockedUntil == null) { + + } else if ((current.lockedUntil != null && last.lockedUntil == null) || (current.lockedUntil == null && last.lockedUntil != null)) { + diff.lockedUntil = current.lockedUntil; + } else if (last.lockedUntil.valueOf() !== current.lockedUntil.valueOf()) { + diff.lockedUntil = current.lockedUntil; + } + + if (current.attemptCount === null && last.attemptCount === undefined) { + diff.attemptCount = current.attemptCount; + } else if (current.attemptCount == null && last.attemptCount == null) { + + } else if ((current.attemptCount != null && last.attemptCount == null) || (current.attemptCount == null && last.attemptCount != null)) { + diff.attemptCount = current.attemptCount; + } else if (!equals(last.attemptCount, current.attemptCount)) { + diff.attemptCount = current.attemptCount; + } + + if (current.maxAttempts === null && last.maxAttempts === undefined) { + diff.maxAttempts = current.maxAttempts; + } else if (current.maxAttempts == null && last.maxAttempts == null) { + + } else if ((current.maxAttempts != null && last.maxAttempts == null) || (current.maxAttempts == null && last.maxAttempts != null)) { + diff.maxAttempts = current.maxAttempts; + } else if (!equals(last.maxAttempts, current.maxAttempts)) { + diff.maxAttempts = current.maxAttempts; + } + + if (current.lastError === null && last.lastError === undefined) { + diff.lastError = current.lastError; + } else if (current.lastError == null && last.lastError == null) { + + } else if ((current.lastError != null && last.lastError == null) || (current.lastError == null && last.lastError != null)) { + diff.lastError = current.lastError; + } else if (!equals(last.lastError, current.lastError)) { + diff.lastError = current.lastError; + } + + if (current.completedAt === null && last.completedAt === undefined) { + diff.completedAt = current.completedAt; + } else if (current.completedAt == null && last.completedAt == null) { + + } else if ((current.completedAt != null && last.completedAt == null) || (current.completedAt == null && last.completedAt != null)) { + diff.completedAt = current.completedAt; + } else if (last.completedAt.valueOf() !== current.completedAt.valueOf()) { + diff.completedAt = current.completedAt; + } + + if (options?.includeInverseSides) { + } + return diff; + } + }, + 'snapshotGenerator-background_jobs_1000': function(clone, cloneEmbeddable, processDateProperty) { + return function(entity) { + const ret = {}; + if (typeof entity.id !== 'undefined') { + ret.id = entity.id; + } + + if (typeof entity.created_at !== 'undefined') { + ret.created_at = clone(processDateProperty(entity.created_at)); + } + + if (typeof entity.updated_at !== 'undefined') { + ret.updated_at = clone(processDateProperty(entity.updated_at)); + } + + if (typeof entity.jobId !== 'undefined') { + ret.jobId = entity.jobId; + } + + if (typeof entity.payload !== 'undefined') { + ret.payload = clone(entity.payload); + } + + if (typeof entity.status !== 'undefined') { + ret.status = entity.status; + } + + if (typeof entity.availableAt !== 'undefined') { + ret.availableAt = clone(processDateProperty(entity.availableAt)); + } + + if (typeof entity.lockedBy !== 'undefined') { + ret.lockedBy = entity.lockedBy; + } + + if (typeof entity.lockedUntil !== 'undefined') { + ret.lockedUntil = clone(processDateProperty(entity.lockedUntil)); + } + + if (typeof entity.attemptCount !== 'undefined') { + ret.attemptCount = clone(entity.attemptCount); + } + + if (typeof entity.maxAttempts !== 'undefined') { + ret.maxAttempts = clone(entity.maxAttempts); + } + + if (typeof entity.lastError !== 'undefined') { + ret.lastError = clone(entity.lastError); + } + + if (typeof entity.completedAt !== 'undefined') { + ret.completedAt = clone(processDateProperty(entity.completedAt)); + } + + return ret; + } + }, + 'resultMapper-background_jobs_1000': function(PolymorphicRef, parseDate) { + // compiled mapper for entity BackgroundJobEntity + return function(result) { + const ret = {}; + const mapped = {}; + if (typeof result.id !== 'undefined') { + ret.id = result.id; + mapped.id = true; + } + if (typeof result.created_at !== 'undefined') { + if (result.created_at == null || result.created_at instanceof Date) { + ret.created_at = result.created_at; + } else if (typeof result.created_at === 'bigint') { + ret.created_at = parseDate(Number(result.created_at)); + } else if (typeof result.created_at === 'number' || result.created_at.includes('+') || result.created_at.lastIndexOf('-') > 10 || result.created_at.endsWith('Z')) { + ret.created_at = parseDate(result.created_at); + } else { + ret.created_at = parseDate(result.created_at + 'Z'); + } + mapped.created_at = true; + } + if (typeof result.updated_at !== 'undefined') { + if (result.updated_at == null || result.updated_at instanceof Date) { + ret.updated_at = result.updated_at; + } else if (typeof result.updated_at === 'bigint') { + ret.updated_at = parseDate(Number(result.updated_at)); + } else if (typeof result.updated_at === 'number' || result.updated_at.includes('+') || result.updated_at.lastIndexOf('-') > 10 || result.updated_at.endsWith('Z')) { + ret.updated_at = parseDate(result.updated_at); + } else { + ret.updated_at = parseDate(result.updated_at + 'Z'); + } + mapped.updated_at = true; + } + if (typeof result.job_id !== 'undefined') { + ret.jobId = result.job_id; + mapped.job_id = true; + } + if (typeof result.payload !== 'undefined') { + ret.payload = result.payload; + mapped.payload = true; + } + if (typeof result.status !== 'undefined') { + ret.status = result.status; + mapped.status = true; + } + if (typeof result.available_at !== 'undefined') { + if (result.available_at == null || result.available_at instanceof Date) { + ret.availableAt = result.available_at; + } else if (typeof result.available_at === 'bigint') { + ret.availableAt = parseDate(Number(result.available_at)); + } else if (typeof result.available_at === 'number' || result.available_at.includes('+') || result.available_at.lastIndexOf('-') > 10 || result.available_at.endsWith('Z')) { + ret.availableAt = parseDate(result.available_at); + } else { + ret.availableAt = parseDate(result.available_at + 'Z'); + } + mapped.available_at = true; + } + if (typeof result.locked_by !== 'undefined') { + ret.lockedBy = result.locked_by; + mapped.locked_by = true; + } + if (typeof result.locked_until !== 'undefined') { + if (result.locked_until == null || result.locked_until instanceof Date) { + ret.lockedUntil = result.locked_until; + } else if (typeof result.locked_until === 'bigint') { + ret.lockedUntil = parseDate(Number(result.locked_until)); + } else if (typeof result.locked_until === 'number' || result.locked_until.includes('+') || result.locked_until.lastIndexOf('-') > 10 || result.locked_until.endsWith('Z')) { + ret.lockedUntil = parseDate(result.locked_until); + } else { + ret.lockedUntil = parseDate(result.locked_until + 'Z'); + } + mapped.locked_until = true; + } + if (typeof result.attempt_count !== 'undefined') { + ret.attemptCount = result.attempt_count; + mapped.attempt_count = true; + } + if (typeof result.max_attempts !== 'undefined') { + ret.maxAttempts = result.max_attempts; + mapped.max_attempts = true; + } + if (typeof result.last_error !== 'undefined') { + ret.lastError = result.last_error; + mapped.last_error = true; + } + if (typeof result.completed_at !== 'undefined') { + if (result.completed_at == null || result.completed_at instanceof Date) { + ret.completedAt = result.completed_at; + } else if (typeof result.completed_at === 'bigint') { + ret.completedAt = parseDate(Number(result.completed_at)); + } else if (typeof result.completed_at === 'number' || result.completed_at.includes('+') || result.completed_at.lastIndexOf('-') > 10 || result.completed_at.endsWith('Z')) { + ret.completedAt = parseDate(result.completed_at); + } else { + ret.completedAt = parseDate(result.completed_at + 'Z'); + } + mapped.completed_at = true; + } + for (let k in result) { if (Object.hasOwn(result, k) && !mapped[k] && ret[k] === undefined) ret[k] = result[k]; } + return ret; + } + }, + 'hydrator-background_jobs_1000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity BackgroundJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + } + }, + 'hydrator-background_jobs_1000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity BackgroundJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + } + }, + 'pkGetter-background_jobs_1000': function(isEntityOrRef) { + // compiled pk getter for entity BackgroundJobEntity + return function(entity) { + return entity.id; + } + }, + 'pkGetterConverted-background_jobs_1000': function(isEntityOrRef) { + // compiled pk getter (with converted custom types) for entity BackgroundJobEntity + return function(entity) { + return entity.id; + } + }, + 'pkSerializer-background_jobs_1000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + // compiled pk serializer for entity BackgroundJobEntity + return function(entity) { + return '' + entity.id; + } } }; diff --git a/packages/server/src/entrypoints/database/sqlite/compiled-functions.js b/packages/server/src/entrypoints/database/sqlite/compiled-functions.js index 193e89b5..56d9b53b 100644 --- a/packages/server/src/entrypoints/database/sqlite/compiled-functions.js +++ b/packages/server/src/entrypoints/database/sqlite/compiled-functions.js @@ -1,6 +1,6 @@ export default { __version: '7.0.14', - 'hydrator-user_totp_recovery_code_5000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_3, user_4) { + 'hydrator-user_totp_recovery_code_6000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_3, user_4) { // compiled hydrator for entity UserTotpRecoveryCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -67,7 +67,7 @@ export default { } } }, - 'hydrator-user_totp_recovery_code_5000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_11, user_12) { + 'hydrator-user_totp_recovery_code_6000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_11, user_12) { // compiled hydrator for entity UserTotpRecoveryCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -134,100 +134,100 @@ export default { } } }, - 'comparator-user_totp_recovery_code_5000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_totp_recovery_code_6000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserTotpRecoveryCodeEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.code_hash === null && last.code_hash === undefined) { diff.code_hash = current.code_hash; } else if (current.code_hash == null && last.code_hash == null) { - + } else if ((current.code_hash != null && last.code_hash == null) || (current.code_hash == null && last.code_hash != null)) { diff.code_hash = current.code_hash; } else if (last.code_hash !== current.code_hash) { diff.code_hash = current.code_hash; } - + if (current.used === null && last.used === undefined) { diff.used = current.used; } else if (current.used == null && last.used == null) { - + } else if ((current.used != null && last.used == null) || (current.used == null && last.used != null)) { diff.used = current.used; } else if (!compareBooleans(last.used, current.used)) { diff.used = current.used; } - + if (current.used_at === null && last.used_at === undefined) { diff.used_at = current.used_at; } else if (current.used_at == null && last.used_at == null) { - + } else if ((current.used_at != null && last.used_at == null) || (current.used_at == null && last.used_at != null)) { diff.used_at = current.used_at; } else if (last.used_at.valueOf() !== current.used_at.valueOf()) { diff.used_at = current.used_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_totp_recovery_code_5000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-user_totp_recovery_code_6000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -237,23 +237,23 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.code_hash !== 'undefined') { ret.code_hash = entity.code_hash; } - + if (typeof entity.used !== 'undefined') { ret.used = entity.used; } - + if (typeof entity.used_at !== 'undefined') { ret.used_at = clone(processDateProperty(entity.used_at)); } - + return ret; } }, - 'resultMapper-user_totp_recovery_code_5000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_totp_recovery_code_6000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserTotpRecoveryCodeEntity return function(result) { const ret = {}; @@ -314,7 +314,7 @@ export default { return ret; } }, - 'hydrator-user_totp_recovery_code_5000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_totp_recovery_code_6000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTotpRecoveryCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -329,7 +329,7 @@ export default { } } }, - 'hydrator-user_totp_recovery_code_5000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_totp_recovery_code_6000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTotpRecoveryCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -344,26 +344,26 @@ export default { } } }, - 'pkGetter-user_totp_recovery_code_5000': function(isEntityOrRef) { + 'pkGetter-user_totp_recovery_code_6000': function(isEntityOrRef) { // compiled pk getter for entity UserTotpRecoveryCodeEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_totp_recovery_code_5000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_totp_recovery_code_6000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserTotpRecoveryCodeEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_totp_recovery_code_5000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_totp_recovery_code_6000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserTotpRecoveryCodeEntity return function(entity) { const val_0 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_0); } }, - 'hydrator-user_totp_4000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_21, user_22) { + 'hydrator-user_totp_5000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_21, user_22) { // compiled hydrator for entity UserTotpEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -424,7 +424,7 @@ export default { } } }, - 'hydrator-user_totp_4000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_29, user_30) { + 'hydrator-user_totp_5000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_29, user_30) { // compiled hydrator for entity UserTotpEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -485,100 +485,100 @@ export default { } } }, - 'comparator-user_totp_4000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_totp_5000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserTotpEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.secret === null && last.secret === undefined) { diff.secret = current.secret; } else if (current.secret == null && last.secret == null) { - + } else if ((current.secret != null && last.secret == null) || (current.secret == null && last.secret != null)) { diff.secret = current.secret; } else if (last.secret !== current.secret) { diff.secret = current.secret; } - + if (current.verified === null && last.verified === undefined) { diff.verified = current.verified; } else if (current.verified == null && last.verified == null) { - + } else if ((current.verified != null && last.verified == null) || (current.verified == null && last.verified != null)) { diff.verified = current.verified; } else if (!compareBooleans(last.verified, current.verified)) { diff.verified = current.verified; } - + if (current.recovery_confirmed === null && last.recovery_confirmed === undefined) { diff.recovery_confirmed = current.recovery_confirmed; } else if (current.recovery_confirmed == null && last.recovery_confirmed == null) { - + } else if ((current.recovery_confirmed != null && last.recovery_confirmed == null) || (current.recovery_confirmed == null && last.recovery_confirmed != null)) { diff.recovery_confirmed = current.recovery_confirmed; } else if (!compareBooleans(last.recovery_confirmed, current.recovery_confirmed)) { diff.recovery_confirmed = current.recovery_confirmed; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_totp_4000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-user_totp_5000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -588,23 +588,23 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.secret !== 'undefined') { ret.secret = entity.secret; } - + if (typeof entity.verified !== 'undefined') { ret.verified = entity.verified; } - + if (typeof entity.recovery_confirmed !== 'undefined') { ret.recovery_confirmed = entity.recovery_confirmed; } - + return ret; } }, - 'resultMapper-user_totp_4000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_totp_5000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserTotpEntity return function(result) { const ret = {}; @@ -657,7 +657,7 @@ export default { return ret; } }, - 'hydrator-user_totp_4000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_totp_5000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTotpEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -672,7 +672,7 @@ export default { } } }, - 'hydrator-user_totp_4000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_totp_5000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTotpEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -687,26 +687,26 @@ export default { } } }, - 'pkGetter-user_totp_4000': function(isEntityOrRef) { + 'pkGetter-user_totp_5000': function(isEntityOrRef) { // compiled pk getter for entity UserTotpEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_totp_4000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_totp_5000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserTotpEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_totp_4000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_totp_5000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserTotpEntity return function(entity) { const val_1 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_1); } }, - 'hydrator-user_terms_consent_16000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_39, user_40, terms_41, terms_42) { + 'hydrator-user_terms_consent_18000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_39, user_40, terms_41, terms_42) { // compiled hydrator for entity UserTermsConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -787,7 +787,7 @@ export default { } } }, - 'hydrator-user_terms_consent_16000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_50, user_51, terms_52, terms_53) { + 'hydrator-user_terms_consent_18000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_50, user_51, terms_52, terms_53) { // compiled hydrator for entity UserTermsConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -868,120 +868,120 @@ export default { } } }, - 'comparator-user_terms_consent_16000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_terms_consent_18000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserTermsConsentEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.terms === null && last.terms === undefined) { diff.terms = current.terms; } else if (current.terms == null && last.terms == null) { - + } else if ((current.terms != null && last.terms == null) || (current.terms == null && last.terms != null)) { diff.terms = current.terms; } else if (last.terms !== current.terms) { diff.terms = current.terms; } - + if (current.termsVersion === null && last.termsVersion === undefined) { diff.termsVersion = current.termsVersion; } else if (current.termsVersion == null && last.termsVersion == null) { - + } else if ((current.termsVersion != null && last.termsVersion == null) || (current.termsVersion == null && last.termsVersion != null)) { diff.termsVersion = current.termsVersion; } else if (last.termsVersion !== current.termsVersion) { diff.termsVersion = current.termsVersion; } - + if (current.agreed === null && last.agreed === undefined) { diff.agreed = current.agreed; } else if (current.agreed == null && last.agreed == null) { - + } else if ((current.agreed != null && last.agreed == null) || (current.agreed == null && last.agreed != null)) { diff.agreed = current.agreed; } else if (!compareBooleans(last.agreed, current.agreed)) { diff.agreed = current.agreed; } - + if (current.consentType === null && last.consentType === undefined) { diff.consentType = current.consentType; } else if (current.consentType == null && last.consentType == null) { - + } else if ((current.consentType != null && last.consentType == null) || (current.consentType == null && last.consentType != null)) { diff.consentType = current.consentType; } else if (last.consentType !== current.consentType) { diff.consentType = current.consentType; } - + if (current.agreedAt === null && last.agreedAt === undefined) { diff.agreedAt = current.agreedAt; } else if (current.agreedAt == null && last.agreedAt == null) { - + } else if ((current.agreedAt != null && last.agreedAt == null) || (current.agreedAt == null && last.agreedAt != null)) { diff.agreedAt = current.agreedAt; } else if (last.agreedAt.valueOf() !== current.agreedAt.valueOf()) { diff.agreedAt = current.agreedAt; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_terms_consent_16000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-user_terms_consent_18000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -991,7 +991,7 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.terms !== 'undefined') { if (entity.terms === null) { ret.terms = null; @@ -1001,27 +1001,27 @@ export default { ret.terms = toArray(entity.terms.__helper.getPrimaryKey(true)); } } - + if (typeof entity.termsVersion !== 'undefined') { ret.termsVersion = entity.termsVersion; } - + if (typeof entity.agreed !== 'undefined') { ret.agreed = entity.agreed; } - + if (typeof entity.consentType !== 'undefined') { ret.consentType = entity.consentType; } - + if (typeof entity.agreedAt !== 'undefined') { ret.agreedAt = clone(processDateProperty(entity.agreedAt)); } - + return ret; } }, - 'resultMapper-user_terms_consent_16000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_terms_consent_18000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserTermsConsentEntity return function(result) { const ret = {}; @@ -1090,7 +1090,7 @@ export default { return ret; } }, - 'hydrator-user_terms_consent_16000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_terms_consent_18000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTermsConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1105,7 +1105,7 @@ export default { } } }, - 'hydrator-user_terms_consent_16000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_terms_consent_18000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserTermsConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1120,26 +1120,26 @@ export default { } } }, - 'pkGetter-user_terms_consent_16000': function(isEntityOrRef) { + 'pkGetter-user_terms_consent_18000': function(isEntityOrRef) { // compiled pk getter for entity UserTermsConsentEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_terms_consent_16000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_terms_consent_18000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserTermsConsentEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_terms_consent_16000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_terms_consent_18000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserTermsConsentEntity return function(entity) { const val_2 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_2); } }, - 'hydrator-user_passkey_3000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_63, user_64, convertToJSValue_transports, convertToDatabaseValue_transports) { + 'hydrator-user_passkey_4000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_63, user_64, convertToJSValue_transports, convertToDatabaseValue_transports) { // compiled hydrator for entity UserPasskeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1231,7 +1231,7 @@ export default { } } }, - 'hydrator-user_passkey_3000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_76, user_77, convertToJSValue_transports, convertToDatabaseValue_transports) { + 'hydrator-user_passkey_4000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_76, user_77, convertToJSValue_transports, convertToDatabaseValue_transports) { // compiled hydrator for entity UserPasskeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1323,150 +1323,150 @@ export default { } } }, - 'comparator-user_passkey_3000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_passkey_4000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserPasskeyEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.credential_id === null && last.credential_id === undefined) { diff.credential_id = current.credential_id; } else if (current.credential_id == null && last.credential_id == null) { - + } else if ((current.credential_id != null && last.credential_id == null) || (current.credential_id == null && last.credential_id != null)) { diff.credential_id = current.credential_id; } else if (last.credential_id !== current.credential_id) { diff.credential_id = current.credential_id; } - + if (current.public_key === null && last.public_key === undefined) { diff.public_key = current.public_key; } else if (current.public_key == null && last.public_key == null) { - + } else if ((current.public_key != null && last.public_key == null) || (current.public_key == null && last.public_key != null)) { diff.public_key = current.public_key; } else if (!equals(last.public_key, current.public_key)) { diff.public_key = current.public_key; } - + if (current.counter === null && last.counter === undefined) { diff.counter = current.counter; } else if (current.counter == null && last.counter == null) { - + } else if ((current.counter != null && last.counter == null) || (current.counter == null && last.counter != null)) { diff.counter = current.counter; } else if (!equals(last.counter, current.counter)) { diff.counter = current.counter; } - + if (current.device_type === null && last.device_type === undefined) { diff.device_type = current.device_type; } else if (current.device_type == null && last.device_type == null) { - + } else if ((current.device_type != null && last.device_type == null) || (current.device_type == null && last.device_type != null)) { diff.device_type = current.device_type; } else if (last.device_type !== current.device_type) { diff.device_type = current.device_type; } - + if (current.backed_up === null && last.backed_up === undefined) { diff.backed_up = current.backed_up; } else if (current.backed_up == null && last.backed_up == null) { - + } else if ((current.backed_up != null && last.backed_up == null) || (current.backed_up == null && last.backed_up != null)) { diff.backed_up = current.backed_up; } else if (!compareBooleans(last.backed_up, current.backed_up)) { diff.backed_up = current.backed_up; } - + if (current.transports === null && last.transports === undefined) { diff.transports = current.transports; } else if (current.transports == null && last.transports == null) { - + } else if ((current.transports != null && last.transports == null) || (current.transports == null && last.transports != null)) { diff.transports = current.transports; } else if (!equals(last.transports, current.transports)) { diff.transports = current.transports; } - + if (current.name === null && last.name === undefined) { diff.name = current.name; } else if (current.name == null && last.name == null) { - + } else if ((current.name != null && last.name == null) || (current.name == null && last.name != null)) { diff.name = current.name; } else if (last.name !== current.name) { diff.name = current.name; } - + if (current.aaguid === null && last.aaguid === undefined) { diff.aaguid = current.aaguid; } else if (current.aaguid == null && last.aaguid == null) { - + } else if ((current.aaguid != null && last.aaguid == null) || (current.aaguid == null && last.aaguid != null)) { diff.aaguid = current.aaguid; } else if (last.aaguid !== current.aaguid) { diff.aaguid = current.aaguid; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_passkey_3000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_transports) { + 'snapshotGenerator-user_passkey_4000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_transports) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -1476,43 +1476,43 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.credential_id !== 'undefined') { ret.credential_id = entity.credential_id; } - + if (typeof entity.public_key !== 'undefined') { ret.public_key = clone(entity.public_key); } - + if (typeof entity.counter !== 'undefined') { ret.counter = clone(entity.counter); } - + if (typeof entity.device_type !== 'undefined') { ret.device_type = entity.device_type; } - + if (typeof entity.backed_up !== 'undefined') { ret.backed_up = entity.backed_up; } - + if (typeof entity.transports !== 'undefined') { ret.transports = clone(convertToDatabaseValue_transports(entity.transports)); } - + if (typeof entity.name !== 'undefined') { ret.name = entity.name; } - + if (typeof entity.aaguid !== 'undefined') { ret.aaguid = entity.aaguid; } - + return ret; } }, - 'resultMapper-user_passkey_3000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_passkey_4000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserPasskeyEntity return function(result) { const ret = {}; @@ -1585,7 +1585,7 @@ export default { return ret; } }, - 'hydrator-user_passkey_3000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_passkey_4000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserPasskeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1600,7 +1600,7 @@ export default { } } }, - 'hydrator-user_passkey_3000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_passkey_4000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserPasskeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1615,26 +1615,26 @@ export default { } } }, - 'pkGetter-user_passkey_3000': function(isEntityOrRef) { + 'pkGetter-user_passkey_4000': function(isEntityOrRef) { // compiled pk getter for entity UserPasskeyEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_passkey_3000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_passkey_4000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserPasskeyEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_passkey_3000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_passkey_4000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserPasskeyEntity return function(entity) { const val_3 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_3); } }, - 'hydrator-user_oauth_2000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_91, user_92) { + 'hydrator-user_oauth_3000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_91, user_92) { // compiled hydrator for entity UserOAuthEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1712,7 +1712,7 @@ export default { } } }, - 'hydrator-user_oauth_2000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_101, user_102) { + 'hydrator-user_oauth_3000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_101, user_102) { // compiled hydrator for entity UserOAuthEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -1790,120 +1790,120 @@ export default { } } }, - 'comparator-user_oauth_2000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals, compareValues_4) { + 'comparator-user_oauth_3000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals, compareValues_4) { // compiled comparator for entity UserOAuthEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (!compareValues_4(last.id, current.id)) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.provider_name === null && last.provider_name === undefined) { diff.provider_name = current.provider_name; } else if (current.provider_name == null && last.provider_name == null) { - + } else if ((current.provider_name != null && last.provider_name == null) || (current.provider_name == null && last.provider_name != null)) { diff.provider_name = current.provider_name; } else if (last.provider_name !== current.provider_name) { diff.provider_name = current.provider_name; } - + if (current.provider_user_id === null && last.provider_user_id === undefined) { diff.provider_user_id = current.provider_user_id; } else if (current.provider_user_id == null && last.provider_user_id == null) { - + } else if ((current.provider_user_id != null && last.provider_user_id == null) || (current.provider_user_id == null && last.provider_user_id != null)) { diff.provider_user_id = current.provider_user_id; } else if (last.provider_user_id !== current.provider_user_id) { diff.provider_user_id = current.provider_user_id; } - + if (current.access_token === null && last.access_token === undefined) { diff.access_token = current.access_token; } else if (current.access_token == null && last.access_token == null) { - + } else if ((current.access_token != null && last.access_token == null) || (current.access_token == null && last.access_token != null)) { diff.access_token = current.access_token; } else if (last.access_token !== current.access_token) { diff.access_token = current.access_token; } - + if (current.refresh_token === null && last.refresh_token === undefined) { diff.refresh_token = current.refresh_token; } else if (current.refresh_token == null && last.refresh_token == null) { - + } else if ((current.refresh_token != null && last.refresh_token == null) || (current.refresh_token == null && last.refresh_token != null)) { diff.refresh_token = current.refresh_token; } else if (last.refresh_token !== current.refresh_token) { diff.refresh_token = current.refresh_token; } - + if (current.expires_at === null && last.expires_at === undefined) { diff.expires_at = current.expires_at; } else if (current.expires_at == null && last.expires_at == null) { - + } else if ((current.expires_at != null && last.expires_at == null) || (current.expires_at == null && last.expires_at != null)) { diff.expires_at = current.expires_at; } else if (last.expires_at.valueOf() !== current.expires_at.valueOf()) { diff.expires_at = current.expires_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_oauth_2000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-user_oauth_3000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -1913,31 +1913,31 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.provider_name !== 'undefined') { ret.provider_name = entity.provider_name; } - + if (typeof entity.provider_user_id !== 'undefined') { ret.provider_user_id = entity.provider_user_id; } - + if (typeof entity.access_token !== 'undefined') { ret.access_token = entity.access_token; } - + if (typeof entity.refresh_token !== 'undefined') { ret.refresh_token = entity.refresh_token; } - + if (typeof entity.expires_at !== 'undefined') { ret.expires_at = clone(processDateProperty(entity.expires_at)); } - + return ret; } }, - 'resultMapper-user_oauth_2000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_oauth_3000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserOAuthEntity return function(result) { const ret = {}; @@ -2006,7 +2006,7 @@ export default { return ret; } }, - 'hydrator-user_oauth_2000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_oauth_3000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserOAuthEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -2022,7 +2022,7 @@ export default { } } }, - 'hydrator-user_oauth_2000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_oauth_3000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserOAuthEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -2038,26 +2038,26 @@ export default { } } }, - 'pkGetter-user_oauth_2000': function(isEntityOrRef) { + 'pkGetter-user_oauth_3000': function(isEntityOrRef) { // compiled pk getter for entity UserOAuthEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_oauth_2000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_oauth_3000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserOAuthEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_oauth_2000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_oauth_3000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserOAuthEntity return function(entity) { const val_5 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_5); } }, - 'hydrator-user_6000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, user_oauth_119, user_passkey_120, user_totp_121, user_totp_recovery_code_122) { + 'hydrator-user_7000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, user_oauth_119, user_passkey_120, user_totp_121, user_totp_recovery_code_122) { // compiled hydrator for entity UserEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.sub === null) { @@ -2213,7 +2213,7 @@ export default { } } }, - 'hydrator-user_6000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, user_oauth_132, user_passkey_133, user_totp_134, user_totp_recovery_code_135) { + 'hydrator-user_7000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, user_oauth_132, user_passkey_133, user_totp_134, user_totp_recovery_code_135) { // compiled hydrator for entity UserEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.sub === null) { @@ -2369,148 +2369,148 @@ export default { } } }, - 'comparator-user_6000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_7000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserEntity return function(last, current, options) { const diff = {}; if (current.sub === null && last.sub === undefined) { diff.sub = current.sub; } else if (current.sub == null && last.sub == null) { - + } else if ((current.sub != null && last.sub == null) || (current.sub == null && last.sub != null)) { diff.sub = current.sub; } else if (last.sub !== current.sub) { diff.sub = current.sub; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.email === null && last.email === undefined) { diff.email = current.email; } else if (current.email == null && last.email == null) { - + } else if ((current.email != null && last.email == null) || (current.email == null && last.email != null)) { diff.email = current.email; } else if (last.email !== current.email) { diff.email = current.email; } - + if (current.email_verified === null && last.email_verified === undefined) { diff.email_verified = current.email_verified; } else if (current.email_verified == null && last.email_verified == null) { - + } else if ((current.email_verified != null && last.email_verified == null) || (current.email_verified == null && last.email_verified != null)) { diff.email_verified = current.email_verified; } else if (!compareBooleans(last.email_verified, current.email_verified)) { diff.email_verified = current.email_verified; } - + if (current.password_hash === null && last.password_hash === undefined) { diff.password_hash = current.password_hash; } else if (current.password_hash == null && last.password_hash == null) { - + } else if ((current.password_hash != null && last.password_hash == null) || (current.password_hash == null && last.password_hash != null)) { diff.password_hash = current.password_hash; } else if (last.password_hash !== current.password_hash) { diff.password_hash = current.password_hash; } - + if (current.managed_by === null && last.managed_by === undefined) { diff.managed_by = current.managed_by; } else if (current.managed_by == null && last.managed_by == null) { - + } else if ((current.managed_by != null && last.managed_by == null) || (current.managed_by == null && last.managed_by != null)) { diff.managed_by = current.managed_by; } else if (last.managed_by !== current.managed_by) { diff.managed_by = current.managed_by; } - + if (current.role === null && last.role === undefined) { diff.role = current.role; } else if (current.role == null && last.role == null) { - + } else if ((current.role != null && last.role == null) || (current.role == null && last.role != null)) { diff.role = current.role; } else if (last.role !== current.role) { diff.role = current.role; } - + if (current.deleted_at === null && last.deleted_at === undefined) { diff.deleted_at = current.deleted_at; } else if (current.deleted_at == null && last.deleted_at == null) { - + } else if ((current.deleted_at != null && last.deleted_at == null) || (current.deleted_at == null && last.deleted_at != null)) { diff.deleted_at = current.deleted_at; } else if (last.deleted_at.valueOf() !== current.deleted_at.valueOf()) { diff.deleted_at = current.deleted_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_6000': function(clone, cloneEmbeddable, processDateProperty) { + 'snapshotGenerator-user_7000': function(clone, cloneEmbeddable, processDateProperty) { return function(entity) { const ret = {}; if (typeof entity.sub !== 'undefined') { ret.sub = entity.sub; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.email !== 'undefined') { ret.email = entity.email; } - + if (typeof entity.email_verified !== 'undefined') { ret.email_verified = entity.email_verified; } - + if (typeof entity.password_hash !== 'undefined') { ret.password_hash = entity.password_hash; } - + if (typeof entity.managed_by !== 'undefined') { ret.managed_by = entity.managed_by; } - + if (typeof entity.role !== 'undefined') { ret.role = entity.role; } - + if (typeof entity.deleted_at !== 'undefined') { ret.deleted_at = clone(processDateProperty(entity.deleted_at)); } - + return ret; } }, - 'resultMapper-user_6000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_7000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserEntity return function(result) { const ret = {}; @@ -2579,7 +2579,7 @@ export default { return ret; } }, - 'hydrator-user_6000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-user_7000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity UserEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.sub === null) { @@ -2589,7 +2589,7 @@ export default { } } }, - 'hydrator-user_6000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-user_7000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity UserEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.sub === null) { @@ -2599,25 +2599,25 @@ export default { } } }, - 'pkGetter-user_6000': function(isEntityOrRef) { + 'pkGetter-user_7000': function(isEntityOrRef) { // compiled pk getter for entity UserEntity return function(entity) { return entity.sub; } }, - 'pkGetterConverted-user_6000': function(isEntityOrRef) { + 'pkGetterConverted-user_7000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity UserEntity return function(entity) { return entity.sub; } }, - 'pkSerializer-user_6000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-user_7000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity UserEntity return function(entity) { return '' + entity.sub; } }, - 'hydrator-user_consent_11000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_141, user_142, oauth_client_143, oauth_client_144, convertToJSValue_scopes, convertToDatabaseValue_scopes) { + 'hydrator-user_consent_12000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_141, user_142, oauth_client_143, oauth_client_144, convertToJSValue_scopes, convertToDatabaseValue_scopes) { // compiled hydrator for entity UserConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -2705,7 +2705,7 @@ export default { } } }, - 'hydrator-user_consent_11000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_151, user_152, oauth_client_153, oauth_client_154, convertToJSValue_scopes, convertToDatabaseValue_scopes) { + 'hydrator-user_consent_12000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_151, user_152, oauth_client_153, oauth_client_154, convertToJSValue_scopes, convertToDatabaseValue_scopes) { // compiled hydrator for entity UserConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -2793,110 +2793,110 @@ export default { } } }, - 'comparator-user_consent_11000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-user_consent_12000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity UserConsentEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.client === null && last.client === undefined) { diff.client = current.client; } else if (current.client == null && last.client == null) { - + } else if ((current.client != null && last.client == null) || (current.client == null && last.client != null)) { diff.client = current.client; } else if (last.client !== current.client) { diff.client = current.client; } - + if (current.scopes === null && last.scopes === undefined) { diff.scopes = current.scopes; } else if (current.scopes == null && last.scopes == null) { - + } else if ((current.scopes != null && last.scopes == null) || (current.scopes == null && last.scopes != null)) { diff.scopes = current.scopes; } else if (!equals(last.scopes, current.scopes)) { diff.scopes = current.scopes; } - + if (current.granted_at === null && last.granted_at === undefined) { diff.granted_at = current.granted_at; } else if (current.granted_at == null && last.granted_at == null) { - + } else if ((current.granted_at != null && last.granted_at == null) || (current.granted_at == null && last.granted_at != null)) { diff.granted_at = current.granted_at; } else if (last.granted_at.valueOf() !== current.granted_at.valueOf()) { diff.granted_at = current.granted_at; } - + if (current.revoked_at === null && last.revoked_at === undefined) { diff.revoked_at = current.revoked_at; } else if (current.revoked_at == null && last.revoked_at == null) { - + } else if ((current.revoked_at != null && last.revoked_at == null) || (current.revoked_at == null && last.revoked_at != null)) { diff.revoked_at = current.revoked_at; } else if (last.revoked_at.valueOf() !== current.revoked_at.valueOf()) { diff.revoked_at = current.revoked_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-user_consent_11000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_scopes) { + 'snapshotGenerator-user_consent_12000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_scopes) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -2906,7 +2906,7 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.client !== 'undefined') { if (entity.client === null) { ret.client = null; @@ -2916,23 +2916,23 @@ export default { ret.client = toArray(entity.client.__helper.getPrimaryKey(true)); } } - + if (typeof entity.scopes !== 'undefined') { ret.scopes = clone(convertToDatabaseValue_scopes(entity.scopes)); } - + if (typeof entity.granted_at !== 'undefined') { ret.granted_at = clone(processDateProperty(entity.granted_at)); } - + if (typeof entity.revoked_at !== 'undefined') { ret.revoked_at = clone(processDateProperty(entity.revoked_at)); } - + return ret; } }, - 'resultMapper-user_consent_11000': function(PolymorphicRef, parseDate) { + 'resultMapper-user_consent_12000': function(PolymorphicRef, parseDate) { // compiled mapper for entity UserConsentEntity return function(result) { const ret = {}; @@ -3005,7 +3005,7 @@ export default { return ret; } }, - 'hydrator-user_consent_11000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_consent_12000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3020,7 +3020,7 @@ export default { } } }, - 'hydrator-user_consent_11000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-user_consent_12000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity UserConsentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3035,26 +3035,26 @@ export default { } } }, - 'pkGetter-user_consent_11000': function(isEntityOrRef) { + 'pkGetter-user_consent_12000': function(isEntityOrRef) { // compiled pk getter for entity UserConsentEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-user_consent_11000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-user_consent_12000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity UserConsentEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-user_consent_11000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-user_consent_12000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity UserConsentEntity return function(entity) { const val_6 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_6); } }, - 'hydrator-terms_17000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, terms_content_167, user_terms_consent_168) { + 'hydrator-terms_19000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, terms_content_167, user_terms_consent_168) { // compiled hydrator for entity TermsEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3150,7 +3150,7 @@ export default { } } }, - 'hydrator-terms_17000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, terms_content_176, user_terms_consent_177) { + 'hydrator-terms_19000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, terms_content_176, user_terms_consent_177) { // compiled hydrator for entity TermsEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3246,120 +3246,120 @@ export default { } } }, - 'comparator-terms_17000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-terms_19000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity TermsEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.required === null && last.required === undefined) { diff.required = current.required; } else if (current.required == null && last.required == null) { - + } else if ((current.required != null && last.required == null) || (current.required == null && last.required != null)) { diff.required = current.required; } else if (!compareBooleans(last.required, current.required)) { diff.required = current.required; } - + if (current.consentMode === null && last.consentMode === undefined) { diff.consentMode = current.consentMode; } else if (current.consentMode == null && last.consentMode == null) { - + } else if ((current.consentMode != null && last.consentMode == null) || (current.consentMode == null && last.consentMode != null)) { diff.consentMode = current.consentMode; } else if (last.consentMode !== current.consentMode) { diff.consentMode = current.consentMode; } - + if (current.version === null && last.version === undefined) { diff.version = current.version; } else if (current.version == null && last.version == null) { - + } else if ((current.version != null && last.version == null) || (current.version == null && last.version != null)) { diff.version = current.version; } else if (last.version !== current.version) { diff.version = current.version; } - + if (current.managed_by === null && last.managed_by === undefined) { diff.managed_by = current.managed_by; } else if (current.managed_by == null && last.managed_by == null) { - + } else if ((current.managed_by != null && last.managed_by == null) || (current.managed_by == null && last.managed_by != null)) { diff.managed_by = current.managed_by; } else if (last.managed_by !== current.managed_by) { diff.managed_by = current.managed_by; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-terms_17000': function(clone, cloneEmbeddable, processDateProperty) { + 'snapshotGenerator-terms_19000': function(clone, cloneEmbeddable, processDateProperty) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = entity.id; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.required !== 'undefined') { ret.required = entity.required; } - + if (typeof entity.consentMode !== 'undefined') { ret.consentMode = entity.consentMode; } - + if (typeof entity.version !== 'undefined') { ret.version = entity.version; } - + if (typeof entity.managed_by !== 'undefined') { ret.managed_by = entity.managed_by; } - + return ret; } }, - 'resultMapper-terms_17000': function(PolymorphicRef, parseDate) { + 'resultMapper-terms_19000': function(PolymorphicRef, parseDate) { // compiled mapper for entity TermsEntity return function(result) { const ret = {}; @@ -3412,7 +3412,7 @@ export default { return ret; } }, - 'hydrator-terms_17000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-terms_19000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity TermsEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3422,7 +3422,7 @@ export default { } } }, - 'hydrator-terms_17000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-terms_19000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity TermsEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3432,25 +3432,25 @@ export default { } } }, - 'pkGetter-terms_17000': function(isEntityOrRef) { + 'pkGetter-terms_19000': function(isEntityOrRef) { // compiled pk getter for entity TermsEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-terms_17000': function(isEntityOrRef) { + 'pkGetterConverted-terms_19000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity TermsEntity return function(entity) { return entity.id; } }, - 'pkSerializer-terms_17000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-terms_19000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity TermsEntity return function(entity) { return '' + entity.id; } }, - 'hydrator-terms_content_15000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, terms_183, terms_184) { + 'hydrator-terms_content_17000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, terms_183, terms_184) { // compiled hydrator for entity TermsContentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3516,7 +3516,7 @@ export default { } } }, - 'hydrator-terms_content_15000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, terms_192, terms_193) { + 'hydrator-terms_content_17000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, terms_192, terms_193) { // compiled hydrator for entity TermsContentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3582,110 +3582,110 @@ export default { } } }, - 'comparator-terms_content_15000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-terms_content_17000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity TermsContentEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.terms === null && last.terms === undefined) { diff.terms = current.terms; } else if (current.terms == null && last.terms == null) { - + } else if ((current.terms != null && last.terms == null) || (current.terms == null && last.terms != null)) { diff.terms = current.terms; } else if (last.terms !== current.terms) { diff.terms = current.terms; } - + if (current.lang === null && last.lang === undefined) { diff.lang = current.lang; } else if (current.lang == null && last.lang == null) { - + } else if ((current.lang != null && last.lang == null) || (current.lang == null && last.lang != null)) { diff.lang = current.lang; } else if (last.lang !== current.lang) { diff.lang = current.lang; } - + if (current.title === null && last.title === undefined) { diff.title = current.title; } else if (current.title == null && last.title == null) { - + } else if ((current.title != null && last.title == null) || (current.title == null && last.title != null)) { diff.title = current.title; } else if (last.title !== current.title) { diff.title = current.title; } - + if (current.type === null && last.type === undefined) { diff.type = current.type; } else if (current.type == null && last.type == null) { - + } else if ((current.type != null && last.type == null) || (current.type == null && last.type != null)) { diff.type = current.type; } else if (last.type !== current.type) { diff.type = current.type; } - + if (current.content === null && last.content === undefined) { diff.content = current.content; } else if (current.content == null && last.content == null) { - + } else if ((current.content != null && last.content == null) || (current.content == null && last.content != null)) { diff.content = current.content; } else if (!equals(last.content, current.content)) { diff.content = current.content; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-terms_content_15000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-terms_content_17000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.terms !== 'undefined') { if (entity.terms === null) { ret.terms = null; @@ -3695,27 +3695,27 @@ export default { ret.terms = toArray(entity.terms.__helper.getPrimaryKey(true)); } } - + if (typeof entity.lang !== 'undefined') { ret.lang = entity.lang; } - + if (typeof entity.title !== 'undefined') { ret.title = entity.title; } - + if (typeof entity.type !== 'undefined') { ret.type = entity.type; } - + if (typeof entity.content !== 'undefined') { ret.content = clone(entity.content); } - + return ret; } }, - 'resultMapper-terms_content_15000': function(PolymorphicRef, parseDate) { + 'resultMapper-terms_content_17000': function(PolymorphicRef, parseDate) { // compiled mapper for entity TermsContentEntity return function(result) { const ret = {}; @@ -3772,7 +3772,7 @@ export default { return ret; } }, - 'hydrator-terms_content_15000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-terms_content_17000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity TermsContentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3787,7 +3787,7 @@ export default { } } }, - 'hydrator-terms_content_15000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-terms_content_17000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity TermsContentEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3802,26 +3802,658 @@ export default { } } }, - 'pkGetter-terms_content_15000': function(isEntityOrRef) { + 'pkGetter-terms_content_17000': function(isEntityOrRef) { // compiled pk getter for entity TermsContentEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-terms_content_15000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-terms_content_17000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity TermsContentEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-terms_content_15000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-terms_content_17000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity TermsContentEntity return function(entity) { const val_7 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_7); } }, - 'hydrator-revoked_tokens_10000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_205, oauth_client_206, user_207, user_208) { + 'hydrator-scheduled_jobs_16000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity SchedulerJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + if (data.created_at === null) { + entity.created_at = null; + } else if (typeof data.created_at !== 'undefined') { + if (data.created_at instanceof Date) { + entity.created_at = data.created_at; + } else if (typeof data.created_at === 'number' || data.created_at.includes('+') || data.created_at.lastIndexOf('-') > 10 || data.created_at.endsWith('Z')) { + entity.created_at = new Date(data.created_at); + } else { + entity.created_at = new Date(data.created_at + 'Z'); + } + } + if (data.updated_at === null) { + entity.updated_at = null; + } else if (typeof data.updated_at !== 'undefined') { + if (data.updated_at instanceof Date) { + entity.updated_at = data.updated_at; + } else if (typeof data.updated_at === 'number' || data.updated_at.includes('+') || data.updated_at.lastIndexOf('-') > 10 || data.updated_at.endsWith('Z')) { + entity.updated_at = new Date(data.updated_at); + } else { + entity.updated_at = new Date(data.updated_at + 'Z'); + } + } + if (data.name === null) { + entity.name = null; + } else if (typeof data.name !== 'undefined') { + entity.name = data.name; + } + if (data.enabled === null) { + entity.enabled = null; + } else if (typeof data.enabled !== 'undefined') { + entity.enabled = !!data.enabled; + } + if (data.cron === null) { + entity.cron = null; + } else if (typeof data.cron !== 'undefined') { + entity.cron = data.cron; + } + if (data.nextRunAt === null) { + entity.nextRunAt = null; + } else if (typeof data.nextRunAt !== 'undefined') { + if (data.nextRunAt instanceof Date) { + entity.nextRunAt = data.nextRunAt; + } else if (typeof data.nextRunAt === 'number' || data.nextRunAt.includes('+') || data.nextRunAt.lastIndexOf('-') > 10 || data.nextRunAt.endsWith('Z')) { + entity.nextRunAt = new Date(data.nextRunAt); + } else { + entity.nextRunAt = new Date(data.nextRunAt + 'Z'); + } + } + if (data.lastRunAt === null) { + entity.lastRunAt = null; + } else if (typeof data.lastRunAt !== 'undefined') { + if (data.lastRunAt instanceof Date) { + entity.lastRunAt = data.lastRunAt; + } else if (typeof data.lastRunAt === 'number' || data.lastRunAt.includes('+') || data.lastRunAt.lastIndexOf('-') > 10 || data.lastRunAt.endsWith('Z')) { + entity.lastRunAt = new Date(data.lastRunAt); + } else { + entity.lastRunAt = new Date(data.lastRunAt + 'Z'); + } + } + if (data.lastSuccessAt === null) { + entity.lastSuccessAt = null; + } else if (typeof data.lastSuccessAt !== 'undefined') { + if (data.lastSuccessAt instanceof Date) { + entity.lastSuccessAt = data.lastSuccessAt; + } else if (typeof data.lastSuccessAt === 'number' || data.lastSuccessAt.includes('+') || data.lastSuccessAt.lastIndexOf('-') > 10 || data.lastSuccessAt.endsWith('Z')) { + entity.lastSuccessAt = new Date(data.lastSuccessAt); + } else { + entity.lastSuccessAt = new Date(data.lastSuccessAt + 'Z'); + } + } + if (data.lastErrorAt === null) { + entity.lastErrorAt = null; + } else if (typeof data.lastErrorAt !== 'undefined') { + if (data.lastErrorAt instanceof Date) { + entity.lastErrorAt = data.lastErrorAt; + } else if (typeof data.lastErrorAt === 'number' || data.lastErrorAt.includes('+') || data.lastErrorAt.lastIndexOf('-') > 10 || data.lastErrorAt.endsWith('Z')) { + entity.lastErrorAt = new Date(data.lastErrorAt); + } else { + entity.lastErrorAt = new Date(data.lastErrorAt + 'Z'); + } + } + if (data.lastError === null) { + entity.lastError = null; + } else if (typeof data.lastError !== 'undefined') { + entity.lastError = data.lastError; + } + if (data.lockedBy === null) { + entity.lockedBy = null; + } else if (typeof data.lockedBy !== 'undefined') { + entity.lockedBy = data.lockedBy; + } + if (data.lockedUntil === null) { + entity.lockedUntil = null; + } else if (typeof data.lockedUntil !== 'undefined') { + if (data.lockedUntil instanceof Date) { + entity.lockedUntil = data.lockedUntil; + } else if (typeof data.lockedUntil === 'number' || data.lockedUntil.includes('+') || data.lockedUntil.lastIndexOf('-') > 10 || data.lockedUntil.endsWith('Z')) { + entity.lockedUntil = new Date(data.lockedUntil); + } else { + entity.lockedUntil = new Date(data.lockedUntil + 'Z'); + } + } + if (data.runCount === null) { + entity.runCount = null; + } else if (typeof data.runCount !== 'undefined') { + entity.runCount = data.runCount; + } + if (data.failureCount === null) { + entity.failureCount = null; + } else if (typeof data.failureCount !== 'undefined') { + entity.failureCount = data.failureCount; + } + } + }, + 'hydrator-scheduled_jobs_16000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity SchedulerJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + if (data.created_at === null) { + entity.created_at = null; + } else if (typeof data.created_at !== 'undefined') { + if (data.created_at instanceof Date) { + entity.created_at = data.created_at; + } else if (typeof data.created_at === 'number' || data.created_at.includes('+') || data.created_at.lastIndexOf('-') > 10 || data.created_at.endsWith('Z')) { + entity.created_at = new Date(data.created_at); + } else { + entity.created_at = new Date(data.created_at + 'Z'); + } + } + if (data.updated_at === null) { + entity.updated_at = null; + } else if (typeof data.updated_at !== 'undefined') { + if (data.updated_at instanceof Date) { + entity.updated_at = data.updated_at; + } else if (typeof data.updated_at === 'number' || data.updated_at.includes('+') || data.updated_at.lastIndexOf('-') > 10 || data.updated_at.endsWith('Z')) { + entity.updated_at = new Date(data.updated_at); + } else { + entity.updated_at = new Date(data.updated_at + 'Z'); + } + } + if (data.name === null) { + entity.name = null; + } else if (typeof data.name !== 'undefined') { + entity.name = data.name; + } + if (data.enabled === null) { + entity.enabled = null; + } else if (typeof data.enabled !== 'undefined') { + entity.enabled = !!data.enabled; + } + if (data.cron === null) { + entity.cron = null; + } else if (typeof data.cron !== 'undefined') { + entity.cron = data.cron; + } + if (data.nextRunAt === null) { + entity.nextRunAt = null; + } else if (typeof data.nextRunAt !== 'undefined') { + if (data.nextRunAt instanceof Date) { + entity.nextRunAt = data.nextRunAt; + } else if (typeof data.nextRunAt === 'number' || data.nextRunAt.includes('+') || data.nextRunAt.lastIndexOf('-') > 10 || data.nextRunAt.endsWith('Z')) { + entity.nextRunAt = new Date(data.nextRunAt); + } else { + entity.nextRunAt = new Date(data.nextRunAt + 'Z'); + } + } + if (data.lastRunAt === null) { + entity.lastRunAt = null; + } else if (typeof data.lastRunAt !== 'undefined') { + if (data.lastRunAt instanceof Date) { + entity.lastRunAt = data.lastRunAt; + } else if (typeof data.lastRunAt === 'number' || data.lastRunAt.includes('+') || data.lastRunAt.lastIndexOf('-') > 10 || data.lastRunAt.endsWith('Z')) { + entity.lastRunAt = new Date(data.lastRunAt); + } else { + entity.lastRunAt = new Date(data.lastRunAt + 'Z'); + } + } + if (data.lastSuccessAt === null) { + entity.lastSuccessAt = null; + } else if (typeof data.lastSuccessAt !== 'undefined') { + if (data.lastSuccessAt instanceof Date) { + entity.lastSuccessAt = data.lastSuccessAt; + } else if (typeof data.lastSuccessAt === 'number' || data.lastSuccessAt.includes('+') || data.lastSuccessAt.lastIndexOf('-') > 10 || data.lastSuccessAt.endsWith('Z')) { + entity.lastSuccessAt = new Date(data.lastSuccessAt); + } else { + entity.lastSuccessAt = new Date(data.lastSuccessAt + 'Z'); + } + } + if (data.lastErrorAt === null) { + entity.lastErrorAt = null; + } else if (typeof data.lastErrorAt !== 'undefined') { + if (data.lastErrorAt instanceof Date) { + entity.lastErrorAt = data.lastErrorAt; + } else if (typeof data.lastErrorAt === 'number' || data.lastErrorAt.includes('+') || data.lastErrorAt.lastIndexOf('-') > 10 || data.lastErrorAt.endsWith('Z')) { + entity.lastErrorAt = new Date(data.lastErrorAt); + } else { + entity.lastErrorAt = new Date(data.lastErrorAt + 'Z'); + } + } + if (data.lastError === null) { + entity.lastError = null; + } else if (typeof data.lastError !== 'undefined') { + entity.lastError = data.lastError; + } + if (data.lockedBy === null) { + entity.lockedBy = null; + } else if (typeof data.lockedBy !== 'undefined') { + entity.lockedBy = data.lockedBy; + } + if (data.lockedUntil === null) { + entity.lockedUntil = null; + } else if (typeof data.lockedUntil !== 'undefined') { + if (data.lockedUntil instanceof Date) { + entity.lockedUntil = data.lockedUntil; + } else if (typeof data.lockedUntil === 'number' || data.lockedUntil.includes('+') || data.lockedUntil.lastIndexOf('-') > 10 || data.lockedUntil.endsWith('Z')) { + entity.lockedUntil = new Date(data.lockedUntil); + } else { + entity.lockedUntil = new Date(data.lockedUntil + 'Z'); + } + } + if (data.runCount === null) { + entity.runCount = null; + } else if (typeof data.runCount !== 'undefined') { + entity.runCount = data.runCount; + } + if (data.failureCount === null) { + entity.failureCount = null; + } else if (typeof data.failureCount !== 'undefined') { + entity.failureCount = data.failureCount; + } + } + }, + 'comparator-scheduled_jobs_16000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + // compiled comparator for entity SchedulerJobEntity + return function(last, current, options) { + const diff = {}; + if (current.id === null && last.id === undefined) { + diff.id = current.id; + } else if (current.id == null && last.id == null) { + + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { + diff.id = current.id; + } else if (last.id !== current.id) { + diff.id = current.id; + } + + if (current.created_at === null && last.created_at === undefined) { + diff.created_at = current.created_at; + } else if (current.created_at == null && last.created_at == null) { + + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { + diff.created_at = current.created_at; + } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { + diff.created_at = current.created_at; + } + + if (current.updated_at === null && last.updated_at === undefined) { + diff.updated_at = current.updated_at; + } else if (current.updated_at == null && last.updated_at == null) { + + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { + diff.updated_at = current.updated_at; + } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { + diff.updated_at = current.updated_at; + } + + if (current.name === null && last.name === undefined) { + diff.name = current.name; + } else if (current.name == null && last.name == null) { + + } else if ((current.name != null && last.name == null) || (current.name == null && last.name != null)) { + diff.name = current.name; + } else if (last.name !== current.name) { + diff.name = current.name; + } + + if (current.enabled === null && last.enabled === undefined) { + diff.enabled = current.enabled; + } else if (current.enabled == null && last.enabled == null) { + + } else if ((current.enabled != null && last.enabled == null) || (current.enabled == null && last.enabled != null)) { + diff.enabled = current.enabled; + } else if (!compareBooleans(last.enabled, current.enabled)) { + diff.enabled = current.enabled; + } + + if (current.cron === null && last.cron === undefined) { + diff.cron = current.cron; + } else if (current.cron == null && last.cron == null) { + + } else if ((current.cron != null && last.cron == null) || (current.cron == null && last.cron != null)) { + diff.cron = current.cron; + } else if (last.cron !== current.cron) { + diff.cron = current.cron; + } + + if (current.nextRunAt === null && last.nextRunAt === undefined) { + diff.nextRunAt = current.nextRunAt; + } else if (current.nextRunAt == null && last.nextRunAt == null) { + + } else if ((current.nextRunAt != null && last.nextRunAt == null) || (current.nextRunAt == null && last.nextRunAt != null)) { + diff.nextRunAt = current.nextRunAt; + } else if (last.nextRunAt.valueOf() !== current.nextRunAt.valueOf()) { + diff.nextRunAt = current.nextRunAt; + } + + if (current.lastRunAt === null && last.lastRunAt === undefined) { + diff.lastRunAt = current.lastRunAt; + } else if (current.lastRunAt == null && last.lastRunAt == null) { + + } else if ((current.lastRunAt != null && last.lastRunAt == null) || (current.lastRunAt == null && last.lastRunAt != null)) { + diff.lastRunAt = current.lastRunAt; + } else if (last.lastRunAt.valueOf() !== current.lastRunAt.valueOf()) { + diff.lastRunAt = current.lastRunAt; + } + + if (current.lastSuccessAt === null && last.lastSuccessAt === undefined) { + diff.lastSuccessAt = current.lastSuccessAt; + } else if (current.lastSuccessAt == null && last.lastSuccessAt == null) { + + } else if ((current.lastSuccessAt != null && last.lastSuccessAt == null) || (current.lastSuccessAt == null && last.lastSuccessAt != null)) { + diff.lastSuccessAt = current.lastSuccessAt; + } else if (last.lastSuccessAt.valueOf() !== current.lastSuccessAt.valueOf()) { + diff.lastSuccessAt = current.lastSuccessAt; + } + + if (current.lastErrorAt === null && last.lastErrorAt === undefined) { + diff.lastErrorAt = current.lastErrorAt; + } else if (current.lastErrorAt == null && last.lastErrorAt == null) { + + } else if ((current.lastErrorAt != null && last.lastErrorAt == null) || (current.lastErrorAt == null && last.lastErrorAt != null)) { + diff.lastErrorAt = current.lastErrorAt; + } else if (last.lastErrorAt.valueOf() !== current.lastErrorAt.valueOf()) { + diff.lastErrorAt = current.lastErrorAt; + } + + if (current.lastError === null && last.lastError === undefined) { + diff.lastError = current.lastError; + } else if (current.lastError == null && last.lastError == null) { + + } else if ((current.lastError != null && last.lastError == null) || (current.lastError == null && last.lastError != null)) { + diff.lastError = current.lastError; + } else if (!equals(last.lastError, current.lastError)) { + diff.lastError = current.lastError; + } + + if (current.lockedBy === null && last.lockedBy === undefined) { + diff.lockedBy = current.lockedBy; + } else if (current.lockedBy == null && last.lockedBy == null) { + + } else if ((current.lockedBy != null && last.lockedBy == null) || (current.lockedBy == null && last.lockedBy != null)) { + diff.lockedBy = current.lockedBy; + } else if (last.lockedBy !== current.lockedBy) { + diff.lockedBy = current.lockedBy; + } + + if (current.lockedUntil === null && last.lockedUntil === undefined) { + diff.lockedUntil = current.lockedUntil; + } else if (current.lockedUntil == null && last.lockedUntil == null) { + + } else if ((current.lockedUntil != null && last.lockedUntil == null) || (current.lockedUntil == null && last.lockedUntil != null)) { + diff.lockedUntil = current.lockedUntil; + } else if (last.lockedUntil.valueOf() !== current.lockedUntil.valueOf()) { + diff.lockedUntil = current.lockedUntil; + } + + if (current.runCount === null && last.runCount === undefined) { + diff.runCount = current.runCount; + } else if (current.runCount == null && last.runCount == null) { + + } else if ((current.runCount != null && last.runCount == null) || (current.runCount == null && last.runCount != null)) { + diff.runCount = current.runCount; + } else if (!equals(last.runCount, current.runCount)) { + diff.runCount = current.runCount; + } + + if (current.failureCount === null && last.failureCount === undefined) { + diff.failureCount = current.failureCount; + } else if (current.failureCount == null && last.failureCount == null) { + + } else if ((current.failureCount != null && last.failureCount == null) || (current.failureCount == null && last.failureCount != null)) { + diff.failureCount = current.failureCount; + } else if (!equals(last.failureCount, current.failureCount)) { + diff.failureCount = current.failureCount; + } + + if (options?.includeInverseSides) { + } + return diff; + } + }, + 'snapshotGenerator-scheduled_jobs_16000': function(clone, cloneEmbeddable, processDateProperty) { + return function(entity) { + const ret = {}; + if (typeof entity.id !== 'undefined') { + ret.id = entity.id; + } + + if (typeof entity.created_at !== 'undefined') { + ret.created_at = clone(processDateProperty(entity.created_at)); + } + + if (typeof entity.updated_at !== 'undefined') { + ret.updated_at = clone(processDateProperty(entity.updated_at)); + } + + if (typeof entity.name !== 'undefined') { + ret.name = entity.name; + } + + if (typeof entity.enabled !== 'undefined') { + ret.enabled = entity.enabled; + } + + if (typeof entity.cron !== 'undefined') { + ret.cron = entity.cron; + } + + if (typeof entity.nextRunAt !== 'undefined') { + ret.nextRunAt = clone(processDateProperty(entity.nextRunAt)); + } + + if (typeof entity.lastRunAt !== 'undefined') { + ret.lastRunAt = clone(processDateProperty(entity.lastRunAt)); + } + + if (typeof entity.lastSuccessAt !== 'undefined') { + ret.lastSuccessAt = clone(processDateProperty(entity.lastSuccessAt)); + } + + if (typeof entity.lastErrorAt !== 'undefined') { + ret.lastErrorAt = clone(processDateProperty(entity.lastErrorAt)); + } + + if (typeof entity.lastError !== 'undefined') { + ret.lastError = clone(entity.lastError); + } + + if (typeof entity.lockedBy !== 'undefined') { + ret.lockedBy = entity.lockedBy; + } + + if (typeof entity.lockedUntil !== 'undefined') { + ret.lockedUntil = clone(processDateProperty(entity.lockedUntil)); + } + + if (typeof entity.runCount !== 'undefined') { + ret.runCount = clone(entity.runCount); + } + + if (typeof entity.failureCount !== 'undefined') { + ret.failureCount = clone(entity.failureCount); + } + + return ret; + } + }, + 'resultMapper-scheduled_jobs_16000': function(PolymorphicRef, parseDate) { + // compiled mapper for entity SchedulerJobEntity + return function(result) { + const ret = {}; + const mapped = {}; + if (typeof result.id !== 'undefined') { + ret.id = result.id; + mapped.id = true; + } + if (typeof result.created_at !== 'undefined') { + if (result.created_at == null || result.created_at instanceof Date) { + ret.created_at = result.created_at; + } else if (typeof result.created_at === 'bigint') { + ret.created_at = parseDate(Number(result.created_at)); + } else if (typeof result.created_at === 'number' || result.created_at.includes('+') || result.created_at.lastIndexOf('-') > 10 || result.created_at.endsWith('Z')) { + ret.created_at = parseDate(result.created_at); + } else { + ret.created_at = parseDate(result.created_at + 'Z'); + } + mapped.created_at = true; + } + if (typeof result.updated_at !== 'undefined') { + if (result.updated_at == null || result.updated_at instanceof Date) { + ret.updated_at = result.updated_at; + } else if (typeof result.updated_at === 'bigint') { + ret.updated_at = parseDate(Number(result.updated_at)); + } else if (typeof result.updated_at === 'number' || result.updated_at.includes('+') || result.updated_at.lastIndexOf('-') > 10 || result.updated_at.endsWith('Z')) { + ret.updated_at = parseDate(result.updated_at); + } else { + ret.updated_at = parseDate(result.updated_at + 'Z'); + } + mapped.updated_at = true; + } + if (typeof result.name !== 'undefined') { + ret.name = result.name; + mapped.name = true; + } + if (typeof result.enabled !== 'undefined') { + ret.enabled = result.enabled == null ? result.enabled : !!result.enabled; + mapped.enabled = true; + } + if (typeof result.cron !== 'undefined') { + ret.cron = result.cron; + mapped.cron = true; + } + if (typeof result.next_run_at !== 'undefined') { + if (result.next_run_at == null || result.next_run_at instanceof Date) { + ret.nextRunAt = result.next_run_at; + } else if (typeof result.next_run_at === 'bigint') { + ret.nextRunAt = parseDate(Number(result.next_run_at)); + } else if (typeof result.next_run_at === 'number' || result.next_run_at.includes('+') || result.next_run_at.lastIndexOf('-') > 10 || result.next_run_at.endsWith('Z')) { + ret.nextRunAt = parseDate(result.next_run_at); + } else { + ret.nextRunAt = parseDate(result.next_run_at + 'Z'); + } + mapped.next_run_at = true; + } + if (typeof result.last_run_at !== 'undefined') { + if (result.last_run_at == null || result.last_run_at instanceof Date) { + ret.lastRunAt = result.last_run_at; + } else if (typeof result.last_run_at === 'bigint') { + ret.lastRunAt = parseDate(Number(result.last_run_at)); + } else if (typeof result.last_run_at === 'number' || result.last_run_at.includes('+') || result.last_run_at.lastIndexOf('-') > 10 || result.last_run_at.endsWith('Z')) { + ret.lastRunAt = parseDate(result.last_run_at); + } else { + ret.lastRunAt = parseDate(result.last_run_at + 'Z'); + } + mapped.last_run_at = true; + } + if (typeof result.last_success_at !== 'undefined') { + if (result.last_success_at == null || result.last_success_at instanceof Date) { + ret.lastSuccessAt = result.last_success_at; + } else if (typeof result.last_success_at === 'bigint') { + ret.lastSuccessAt = parseDate(Number(result.last_success_at)); + } else if (typeof result.last_success_at === 'number' || result.last_success_at.includes('+') || result.last_success_at.lastIndexOf('-') > 10 || result.last_success_at.endsWith('Z')) { + ret.lastSuccessAt = parseDate(result.last_success_at); + } else { + ret.lastSuccessAt = parseDate(result.last_success_at + 'Z'); + } + mapped.last_success_at = true; + } + if (typeof result.last_error_at !== 'undefined') { + if (result.last_error_at == null || result.last_error_at instanceof Date) { + ret.lastErrorAt = result.last_error_at; + } else if (typeof result.last_error_at === 'bigint') { + ret.lastErrorAt = parseDate(Number(result.last_error_at)); + } else if (typeof result.last_error_at === 'number' || result.last_error_at.includes('+') || result.last_error_at.lastIndexOf('-') > 10 || result.last_error_at.endsWith('Z')) { + ret.lastErrorAt = parseDate(result.last_error_at); + } else { + ret.lastErrorAt = parseDate(result.last_error_at + 'Z'); + } + mapped.last_error_at = true; + } + if (typeof result.last_error !== 'undefined') { + ret.lastError = result.last_error; + mapped.last_error = true; + } + if (typeof result.locked_by !== 'undefined') { + ret.lockedBy = result.locked_by; + mapped.locked_by = true; + } + if (typeof result.locked_until !== 'undefined') { + if (result.locked_until == null || result.locked_until instanceof Date) { + ret.lockedUntil = result.locked_until; + } else if (typeof result.locked_until === 'bigint') { + ret.lockedUntil = parseDate(Number(result.locked_until)); + } else if (typeof result.locked_until === 'number' || result.locked_until.includes('+') || result.locked_until.lastIndexOf('-') > 10 || result.locked_until.endsWith('Z')) { + ret.lockedUntil = parseDate(result.locked_until); + } else { + ret.lockedUntil = parseDate(result.locked_until + 'Z'); + } + mapped.locked_until = true; + } + if (typeof result.run_count !== 'undefined') { + ret.runCount = result.run_count; + mapped.run_count = true; + } + if (typeof result.failure_count !== 'undefined') { + ret.failureCount = result.failure_count; + mapped.failure_count = true; + } + for (let k in result) { if (Object.hasOwn(result, k) && !mapped[k] && ret[k] === undefined) ret[k] = result[k]; } + return ret; + } + }, + 'hydrator-scheduled_jobs_16000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity SchedulerJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + } + }, + 'hydrator-scheduled_jobs_16000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity SchedulerJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + } + }, + 'pkGetter-scheduled_jobs_16000': function(isEntityOrRef) { + // compiled pk getter for entity SchedulerJobEntity + return function(entity) { + return entity.id; + } + }, + 'pkGetterConverted-scheduled_jobs_16000': function(isEntityOrRef) { + // compiled pk getter (with converted custom types) for entity SchedulerJobEntity + return function(entity) { + return entity.id; + } + }, + 'pkSerializer-scheduled_jobs_16000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + // compiled pk serializer for entity SchedulerJobEntity + return function(entity) { + return '' + entity.id; + } + }, + 'hydrator-revoked_tokens_11000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_237, oauth_client_238, user_239, user_240) { // compiled hydrator for entity RevokedTokenEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3870,18 +4502,18 @@ export default { entity.client = null; } else if (typeof data.client !== 'undefined') { if (isPrimaryKey(data.client, true)) { - entity.client = factory.createReference(oauth_client_205, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.createReference(oauth_client_237, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.client && typeof data.client === 'object') { - entity.client = factory.create(oauth_client_206, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.create(oauth_client_238, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.user === null) { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = factory.createReference(user_207, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.user = factory.createReference(user_239, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.user && typeof data.user === 'object') { - entity.user = factory.create(user_208, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.user = factory.create(user_240, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.expires_at === null) { @@ -3908,7 +4540,7 @@ export default { } } }, - 'hydrator-revoked_tokens_10000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_216, oauth_client_217, user_218, user_219) { + 'hydrator-revoked_tokens_11000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_248, oauth_client_249, user_250, user_251) { // compiled hydrator for entity RevokedTokenEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -3957,18 +4589,18 @@ export default { entity.client = null; } else if (typeof data.client !== 'undefined') { if (isPrimaryKey(data.client, true)) { - entity.client = factory.createReference(oauth_client_216, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.createReference(oauth_client_248, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.client && typeof data.client === 'object') { - entity.client = factory.create(oauth_client_217, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.create(oauth_client_249, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.user === null) { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = factory.createReference(user_218, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.user = factory.createReference(user_250, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.user && typeof data.user === 'object') { - entity.user = factory.create(user_219, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.user = factory.create(user_251, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.expires_at === null) { @@ -3995,128 +4627,128 @@ export default { } } }, - 'comparator-revoked_tokens_10000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-revoked_tokens_11000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity RevokedTokenEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.jti === null && last.jti === undefined) { diff.jti = current.jti; } else if (current.jti == null && last.jti == null) { - + } else if ((current.jti != null && last.jti == null) || (current.jti == null && last.jti != null)) { diff.jti = current.jti; } else if (last.jti !== current.jti) { diff.jti = current.jti; } - + if (current.token_type === null && last.token_type === undefined) { diff.token_type = current.token_type; } else if (current.token_type == null && last.token_type == null) { - + } else if ((current.token_type != null && last.token_type == null) || (current.token_type == null && last.token_type != null)) { diff.token_type = current.token_type; } else if (last.token_type !== current.token_type) { diff.token_type = current.token_type; } - + if (current.client === null && last.client === undefined) { diff.client = current.client; } else if (current.client == null && last.client == null) { - + } else if ((current.client != null && last.client == null) || (current.client == null && last.client != null)) { diff.client = current.client; } else if (last.client !== current.client) { diff.client = current.client; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.expires_at === null && last.expires_at === undefined) { diff.expires_at = current.expires_at; } else if (current.expires_at == null && last.expires_at == null) { - + } else if ((current.expires_at != null && last.expires_at == null) || (current.expires_at == null && last.expires_at != null)) { diff.expires_at = current.expires_at; } else if (last.expires_at.valueOf() !== current.expires_at.valueOf()) { diff.expires_at = current.expires_at; } - + if (current.revoked_at === null && last.revoked_at === undefined) { diff.revoked_at = current.revoked_at; } else if (current.revoked_at == null && last.revoked_at == null) { - + } else if ((current.revoked_at != null && last.revoked_at == null) || (current.revoked_at == null && last.revoked_at != null)) { diff.revoked_at = current.revoked_at; } else if (last.revoked_at.valueOf() !== current.revoked_at.valueOf()) { diff.revoked_at = current.revoked_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-revoked_tokens_10000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-revoked_tokens_11000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.jti !== 'undefined') { ret.jti = entity.jti; } - + if (typeof entity.token_type !== 'undefined') { ret.token_type = entity.token_type; } - + if (typeof entity.client !== 'undefined') { if (entity.client === null) { ret.client = null; @@ -4126,7 +4758,7 @@ export default { ret.client = toArray(entity.client.__helper.getPrimaryKey(true)); } } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -4136,19 +4768,19 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.expires_at !== 'undefined') { ret.expires_at = clone(processDateProperty(entity.expires_at)); } - + if (typeof entity.revoked_at !== 'undefined') { ret.revoked_at = clone(processDateProperty(entity.revoked_at)); } - + return ret; } }, - 'resultMapper-revoked_tokens_10000': function(PolymorphicRef, parseDate) { + 'resultMapper-revoked_tokens_11000': function(PolymorphicRef, parseDate) { // compiled mapper for entity RevokedTokenEntity return function(result) { const ret = {}; @@ -4225,7 +4857,7 @@ export default { return ret; } }, - 'hydrator-revoked_tokens_10000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-revoked_tokens_11000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity RevokedTokenEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4240,7 +4872,7 @@ export default { } } }, - 'hydrator-revoked_tokens_10000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-revoked_tokens_11000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity RevokedTokenEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4255,26 +4887,26 @@ export default { } } }, - 'pkGetter-revoked_tokens_10000': function(isEntityOrRef) { + 'pkGetter-revoked_tokens_11000': function(isEntityOrRef) { // compiled pk getter for entity RevokedTokenEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-revoked_tokens_10000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-revoked_tokens_11000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity RevokedTokenEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-revoked_tokens_10000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-revoked_tokens_11000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity RevokedTokenEntity return function(entity) { const val_8 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_8); } }, - 'hydrator-pending_oauth_registration_14000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, convertToJSValue_userInfo, convertToDatabaseValue_userInfo) { + 'hydrator-pending_oauth_registration_15000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, convertToJSValue_userInfo, convertToDatabaseValue_userInfo) { // compiled hydrator for entity PendingOAuthRegistrationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4368,7 +5000,7 @@ export default { } } }, - 'hydrator-pending_oauth_registration_14000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, convertToJSValue_userInfo, convertToDatabaseValue_userInfo) { + 'hydrator-pending_oauth_registration_15000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, convertToJSValue_userInfo, convertToDatabaseValue_userInfo) { // compiled hydrator for entity PendingOAuthRegistrationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4462,190 +5094,190 @@ export default { } } }, - 'comparator-pending_oauth_registration_14000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-pending_oauth_registration_15000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity PendingOAuthRegistrationEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.token === null && last.token === undefined) { diff.token = current.token; } else if (current.token == null && last.token == null) { - + } else if ((current.token != null && last.token == null) || (current.token == null && last.token != null)) { diff.token = current.token; } else if (last.token !== current.token) { diff.token = current.token; } - + if (current.providerId === null && last.providerId === undefined) { diff.providerId = current.providerId; } else if (current.providerId == null && last.providerId == null) { - + } else if ((current.providerId != null && last.providerId == null) || (current.providerId == null && last.providerId != null)) { diff.providerId = current.providerId; } else if (last.providerId !== current.providerId) { diff.providerId = current.providerId; } - + if (current.accessToken === null && last.accessToken === undefined) { diff.accessToken = current.accessToken; } else if (current.accessToken == null && last.accessToken == null) { - + } else if ((current.accessToken != null && last.accessToken == null) || (current.accessToken == null && last.accessToken != null)) { diff.accessToken = current.accessToken; } else if (!equals(last.accessToken, current.accessToken)) { diff.accessToken = current.accessToken; } - + if (current.refreshToken === null && last.refreshToken === undefined) { diff.refreshToken = current.refreshToken; } else if (current.refreshToken == null && last.refreshToken == null) { - + } else if ((current.refreshToken != null && last.refreshToken == null) || (current.refreshToken == null && last.refreshToken != null)) { diff.refreshToken = current.refreshToken; } else if (!equals(last.refreshToken, current.refreshToken)) { diff.refreshToken = current.refreshToken; } - + if (current.expiresIn === null && last.expiresIn === undefined) { diff.expiresIn = current.expiresIn; } else if (current.expiresIn == null && last.expiresIn == null) { - + } else if ((current.expiresIn != null && last.expiresIn == null) || (current.expiresIn == null && last.expiresIn != null)) { diff.expiresIn = current.expiresIn; } else if (!equals(last.expiresIn, current.expiresIn)) { diff.expiresIn = current.expiresIn; } - + if (current.tokenType === null && last.tokenType === undefined) { diff.tokenType = current.tokenType; } else if (current.tokenType == null && last.tokenType == null) { - + } else if ((current.tokenType != null && last.tokenType == null) || (current.tokenType == null && last.tokenType != null)) { diff.tokenType = current.tokenType; } else if (last.tokenType !== current.tokenType) { diff.tokenType = current.tokenType; } - + if (current.userInfo === null && last.userInfo === undefined) { diff.userInfo = current.userInfo; } else if (current.userInfo == null && last.userInfo == null) { - + } else if ((current.userInfo != null && last.userInfo == null) || (current.userInfo == null && last.userInfo != null)) { diff.userInfo = current.userInfo; } else if (!equals(last.userInfo, current.userInfo)) { diff.userInfo = current.userInfo; } - + if (current.returnUrl === null && last.returnUrl === undefined) { diff.returnUrl = current.returnUrl; } else if (current.returnUrl == null && last.returnUrl == null) { - + } else if ((current.returnUrl != null && last.returnUrl == null) || (current.returnUrl == null && last.returnUrl != null)) { diff.returnUrl = current.returnUrl; } else if (last.returnUrl !== current.returnUrl) { diff.returnUrl = current.returnUrl; } - + if (current.expiresAt === null && last.expiresAt === undefined) { diff.expiresAt = current.expiresAt; } else if (current.expiresAt == null && last.expiresAt == null) { - + } else if ((current.expiresAt != null && last.expiresAt == null) || (current.expiresAt == null && last.expiresAt != null)) { diff.expiresAt = current.expiresAt; } else if (last.expiresAt.valueOf() !== current.expiresAt.valueOf()) { diff.expiresAt = current.expiresAt; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-pending_oauth_registration_14000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, convertToDatabaseValue_userInfo) { + 'snapshotGenerator-pending_oauth_registration_15000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, convertToDatabaseValue_userInfo) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.token !== 'undefined') { ret.token = entity.token; } - + if (typeof entity.providerId !== 'undefined') { ret.providerId = entity.providerId; } - + if (typeof entity.accessToken !== 'undefined') { ret.accessToken = clone(entity.accessToken); } - + if (typeof entity.refreshToken !== 'undefined') { ret.refreshToken = clone(entity.refreshToken); } - + if (typeof entity.expiresIn !== 'undefined') { ret.expiresIn = clone(entity.expiresIn); } - + if (typeof entity.tokenType !== 'undefined') { ret.tokenType = entity.tokenType; } - + if (typeof entity.userInfo !== 'undefined') { ret.userInfo = clone(convertToDatabaseValue_userInfo(entity.userInfo)); } - + if (typeof entity.returnUrl !== 'undefined') { ret.returnUrl = entity.returnUrl; } - + if (typeof entity.expiresAt !== 'undefined') { ret.expiresAt = clone(processDateProperty(entity.expiresAt)); } - + return ret; } }, - 'resultMapper-pending_oauth_registration_14000': function(PolymorphicRef, parseDate) { + 'resultMapper-pending_oauth_registration_15000': function(PolymorphicRef, parseDate) { // compiled mapper for entity PendingOAuthRegistrationEntity return function(result) { const ret = {}; @@ -4726,7 +5358,7 @@ export default { return ret; } }, - 'hydrator-pending_oauth_registration_14000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-pending_oauth_registration_15000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity PendingOAuthRegistrationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4741,7 +5373,7 @@ export default { } } }, - 'hydrator-pending_oauth_registration_14000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-pending_oauth_registration_15000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity PendingOAuthRegistrationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4756,26 +5388,26 @@ export default { } } }, - 'pkGetter-pending_oauth_registration_14000': function(isEntityOrRef) { + 'pkGetter-pending_oauth_registration_15000': function(isEntityOrRef) { // compiled pk getter for entity PendingOAuthRegistrationEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-pending_oauth_registration_14000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-pending_oauth_registration_15000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity PendingOAuthRegistrationEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-pending_oauth_registration_14000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-pending_oauth_registration_15000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity PendingOAuthRegistrationEntity return function(entity) { const val_9 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_9); } }, - 'hydrator-password_reset_13000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_253, user_254) { + 'hydrator-password_reset_14000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_285, user_286) { // compiled hydrator for entity PasswordResetEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4814,9 +5446,9 @@ export default { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_253, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_285, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_254, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_286, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.token === null) { @@ -4853,7 +5485,7 @@ export default { } } }, - 'hydrator-password_reset_13000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_262, user_263) { + 'hydrator-password_reset_14000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_294, user_295) { // compiled hydrator for entity PasswordResetEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -4892,9 +5524,9 @@ export default { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_262, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_294, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_263, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_295, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.token === null) { @@ -4931,110 +5563,110 @@ export default { } } }, - 'comparator-password_reset_13000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-password_reset_14000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity PasswordResetEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.token === null && last.token === undefined) { diff.token = current.token; } else if (current.token == null && last.token == null) { - + } else if ((current.token != null && last.token == null) || (current.token == null && last.token != null)) { diff.token = current.token; } else if (last.token !== current.token) { diff.token = current.token; } - + if (current.expiresAt === null && last.expiresAt === undefined) { diff.expiresAt = current.expiresAt; } else if (current.expiresAt == null && last.expiresAt == null) { - + } else if ((current.expiresAt != null && last.expiresAt == null) || (current.expiresAt == null && last.expiresAt != null)) { diff.expiresAt = current.expiresAt; } else if (last.expiresAt.valueOf() !== current.expiresAt.valueOf()) { diff.expiresAt = current.expiresAt; } - + if (current.used === null && last.used === undefined) { diff.used = current.used; } else if (current.used == null && last.used == null) { - + } else if ((current.used != null && last.used == null) || (current.used == null && last.used != null)) { diff.used = current.used; } else if (!compareBooleans(last.used, current.used)) { diff.used = current.used; } - + if (current.usedAt === null && last.usedAt === undefined) { diff.usedAt = current.usedAt; } else if (current.usedAt == null && last.usedAt == null) { - + } else if ((current.usedAt != null && last.usedAt == null) || (current.usedAt == null && last.usedAt != null)) { diff.usedAt = current.usedAt; } else if (last.usedAt.valueOf() !== current.usedAt.valueOf()) { diff.usedAt = current.usedAt; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-password_reset_13000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-password_reset_14000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -5044,27 +5676,27 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.token !== 'undefined') { ret.token = entity.token; } - + if (typeof entity.expiresAt !== 'undefined') { ret.expiresAt = clone(processDateProperty(entity.expiresAt)); } - + if (typeof entity.used !== 'undefined') { ret.used = entity.used; } - + if (typeof entity.usedAt !== 'undefined') { ret.usedAt = clone(processDateProperty(entity.usedAt)); } - + return ret; } }, - 'resultMapper-password_reset_13000': function(PolymorphicRef, parseDate) { + 'resultMapper-password_reset_14000': function(PolymorphicRef, parseDate) { // compiled mapper for entity PasswordResetEntity return function(result) { const ret = {}; @@ -5137,7 +5769,7 @@ export default { return ret; } }, - 'hydrator-password_reset_13000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-password_reset_14000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity PasswordResetEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5152,7 +5784,7 @@ export default { } } }, - 'hydrator-password_reset_13000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-password_reset_14000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity PasswordResetEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5167,26 +5799,26 @@ export default { } } }, - 'pkGetter-password_reset_13000': function(isEntityOrRef) { + 'pkGetter-password_reset_14000': function(isEntityOrRef) { // compiled pk getter for entity PasswordResetEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-password_reset_13000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-password_reset_14000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity PasswordResetEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-password_reset_13000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-password_reset_14000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity PasswordResetEntity return function(entity) { const val_10 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_10); } }, - 'hydrator-oauth_code_9000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_274, oauth_client_275, user_276, user_277, convertToJSValue_scope, convertToDatabaseValue_scope) { + 'hydrator-oauth_code_10000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_306, oauth_client_307, user_308, user_309, convertToJSValue_scope, convertToDatabaseValue_scope) { // compiled hydrator for entity OAuthCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5230,18 +5862,18 @@ export default { entity.client = null; } else if (typeof data.client !== 'undefined') { if (isPrimaryKey(data.client, true)) { - entity.client = factory.createReference(oauth_client_274, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.createReference(oauth_client_306, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.client && typeof data.client === 'object') { - entity.client = factory.create(oauth_client_275, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.create(oauth_client_307, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.user === null) { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_276, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_308, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_277, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_309, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.redirectUri === null) { @@ -5304,7 +5936,7 @@ export default { } } }, - 'hydrator-oauth_code_9000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_290, oauth_client_291, user_292, user_293, convertToJSValue_scope, convertToDatabaseValue_scope) { + 'hydrator-oauth_code_10000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, oauth_client_322, oauth_client_323, user_324, user_325, convertToJSValue_scope, convertToDatabaseValue_scope) { // compiled hydrator for entity OAuthCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5348,18 +5980,18 @@ export default { entity.client = null; } else if (typeof data.client !== 'undefined') { if (isPrimaryKey(data.client, true)) { - entity.client = factory.createReference(oauth_client_290, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.createReference(oauth_client_322, data.client, { merge: true, convertCustomTypes, normalizeAccessors, schema }); } else if (data.client && typeof data.client === 'object') { - entity.client = factory.create(oauth_client_291, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); + entity.client = factory.create(oauth_client_323, data.client, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema }); } } if (data.user === null) { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_292, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_324, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_293, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_325, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.redirectUri === null) { @@ -5422,174 +6054,174 @@ export default { } } }, - 'comparator-oauth_code_9000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-oauth_code_10000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity OAuthCodeEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.codeHash === null && last.codeHash === undefined) { diff.codeHash = current.codeHash; } else if (current.codeHash == null && last.codeHash == null) { - + } else if ((current.codeHash != null && last.codeHash == null) || (current.codeHash == null && last.codeHash != null)) { diff.codeHash = current.codeHash; } else if (last.codeHash !== current.codeHash) { diff.codeHash = current.codeHash; } - + if (current.client === null && last.client === undefined) { diff.client = current.client; } else if (current.client == null && last.client == null) { - + } else if ((current.client != null && last.client == null) || (current.client == null && last.client != null)) { diff.client = current.client; } else if (last.client !== current.client) { diff.client = current.client; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.redirectUri === null && last.redirectUri === undefined) { diff.redirectUri = current.redirectUri; } else if (current.redirectUri == null && last.redirectUri == null) { - + } else if ((current.redirectUri != null && last.redirectUri == null) || (current.redirectUri == null && last.redirectUri != null)) { diff.redirectUri = current.redirectUri; } else if (last.redirectUri !== current.redirectUri) { diff.redirectUri = current.redirectUri; } - + if (current.scope === null && last.scope === undefined) { diff.scope = current.scope; } else if (current.scope == null && last.scope == null) { - + } else if ((current.scope != null && last.scope == null) || (current.scope == null && last.scope != null)) { diff.scope = current.scope; } else if (!equals(last.scope, current.scope)) { diff.scope = current.scope; } - + if (current.nonce === null && last.nonce === undefined) { diff.nonce = current.nonce; } else if (current.nonce == null && last.nonce == null) { - + } else if ((current.nonce != null && last.nonce == null) || (current.nonce == null && last.nonce != null)) { diff.nonce = current.nonce; } else if (last.nonce !== current.nonce) { diff.nonce = current.nonce; } - + if (current.codeChallenge === null && last.codeChallenge === undefined) { diff.codeChallenge = current.codeChallenge; } else if (current.codeChallenge == null && last.codeChallenge == null) { - + } else if ((current.codeChallenge != null && last.codeChallenge == null) || (current.codeChallenge == null && last.codeChallenge != null)) { diff.codeChallenge = current.codeChallenge; } else if (last.codeChallenge !== current.codeChallenge) { diff.codeChallenge = current.codeChallenge; } - + if (current.codeChallengeMethod === null && last.codeChallengeMethod === undefined) { diff.codeChallengeMethod = current.codeChallengeMethod; } else if (current.codeChallengeMethod == null && last.codeChallengeMethod == null) { - + } else if ((current.codeChallengeMethod != null && last.codeChallengeMethod == null) || (current.codeChallengeMethod == null && last.codeChallengeMethod != null)) { diff.codeChallengeMethod = current.codeChallengeMethod; } else if (last.codeChallengeMethod !== current.codeChallengeMethod) { diff.codeChallengeMethod = current.codeChallengeMethod; } - + if (current.expiredAt === null && last.expiredAt === undefined) { diff.expiredAt = current.expiredAt; } else if (current.expiredAt == null && last.expiredAt == null) { - + } else if ((current.expiredAt != null && last.expiredAt == null) || (current.expiredAt == null && last.expiredAt != null)) { diff.expiredAt = current.expiredAt; } else if (last.expiredAt.valueOf() !== current.expiredAt.valueOf()) { diff.expiredAt = current.expiredAt; } - + if (current.consumedAt === null && last.consumedAt === undefined) { diff.consumedAt = current.consumedAt; } else if (current.consumedAt == null && last.consumedAt == null) { - + } else if ((current.consumedAt != null && last.consumedAt == null) || (current.consumedAt == null && last.consumedAt != null)) { diff.consumedAt = current.consumedAt; } else if (last.consumedAt.valueOf() !== current.consumedAt.valueOf()) { diff.consumedAt = current.consumedAt; } - + if (current.authTime === null && last.authTime === undefined) { diff.authTime = current.authTime; } else if (current.authTime == null && last.authTime == null) { - + } else if ((current.authTime != null && last.authTime == null) || (current.authTime == null && last.authTime != null)) { diff.authTime = current.authTime; } else if (!equals(last.authTime, current.authTime)) { diff.authTime = current.authTime; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-oauth_code_9000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_scope) { + 'snapshotGenerator-oauth_code_10000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier, convertToDatabaseValue_scope) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.codeHash !== 'undefined') { ret.codeHash = entity.codeHash; } - + if (typeof entity.client !== 'undefined') { if (entity.client === null) { ret.client = null; @@ -5599,7 +6231,7 @@ export default { ret.client = toArray(entity.client.__helper.getPrimaryKey(true)); } } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -5609,43 +6241,43 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.redirectUri !== 'undefined') { ret.redirectUri = entity.redirectUri; } - + if (typeof entity.scope !== 'undefined') { ret.scope = clone(convertToDatabaseValue_scope(entity.scope)); } - + if (typeof entity.nonce !== 'undefined') { ret.nonce = entity.nonce; } - + if (typeof entity.codeChallenge !== 'undefined') { ret.codeChallenge = entity.codeChallenge; } - + if (typeof entity.codeChallengeMethod !== 'undefined') { ret.codeChallengeMethod = entity.codeChallengeMethod; } - + if (typeof entity.expiredAt !== 'undefined') { ret.expiredAt = clone(processDateProperty(entity.expiredAt)); } - + if (typeof entity.consumedAt !== 'undefined') { ret.consumedAt = clone(processDateProperty(entity.consumedAt)); } - + if (typeof entity.authTime !== 'undefined') { ret.authTime = clone(entity.authTime); } - + return ret; } }, - 'resultMapper-oauth_code_9000': function(PolymorphicRef, parseDate) { + 'resultMapper-oauth_code_10000': function(PolymorphicRef, parseDate) { // compiled mapper for entity OAuthCodeEntity return function(result) { const ret = {}; @@ -5742,7 +6374,7 @@ export default { return ret; } }, - 'hydrator-oauth_code_9000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-oauth_code_10000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity OAuthCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5757,7 +6389,7 @@ export default { } } }, - 'hydrator-oauth_code_9000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-oauth_code_10000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity OAuthCodeEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5772,26 +6404,26 @@ export default { } } }, - 'pkGetter-oauth_code_9000': function(isEntityOrRef) { + 'pkGetter-oauth_code_10000': function(isEntityOrRef) { // compiled pk getter for entity OAuthCodeEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-oauth_code_9000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-oauth_code_10000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity OAuthCodeEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-oauth_code_9000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-oauth_code_10000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity OAuthCodeEntity return function(entity) { const val_11 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_11); } }, - 'hydrator-oauth_client_12000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_grantTypes, convertToDatabaseValue_grantTypes, convertToJSValue_responseTypes, convertToDatabaseValue_responseTypes, convertToJSValue_scopes, convertToDatabaseValue_scopes, convertToJSValue_redirectUris, convertToDatabaseValue_redirectUris, oauth_code_317, user_consent_318, revoked_tokens_319) { + 'hydrator-oauth_client_13000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_grantTypes, convertToDatabaseValue_grantTypes, convertToJSValue_responseTypes, convertToDatabaseValue_responseTypes, convertToJSValue_scopes, convertToDatabaseValue_scopes, convertToJSValue_redirectUris, convertToDatabaseValue_redirectUris, oauth_code_349, user_consent_350, revoked_tokens_351) { // compiled hydrator for entity OAuthClientEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -5896,9 +6528,9 @@ export default { entity.logoUri = data.logoUri; } const createCollectionItem_codes = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(oauth_code_317, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(oauth_code_349, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(oauth_code_317, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(oauth_code_349, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.codes && !Array.isArray(data.codes) && typeof data.codes === 'object') { data.codes = [data.codes]; @@ -5918,9 +6550,9 @@ export default { coll.setDirty(false); } const createCollectionItem_consents = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(user_consent_318, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(user_consent_350, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(user_consent_318, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(user_consent_350, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.consents && !Array.isArray(data.consents) && typeof data.consents === 'object') { data.consents = [data.consents]; @@ -5940,9 +6572,9 @@ export default { coll.setDirty(false); } const createCollectionItem_revokedTokens = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(revoked_tokens_319, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(revoked_tokens_351, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(revoked_tokens_319, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(revoked_tokens_351, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.revokedTokens && !Array.isArray(data.revokedTokens) && typeof data.revokedTokens === 'object') { data.revokedTokens = [data.revokedTokens]; @@ -5963,7 +6595,7 @@ export default { } } }, - 'hydrator-oauth_client_12000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_grantTypes, convertToDatabaseValue_grantTypes, convertToJSValue_responseTypes, convertToDatabaseValue_responseTypes, convertToJSValue_scopes, convertToDatabaseValue_scopes, convertToJSValue_redirectUris, convertToDatabaseValue_redirectUris, oauth_code_333, user_consent_334, revoked_tokens_335) { + 'hydrator-oauth_client_13000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_grantTypes, convertToDatabaseValue_grantTypes, convertToJSValue_responseTypes, convertToDatabaseValue_responseTypes, convertToJSValue_scopes, convertToDatabaseValue_scopes, convertToJSValue_redirectUris, convertToDatabaseValue_redirectUris, oauth_code_365, user_consent_366, revoked_tokens_367) { // compiled hydrator for entity OAuthClientEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -6068,9 +6700,9 @@ export default { entity.logoUri = data.logoUri; } const createCollectionItem_codes = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(oauth_code_333, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(oauth_code_365, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(oauth_code_333, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(oauth_code_365, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.codes && !Array.isArray(data.codes) && typeof data.codes === 'object') { data.codes = [data.codes]; @@ -6090,9 +6722,9 @@ export default { coll.setDirty(false); } const createCollectionItem_consents = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(user_consent_334, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(user_consent_366, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(user_consent_334, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(user_consent_366, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.consents && !Array.isArray(data.consents) && typeof data.consents === 'object') { data.consents = [data.consents]; @@ -6112,9 +6744,9 @@ export default { coll.setDirty(false); } const createCollectionItem_revokedTokens = (value, entity) => { - if (isPrimaryKey(value, false)) return factory.createReference(revoked_tokens_335, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); + if (isPrimaryKey(value, false)) return factory.createReference(revoked_tokens_367, value, { convertCustomTypes, schema, normalizeAccessors, merge: true }); if (value && isEntity(value)) return value; - return factory.create(revoked_tokens_335, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); + return factory.create(revoked_tokens_367, value, { newEntity, convertCustomTypes, schema, normalizeAccessors, merge: true }); } if (data.revokedTokens && !Array.isArray(data.revokedTokens) && typeof data.revokedTokens === 'object') { data.revokedTokens = [data.revokedTokens]; @@ -6135,204 +6767,204 @@ export default { } } }, - 'comparator-oauth_client_12000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-oauth_client_13000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity OAuthClientEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.clientId === null && last.clientId === undefined) { diff.clientId = current.clientId; } else if (current.clientId == null && last.clientId == null) { - + } else if ((current.clientId != null && last.clientId == null) || (current.clientId == null && last.clientId != null)) { diff.clientId = current.clientId; } else if (last.clientId !== current.clientId) { diff.clientId = current.clientId; } - + if (current.clientSecretHash === null && last.clientSecretHash === undefined) { diff.clientSecretHash = current.clientSecretHash; } else if (current.clientSecretHash == null && last.clientSecretHash == null) { - + } else if ((current.clientSecretHash != null && last.clientSecretHash == null) || (current.clientSecretHash == null && last.clientSecretHash != null)) { diff.clientSecretHash = current.clientSecretHash; } else if (last.clientSecretHash !== current.clientSecretHash) { diff.clientSecretHash = current.clientSecretHash; } - + if (current.name === null && last.name === undefined) { diff.name = current.name; } else if (current.name == null && last.name == null) { - + } else if ((current.name != null && last.name == null) || (current.name == null && last.name != null)) { diff.name = current.name; } else if (last.name !== current.name) { diff.name = current.name; } - + if (current.grantTypes === null && last.grantTypes === undefined) { diff.grantTypes = current.grantTypes; } else if (current.grantTypes == null && last.grantTypes == null) { - + } else if ((current.grantTypes != null && last.grantTypes == null) || (current.grantTypes == null && last.grantTypes != null)) { diff.grantTypes = current.grantTypes; } else if (!equals(last.grantTypes, current.grantTypes)) { diff.grantTypes = current.grantTypes; } - + if (current.responseTypes === null && last.responseTypes === undefined) { diff.responseTypes = current.responseTypes; } else if (current.responseTypes == null && last.responseTypes == null) { - + } else if ((current.responseTypes != null && last.responseTypes == null) || (current.responseTypes == null && last.responseTypes != null)) { diff.responseTypes = current.responseTypes; } else if (!equals(last.responseTypes, current.responseTypes)) { diff.responseTypes = current.responseTypes; } - + if (current.scopes === null && last.scopes === undefined) { diff.scopes = current.scopes; } else if (current.scopes == null && last.scopes == null) { - + } else if ((current.scopes != null && last.scopes == null) || (current.scopes == null && last.scopes != null)) { diff.scopes = current.scopes; } else if (!equals(last.scopes, current.scopes)) { diff.scopes = current.scopes; } - + if (current.redirectUris === null && last.redirectUris === undefined) { diff.redirectUris = current.redirectUris; } else if (current.redirectUris == null && last.redirectUris == null) { - + } else if ((current.redirectUris != null && last.redirectUris == null) || (current.redirectUris == null && last.redirectUris != null)) { diff.redirectUris = current.redirectUris; } else if (!equals(last.redirectUris, current.redirectUris)) { diff.redirectUris = current.redirectUris; } - + if (current.enabled === null && last.enabled === undefined) { diff.enabled = current.enabled; } else if (current.enabled == null && last.enabled == null) { - + } else if ((current.enabled != null && last.enabled == null) || (current.enabled == null && last.enabled != null)) { diff.enabled = current.enabled; } else if (!compareBooleans(last.enabled, current.enabled)) { diff.enabled = current.enabled; } - + if (current.managed_by === null && last.managed_by === undefined) { diff.managed_by = current.managed_by; } else if (current.managed_by == null && last.managed_by == null) { - + } else if ((current.managed_by != null && last.managed_by == null) || (current.managed_by == null && last.managed_by != null)) { diff.managed_by = current.managed_by; } else if (last.managed_by !== current.managed_by) { diff.managed_by = current.managed_by; } - + if (current.logoUri === null && last.logoUri === undefined) { diff.logoUri = current.logoUri; } else if (current.logoUri == null && last.logoUri == null) { - + } else if ((current.logoUri != null && last.logoUri == null) || (current.logoUri == null && last.logoUri != null)) { diff.logoUri = current.logoUri; } else if (last.logoUri !== current.logoUri) { diff.logoUri = current.logoUri; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-oauth_client_12000': function(clone, cloneEmbeddable, processDateProperty, convertToDatabaseValue_grantTypes, convertToDatabaseValue_responseTypes, convertToDatabaseValue_scopes, convertToDatabaseValue_redirectUris) { + 'snapshotGenerator-oauth_client_13000': function(clone, cloneEmbeddable, processDateProperty, convertToDatabaseValue_grantTypes, convertToDatabaseValue_responseTypes, convertToDatabaseValue_scopes, convertToDatabaseValue_redirectUris) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = entity.id; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.clientId !== 'undefined') { ret.clientId = entity.clientId; } - + if (typeof entity.clientSecretHash !== 'undefined') { ret.clientSecretHash = entity.clientSecretHash; } - + if (typeof entity.name !== 'undefined') { ret.name = entity.name; } - + if (typeof entity.grantTypes !== 'undefined') { ret.grantTypes = clone(convertToDatabaseValue_grantTypes(entity.grantTypes)); } - + if (typeof entity.responseTypes !== 'undefined') { ret.responseTypes = clone(convertToDatabaseValue_responseTypes(entity.responseTypes)); } - + if (typeof entity.scopes !== 'undefined') { ret.scopes = clone(convertToDatabaseValue_scopes(entity.scopes)); } - + if (typeof entity.redirectUris !== 'undefined') { ret.redirectUris = clone(convertToDatabaseValue_redirectUris(entity.redirectUris)); } - + if (typeof entity.enabled !== 'undefined') { ret.enabled = entity.enabled; } - + if (typeof entity.managed_by !== 'undefined') { ret.managed_by = entity.managed_by; } - + if (typeof entity.logoUri !== 'undefined') { ret.logoUri = entity.logoUri; } - + return ret; } }, - 'resultMapper-oauth_client_12000': function(PolymorphicRef, parseDate) { + 'resultMapper-oauth_client_13000': function(PolymorphicRef, parseDate) { // compiled mapper for entity OAuthClientEntity return function(result) { const ret = {}; @@ -6409,7 +7041,7 @@ export default { return ret; } }, - 'hydrator-oauth_client_12000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-oauth_client_13000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity OAuthClientEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -6419,7 +7051,7 @@ export default { } } }, - 'hydrator-oauth_client_12000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-oauth_client_13000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity OAuthClientEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -6429,25 +7061,25 @@ export default { } } }, - 'pkGetter-oauth_client_12000': function(isEntityOrRef) { + 'pkGetter-oauth_client_13000': function(isEntityOrRef) { // compiled pk getter for entity OAuthClientEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-oauth_client_12000': function(isEntityOrRef) { + 'pkGetterConverted-oauth_client_13000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity OAuthClientEntity return function(entity) { return entity.id; } }, - 'pkSerializer-oauth_client_12000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-oauth_client_13000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity OAuthClientEntity return function(entity) { return '' + entity.id; } }, - 'hydrator-jwt_key_8000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-jwt_key_9000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity JwtKeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.kid === null) { @@ -6543,7 +7175,7 @@ export default { } } }, - 'hydrator-jwt_key_8000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-jwt_key_9000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity JwtKeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.kid === null) { @@ -6639,176 +7271,176 @@ export default { } } }, - 'comparator-jwt_key_8000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-jwt_key_9000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity JwtKeyEntity return function(last, current, options) { const diff = {}; if (current.kid === null && last.kid === undefined) { diff.kid = current.kid; } else if (current.kid == null && last.kid == null) { - + } else if ((current.kid != null && last.kid == null) || (current.kid == null && last.kid != null)) { diff.kid = current.kid; } else if (last.kid !== current.kid) { diff.kid = current.kid; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.private_key === null && last.private_key === undefined) { diff.private_key = current.private_key; } else if (current.private_key == null && last.private_key == null) { - + } else if ((current.private_key != null && last.private_key == null) || (current.private_key == null && last.private_key != null)) { diff.private_key = current.private_key; } else if (!equals(last.private_key, current.private_key)) { diff.private_key = current.private_key; } - + if (current.public_key === null && last.public_key === undefined) { diff.public_key = current.public_key; } else if (current.public_key == null && last.public_key == null) { - + } else if ((current.public_key != null && last.public_key == null) || (current.public_key == null && last.public_key != null)) { diff.public_key = current.public_key; } else if (!equals(last.public_key, current.public_key)) { diff.public_key = current.public_key; } - + if (current.algorithm === null && last.algorithm === undefined) { diff.algorithm = current.algorithm; } else if (current.algorithm == null && last.algorithm == null) { - + } else if ((current.algorithm != null && last.algorithm == null) || (current.algorithm == null && last.algorithm != null)) { diff.algorithm = current.algorithm; } else if (last.algorithm !== current.algorithm) { diff.algorithm = current.algorithm; } - + if (current.status === null && last.status === undefined) { diff.status = current.status; } else if (current.status == null && last.status == null) { - + } else if ((current.status != null && last.status == null) || (current.status == null && last.status != null)) { diff.status = current.status; } else if (last.status !== current.status) { diff.status = current.status; } - + if (current.activated_at === null && last.activated_at === undefined) { diff.activated_at = current.activated_at; } else if (current.activated_at == null && last.activated_at == null) { - + } else if ((current.activated_at != null && last.activated_at == null) || (current.activated_at == null && last.activated_at != null)) { diff.activated_at = current.activated_at; } else if (last.activated_at.valueOf() !== current.activated_at.valueOf()) { diff.activated_at = current.activated_at; } - + if (current.deactivated_at === null && last.deactivated_at === undefined) { diff.deactivated_at = current.deactivated_at; } else if (current.deactivated_at == null && last.deactivated_at == null) { - + } else if ((current.deactivated_at != null && last.deactivated_at == null) || (current.deactivated_at == null && last.deactivated_at != null)) { diff.deactivated_at = current.deactivated_at; } else if (last.deactivated_at.valueOf() !== current.deactivated_at.valueOf()) { diff.deactivated_at = current.deactivated_at; } - + if (current.retired_at === null && last.retired_at === undefined) { diff.retired_at = current.retired_at; } else if (current.retired_at == null && last.retired_at == null) { - + } else if ((current.retired_at != null && last.retired_at == null) || (current.retired_at == null && last.retired_at != null)) { diff.retired_at = current.retired_at; } else if (last.retired_at.valueOf() !== current.retired_at.valueOf()) { diff.retired_at = current.retired_at; } - + if (current.expires_at === null && last.expires_at === undefined) { diff.expires_at = current.expires_at; } else if (current.expires_at == null && last.expires_at == null) { - + } else if ((current.expires_at != null && last.expires_at == null) || (current.expires_at == null && last.expires_at != null)) { diff.expires_at = current.expires_at; } else if (last.expires_at.valueOf() !== current.expires_at.valueOf()) { diff.expires_at = current.expires_at; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-jwt_key_8000': function(clone, cloneEmbeddable, processDateProperty) { + 'snapshotGenerator-jwt_key_9000': function(clone, cloneEmbeddable, processDateProperty) { return function(entity) { const ret = {}; if (typeof entity.kid !== 'undefined') { ret.kid = entity.kid; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.private_key !== 'undefined') { ret.private_key = clone(entity.private_key); } - + if (typeof entity.public_key !== 'undefined') { ret.public_key = clone(entity.public_key); } - + if (typeof entity.algorithm !== 'undefined') { ret.algorithm = entity.algorithm; } - + if (typeof entity.status !== 'undefined') { ret.status = entity.status; } - + if (typeof entity.activated_at !== 'undefined') { ret.activated_at = clone(processDateProperty(entity.activated_at)); } - + if (typeof entity.deactivated_at !== 'undefined') { ret.deactivated_at = clone(processDateProperty(entity.deactivated_at)); } - + if (typeof entity.retired_at !== 'undefined') { ret.retired_at = clone(processDateProperty(entity.retired_at)); } - + if (typeof entity.expires_at !== 'undefined') { ret.expires_at = clone(processDateProperty(entity.expires_at)); } - + return ret; } }, - 'resultMapper-jwt_key_8000': function(PolymorphicRef, parseDate) { + 'resultMapper-jwt_key_9000': function(PolymorphicRef, parseDate) { // compiled mapper for entity JwtKeyEntity return function(result) { const ret = {}; @@ -6909,7 +7541,7 @@ export default { return ret; } }, - 'hydrator-jwt_key_8000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-jwt_key_9000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity JwtKeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.kid === null) { @@ -6919,7 +7551,7 @@ export default { } } }, - 'hydrator-jwt_key_8000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-jwt_key_9000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity JwtKeyEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.kid === null) { @@ -6929,25 +7561,25 @@ export default { } } }, - 'pkGetter-jwt_key_8000': function(isEntityOrRef) { + 'pkGetter-jwt_key_9000': function(isEntityOrRef) { // compiled pk getter for entity JwtKeyEntity return function(entity) { return entity.kid; } }, - 'pkGetterConverted-jwt_key_8000': function(isEntityOrRef) { + 'pkGetterConverted-jwt_key_9000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity JwtKeyEntity return function(entity) { return entity.kid; } }, - 'pkSerializer-jwt_key_8000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-jwt_key_9000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity JwtKeyEntity return function(entity) { return '' + entity.kid; } }, - 'hydrator-email_verification_7000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_365, user_366) { + 'hydrator-email_verification_8000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_397, user_398) { // compiled hydrator for entity EmailVerificationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -6986,9 +7618,9 @@ export default { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_365, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_397, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_366, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_398, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.token === null) { @@ -7025,7 +7657,7 @@ export default { } } }, - 'hydrator-email_verification_7000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_374, user_375) { + 'hydrator-email_verification_8000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id, user_406, user_407) { // compiled hydrator for entity EmailVerificationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7064,9 +7696,9 @@ export default { entity.user = null; } else if (typeof data.user !== 'undefined') { if (isPrimaryKey(data.user, true)) { - entity.user = Reference.create(factory.createReference(user_374, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.createReference(user_406, data.user, { merge: true, convertCustomTypes, normalizeAccessors, schema })); } else if (data.user && typeof data.user === 'object') { - entity.user = Reference.create(factory.create(user_375, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); + entity.user = Reference.create(factory.create(user_407, data.user, { initialized: true, merge: true, newEntity, convertCustomTypes, normalizeAccessors, schema })); } } if (data.token === null) { @@ -7103,110 +7735,110 @@ export default { } } }, - 'comparator-email_verification_7000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-email_verification_8000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity EmailVerificationEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.user === null && last.user === undefined) { diff.user = current.user; } else if (current.user == null && last.user == null) { - + } else if ((current.user != null && last.user == null) || (current.user == null && last.user != null)) { diff.user = current.user; } else if (last.user !== current.user) { diff.user = current.user; } - + if (current.token === null && last.token === undefined) { diff.token = current.token; } else if (current.token == null && last.token == null) { - + } else if ((current.token != null && last.token == null) || (current.token == null && last.token != null)) { diff.token = current.token; } else if (last.token !== current.token) { diff.token = current.token; } - + if (current.expiresAt === null && last.expiresAt === undefined) { diff.expiresAt = current.expiresAt; } else if (current.expiresAt == null && last.expiresAt == null) { - + } else if ((current.expiresAt != null && last.expiresAt == null) || (current.expiresAt == null && last.expiresAt != null)) { diff.expiresAt = current.expiresAt; } else if (last.expiresAt.valueOf() !== current.expiresAt.valueOf()) { diff.expiresAt = current.expiresAt; } - + if (current.verified === null && last.verified === undefined) { diff.verified = current.verified; } else if (current.verified == null && last.verified == null) { - + } else if ((current.verified != null && last.verified == null) || (current.verified == null && last.verified != null)) { diff.verified = current.verified; } else if (!compareBooleans(last.verified, current.verified)) { diff.verified = current.verified; } - + if (current.verifiedAt === null && last.verifiedAt === undefined) { diff.verifiedAt = current.verifiedAt; } else if (current.verifiedAt == null && last.verifiedAt == null) { - + } else if ((current.verifiedAt != null && last.verifiedAt == null) || (current.verifiedAt == null && last.verifiedAt != null)) { diff.verifiedAt = current.verifiedAt; } else if (last.verifiedAt.valueOf() !== current.verifiedAt.valueOf()) { diff.verifiedAt = current.verifiedAt; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-email_verification_7000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { + 'snapshotGenerator-email_verification_8000': function(clone, cloneEmbeddable, convertToDatabaseValue_id, processDateProperty, toArray, EntityIdentifier) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = convertToDatabaseValue_id(entity.id); } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.user !== 'undefined') { if (entity.user === null) { ret.user = null; @@ -7216,27 +7848,27 @@ export default { ret.user = toArray(entity.user.__helper.getPrimaryKey(true)); } } - + if (typeof entity.token !== 'undefined') { ret.token = entity.token; } - + if (typeof entity.expiresAt !== 'undefined') { ret.expiresAt = clone(processDateProperty(entity.expiresAt)); } - + if (typeof entity.verified !== 'undefined') { ret.verified = entity.verified; } - + if (typeof entity.verifiedAt !== 'undefined') { ret.verifiedAt = clone(processDateProperty(entity.verifiedAt)); } - + return ret; } }, - 'resultMapper-email_verification_7000': function(PolymorphicRef, parseDate) { + 'resultMapper-email_verification_8000': function(PolymorphicRef, parseDate) { // compiled mapper for entity EmailVerificationEntity return function(result) { const ret = {}; @@ -7309,7 +7941,7 @@ export default { return ret; } }, - 'hydrator-email_verification_7000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-email_verification_8000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity EmailVerificationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7324,7 +7956,7 @@ export default { } } }, - 'hydrator-email_verification_7000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { + 'hydrator-email_verification_8000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError, convertToJSValue_id, convertToDatabaseValue_id) { // compiled hydrator for entity EmailVerificationEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7339,26 +7971,26 @@ export default { } } }, - 'pkGetter-email_verification_7000': function(isEntityOrRef) { + 'pkGetter-email_verification_8000': function(isEntityOrRef) { // compiled pk getter for entity EmailVerificationEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-email_verification_7000': function(isEntityOrRef, convertToDatabaseValue_id) { + 'pkGetterConverted-email_verification_8000': function(isEntityOrRef, convertToDatabaseValue_id) { // compiled pk getter (with converted custom types) for entity EmailVerificationEntity return function(entity) { return convertToDatabaseValue_id(entity.id); } }, - 'pkSerializer-email_verification_7000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { + 'pkSerializer-email_verification_8000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash, convertToDatabaseValue_id) { // compiled pk serializer for entity EmailVerificationEntity return function(entity) { const val_12 = convertToDatabaseValue_id(entity.id); return getPrimaryKeyHash(val_12); } }, - 'hydrator-bootstrap_state_1000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-bootstrap_state_2000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity BootstrapStateEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7395,7 +8027,7 @@ export default { } } }, - 'hydrator-bootstrap_state_1000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-bootstrap_state_2000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity BootstrapStateEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7432,78 +8064,78 @@ export default { } } }, - 'comparator-bootstrap_state_1000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + 'comparator-bootstrap_state_2000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { // compiled comparator for entity BootstrapStateEntity return function(last, current, options) { const diff = {}; if (current.id === null && last.id === undefined) { diff.id = current.id; } else if (current.id == null && last.id == null) { - + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { diff.id = current.id; } else if (last.id !== current.id) { diff.id = current.id; } - + if (current.created_at === null && last.created_at === undefined) { diff.created_at = current.created_at; } else if (current.created_at == null && last.created_at == null) { - + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { diff.created_at = current.created_at; } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { diff.created_at = current.created_at; } - + if (current.updated_at === null && last.updated_at === undefined) { diff.updated_at = current.updated_at; } else if (current.updated_at == null && last.updated_at == null) { - + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { diff.updated_at = current.updated_at; } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { diff.updated_at = current.updated_at; } - + if (current.value === null && last.value === undefined) { diff.value = current.value; } else if (current.value == null && last.value == null) { - + } else if ((current.value != null && last.value == null) || (current.value == null && last.value != null)) { diff.value = current.value; } else if (last.value !== current.value) { diff.value = current.value; } - + if (options?.includeInverseSides) { } return diff; } }, - 'snapshotGenerator-bootstrap_state_1000': function(clone, cloneEmbeddable, processDateProperty) { + 'snapshotGenerator-bootstrap_state_2000': function(clone, cloneEmbeddable, processDateProperty) { return function(entity) { const ret = {}; if (typeof entity.id !== 'undefined') { ret.id = entity.id; } - + if (typeof entity.created_at !== 'undefined') { ret.created_at = clone(processDateProperty(entity.created_at)); } - + if (typeof entity.updated_at !== 'undefined') { ret.updated_at = clone(processDateProperty(entity.updated_at)); } - + if (typeof entity.value !== 'undefined') { ret.value = entity.value; } - + return ret; } }, - 'resultMapper-bootstrap_state_1000': function(PolymorphicRef, parseDate) { + 'resultMapper-bootstrap_state_2000': function(PolymorphicRef, parseDate) { // compiled mapper for entity BootstrapStateEntity return function(result) { const ret = {}; @@ -7544,7 +8176,7 @@ export default { return ret; } }, - 'hydrator-bootstrap_state_1000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-bootstrap_state_2000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity BootstrapStateEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7554,7 +8186,7 @@ export default { } } }, - 'hydrator-bootstrap_state_1000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + 'hydrator-bootstrap_state_2000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { // compiled hydrator for entity BootstrapStateEntity ( normalized) return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { if (data.id === null) { @@ -7564,22 +8196,558 @@ export default { } } }, - 'pkGetter-bootstrap_state_1000': function(isEntityOrRef) { + 'pkGetter-bootstrap_state_2000': function(isEntityOrRef) { // compiled pk getter for entity BootstrapStateEntity return function(entity) { return entity.id; } }, - 'pkGetterConverted-bootstrap_state_1000': function(isEntityOrRef) { + 'pkGetterConverted-bootstrap_state_2000': function(isEntityOrRef) { // compiled pk getter (with converted custom types) for entity BootstrapStateEntity return function(entity) { return entity.id; } }, - 'pkSerializer-bootstrap_state_1000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + 'pkSerializer-bootstrap_state_2000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { // compiled pk serializer for entity BootstrapStateEntity return function(entity) { return '' + entity.id; } + }, + 'hydrator-background_jobs_1000-full-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity BackgroundJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + if (data.created_at === null) { + entity.created_at = null; + } else if (typeof data.created_at !== 'undefined') { + if (data.created_at instanceof Date) { + entity.created_at = data.created_at; + } else if (typeof data.created_at === 'number' || data.created_at.includes('+') || data.created_at.lastIndexOf('-') > 10 || data.created_at.endsWith('Z')) { + entity.created_at = new Date(data.created_at); + } else { + entity.created_at = new Date(data.created_at + 'Z'); + } + } + if (data.updated_at === null) { + entity.updated_at = null; + } else if (typeof data.updated_at !== 'undefined') { + if (data.updated_at instanceof Date) { + entity.updated_at = data.updated_at; + } else if (typeof data.updated_at === 'number' || data.updated_at.includes('+') || data.updated_at.lastIndexOf('-') > 10 || data.updated_at.endsWith('Z')) { + entity.updated_at = new Date(data.updated_at); + } else { + entity.updated_at = new Date(data.updated_at + 'Z'); + } + } + if (data.jobId === null) { + entity.jobId = null; + } else if (typeof data.jobId !== 'undefined') { + entity.jobId = data.jobId; + } + if (data.payload === null) { + entity.payload = null; + } else if (typeof data.payload !== 'undefined') { + entity.payload = data.payload; + } + if (data.status === null) { + entity.status = null; + } else if (typeof data.status !== 'undefined') { + entity.status = data.status; + } + if (data.availableAt === null) { + entity.availableAt = null; + } else if (typeof data.availableAt !== 'undefined') { + if (data.availableAt instanceof Date) { + entity.availableAt = data.availableAt; + } else if (typeof data.availableAt === 'number' || data.availableAt.includes('+') || data.availableAt.lastIndexOf('-') > 10 || data.availableAt.endsWith('Z')) { + entity.availableAt = new Date(data.availableAt); + } else { + entity.availableAt = new Date(data.availableAt + 'Z'); + } + } + if (data.lockedBy === null) { + entity.lockedBy = null; + } else if (typeof data.lockedBy !== 'undefined') { + entity.lockedBy = data.lockedBy; + } + if (data.lockedUntil === null) { + entity.lockedUntil = null; + } else if (typeof data.lockedUntil !== 'undefined') { + if (data.lockedUntil instanceof Date) { + entity.lockedUntil = data.lockedUntil; + } else if (typeof data.lockedUntil === 'number' || data.lockedUntil.includes('+') || data.lockedUntil.lastIndexOf('-') > 10 || data.lockedUntil.endsWith('Z')) { + entity.lockedUntil = new Date(data.lockedUntil); + } else { + entity.lockedUntil = new Date(data.lockedUntil + 'Z'); + } + } + if (data.attemptCount === null) { + entity.attemptCount = null; + } else if (typeof data.attemptCount !== 'undefined') { + entity.attemptCount = data.attemptCount; + } + if (data.maxAttempts === null) { + entity.maxAttempts = null; + } else if (typeof data.maxAttempts !== 'undefined') { + entity.maxAttempts = data.maxAttempts; + } + if (data.lastError === null) { + entity.lastError = null; + } else if (typeof data.lastError !== 'undefined') { + entity.lastError = data.lastError; + } + if (data.completedAt === null) { + entity.completedAt = null; + } else if (typeof data.completedAt !== 'undefined') { + if (data.completedAt instanceof Date) { + entity.completedAt = data.completedAt; + } else if (typeof data.completedAt === 'number' || data.completedAt.includes('+') || data.completedAt.lastIndexOf('-') > 10 || data.completedAt.endsWith('Z')) { + entity.completedAt = new Date(data.completedAt); + } else { + entity.completedAt = new Date(data.completedAt + 'Z'); + } + } + } + }, + 'hydrator-background_jobs_1000-full-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity BackgroundJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + if (data.created_at === null) { + entity.created_at = null; + } else if (typeof data.created_at !== 'undefined') { + if (data.created_at instanceof Date) { + entity.created_at = data.created_at; + } else if (typeof data.created_at === 'number' || data.created_at.includes('+') || data.created_at.lastIndexOf('-') > 10 || data.created_at.endsWith('Z')) { + entity.created_at = new Date(data.created_at); + } else { + entity.created_at = new Date(data.created_at + 'Z'); + } + } + if (data.updated_at === null) { + entity.updated_at = null; + } else if (typeof data.updated_at !== 'undefined') { + if (data.updated_at instanceof Date) { + entity.updated_at = data.updated_at; + } else if (typeof data.updated_at === 'number' || data.updated_at.includes('+') || data.updated_at.lastIndexOf('-') > 10 || data.updated_at.endsWith('Z')) { + entity.updated_at = new Date(data.updated_at); + } else { + entity.updated_at = new Date(data.updated_at + 'Z'); + } + } + if (data.jobId === null) { + entity.jobId = null; + } else if (typeof data.jobId !== 'undefined') { + entity.jobId = data.jobId; + } + if (data.payload === null) { + entity.payload = null; + } else if (typeof data.payload !== 'undefined') { + entity.payload = data.payload; + } + if (data.status === null) { + entity.status = null; + } else if (typeof data.status !== 'undefined') { + entity.status = data.status; + } + if (data.availableAt === null) { + entity.availableAt = null; + } else if (typeof data.availableAt !== 'undefined') { + if (data.availableAt instanceof Date) { + entity.availableAt = data.availableAt; + } else if (typeof data.availableAt === 'number' || data.availableAt.includes('+') || data.availableAt.lastIndexOf('-') > 10 || data.availableAt.endsWith('Z')) { + entity.availableAt = new Date(data.availableAt); + } else { + entity.availableAt = new Date(data.availableAt + 'Z'); + } + } + if (data.lockedBy === null) { + entity.lockedBy = null; + } else if (typeof data.lockedBy !== 'undefined') { + entity.lockedBy = data.lockedBy; + } + if (data.lockedUntil === null) { + entity.lockedUntil = null; + } else if (typeof data.lockedUntil !== 'undefined') { + if (data.lockedUntil instanceof Date) { + entity.lockedUntil = data.lockedUntil; + } else if (typeof data.lockedUntil === 'number' || data.lockedUntil.includes('+') || data.lockedUntil.lastIndexOf('-') > 10 || data.lockedUntil.endsWith('Z')) { + entity.lockedUntil = new Date(data.lockedUntil); + } else { + entity.lockedUntil = new Date(data.lockedUntil + 'Z'); + } + } + if (data.attemptCount === null) { + entity.attemptCount = null; + } else if (typeof data.attemptCount !== 'undefined') { + entity.attemptCount = data.attemptCount; + } + if (data.maxAttempts === null) { + entity.maxAttempts = null; + } else if (typeof data.maxAttempts !== 'undefined') { + entity.maxAttempts = data.maxAttempts; + } + if (data.lastError === null) { + entity.lastError = null; + } else if (typeof data.lastError !== 'undefined') { + entity.lastError = data.lastError; + } + if (data.completedAt === null) { + entity.completedAt = null; + } else if (typeof data.completedAt !== 'undefined') { + if (data.completedAt instanceof Date) { + entity.completedAt = data.completedAt; + } else if (typeof data.completedAt === 'number' || data.completedAt.includes('+') || data.completedAt.lastIndexOf('-') > 10 || data.completedAt.endsWith('Z')) { + entity.completedAt = new Date(data.completedAt); + } else { + entity.completedAt = new Date(data.completedAt + 'Z'); + } + } + } + }, + 'comparator-background_jobs_1000': function(compareArrays, compareBooleans, compareBuffers, compareObjects, equals) { + // compiled comparator for entity BackgroundJobEntity + return function(last, current, options) { + const diff = {}; + if (current.id === null && last.id === undefined) { + diff.id = current.id; + } else if (current.id == null && last.id == null) { + + } else if ((current.id != null && last.id == null) || (current.id == null && last.id != null)) { + diff.id = current.id; + } else if (last.id !== current.id) { + diff.id = current.id; + } + + if (current.created_at === null && last.created_at === undefined) { + diff.created_at = current.created_at; + } else if (current.created_at == null && last.created_at == null) { + + } else if ((current.created_at != null && last.created_at == null) || (current.created_at == null && last.created_at != null)) { + diff.created_at = current.created_at; + } else if (last.created_at.valueOf() !== current.created_at.valueOf()) { + diff.created_at = current.created_at; + } + + if (current.updated_at === null && last.updated_at === undefined) { + diff.updated_at = current.updated_at; + } else if (current.updated_at == null && last.updated_at == null) { + + } else if ((current.updated_at != null && last.updated_at == null) || (current.updated_at == null && last.updated_at != null)) { + diff.updated_at = current.updated_at; + } else if (last.updated_at.valueOf() !== current.updated_at.valueOf()) { + diff.updated_at = current.updated_at; + } + + if (current.jobId === null && last.jobId === undefined) { + diff.jobId = current.jobId; + } else if (current.jobId == null && last.jobId == null) { + + } else if ((current.jobId != null && last.jobId == null) || (current.jobId == null && last.jobId != null)) { + diff.jobId = current.jobId; + } else if (last.jobId !== current.jobId) { + diff.jobId = current.jobId; + } + + if (current.payload === null && last.payload === undefined) { + diff.payload = current.payload; + } else if (current.payload == null && last.payload == null) { + + } else if ((current.payload != null && last.payload == null) || (current.payload == null && last.payload != null)) { + diff.payload = current.payload; + } else if (!equals(last.payload, current.payload)) { + diff.payload = current.payload; + } + + if (current.status === null && last.status === undefined) { + diff.status = current.status; + } else if (current.status == null && last.status == null) { + + } else if ((current.status != null && last.status == null) || (current.status == null && last.status != null)) { + diff.status = current.status; + } else if (last.status !== current.status) { + diff.status = current.status; + } + + if (current.availableAt === null && last.availableAt === undefined) { + diff.availableAt = current.availableAt; + } else if (current.availableAt == null && last.availableAt == null) { + + } else if ((current.availableAt != null && last.availableAt == null) || (current.availableAt == null && last.availableAt != null)) { + diff.availableAt = current.availableAt; + } else if (last.availableAt.valueOf() !== current.availableAt.valueOf()) { + diff.availableAt = current.availableAt; + } + + if (current.lockedBy === null && last.lockedBy === undefined) { + diff.lockedBy = current.lockedBy; + } else if (current.lockedBy == null && last.lockedBy == null) { + + } else if ((current.lockedBy != null && last.lockedBy == null) || (current.lockedBy == null && last.lockedBy != null)) { + diff.lockedBy = current.lockedBy; + } else if (last.lockedBy !== current.lockedBy) { + diff.lockedBy = current.lockedBy; + } + + if (current.lockedUntil === null && last.lockedUntil === undefined) { + diff.lockedUntil = current.lockedUntil; + } else if (current.lockedUntil == null && last.lockedUntil == null) { + + } else if ((current.lockedUntil != null && last.lockedUntil == null) || (current.lockedUntil == null && last.lockedUntil != null)) { + diff.lockedUntil = current.lockedUntil; + } else if (last.lockedUntil.valueOf() !== current.lockedUntil.valueOf()) { + diff.lockedUntil = current.lockedUntil; + } + + if (current.attemptCount === null && last.attemptCount === undefined) { + diff.attemptCount = current.attemptCount; + } else if (current.attemptCount == null && last.attemptCount == null) { + + } else if ((current.attemptCount != null && last.attemptCount == null) || (current.attemptCount == null && last.attemptCount != null)) { + diff.attemptCount = current.attemptCount; + } else if (!equals(last.attemptCount, current.attemptCount)) { + diff.attemptCount = current.attemptCount; + } + + if (current.maxAttempts === null && last.maxAttempts === undefined) { + diff.maxAttempts = current.maxAttempts; + } else if (current.maxAttempts == null && last.maxAttempts == null) { + + } else if ((current.maxAttempts != null && last.maxAttempts == null) || (current.maxAttempts == null && last.maxAttempts != null)) { + diff.maxAttempts = current.maxAttempts; + } else if (!equals(last.maxAttempts, current.maxAttempts)) { + diff.maxAttempts = current.maxAttempts; + } + + if (current.lastError === null && last.lastError === undefined) { + diff.lastError = current.lastError; + } else if (current.lastError == null && last.lastError == null) { + + } else if ((current.lastError != null && last.lastError == null) || (current.lastError == null && last.lastError != null)) { + diff.lastError = current.lastError; + } else if (!equals(last.lastError, current.lastError)) { + diff.lastError = current.lastError; + } + + if (current.completedAt === null && last.completedAt === undefined) { + diff.completedAt = current.completedAt; + } else if (current.completedAt == null && last.completedAt == null) { + + } else if ((current.completedAt != null && last.completedAt == null) || (current.completedAt == null && last.completedAt != null)) { + diff.completedAt = current.completedAt; + } else if (last.completedAt.valueOf() !== current.completedAt.valueOf()) { + diff.completedAt = current.completedAt; + } + + if (options?.includeInverseSides) { + } + return diff; + } + }, + 'snapshotGenerator-background_jobs_1000': function(clone, cloneEmbeddable, processDateProperty) { + return function(entity) { + const ret = {}; + if (typeof entity.id !== 'undefined') { + ret.id = entity.id; + } + + if (typeof entity.created_at !== 'undefined') { + ret.created_at = clone(processDateProperty(entity.created_at)); + } + + if (typeof entity.updated_at !== 'undefined') { + ret.updated_at = clone(processDateProperty(entity.updated_at)); + } + + if (typeof entity.jobId !== 'undefined') { + ret.jobId = entity.jobId; + } + + if (typeof entity.payload !== 'undefined') { + ret.payload = clone(entity.payload); + } + + if (typeof entity.status !== 'undefined') { + ret.status = entity.status; + } + + if (typeof entity.availableAt !== 'undefined') { + ret.availableAt = clone(processDateProperty(entity.availableAt)); + } + + if (typeof entity.lockedBy !== 'undefined') { + ret.lockedBy = entity.lockedBy; + } + + if (typeof entity.lockedUntil !== 'undefined') { + ret.lockedUntil = clone(processDateProperty(entity.lockedUntil)); + } + + if (typeof entity.attemptCount !== 'undefined') { + ret.attemptCount = clone(entity.attemptCount); + } + + if (typeof entity.maxAttempts !== 'undefined') { + ret.maxAttempts = clone(entity.maxAttempts); + } + + if (typeof entity.lastError !== 'undefined') { + ret.lastError = clone(entity.lastError); + } + + if (typeof entity.completedAt !== 'undefined') { + ret.completedAt = clone(processDateProperty(entity.completedAt)); + } + + return ret; + } + }, + 'resultMapper-background_jobs_1000': function(PolymorphicRef, parseDate) { + // compiled mapper for entity BackgroundJobEntity + return function(result) { + const ret = {}; + const mapped = {}; + if (typeof result.id !== 'undefined') { + ret.id = result.id; + mapped.id = true; + } + if (typeof result.created_at !== 'undefined') { + if (result.created_at == null || result.created_at instanceof Date) { + ret.created_at = result.created_at; + } else if (typeof result.created_at === 'bigint') { + ret.created_at = parseDate(Number(result.created_at)); + } else if (typeof result.created_at === 'number' || result.created_at.includes('+') || result.created_at.lastIndexOf('-') > 10 || result.created_at.endsWith('Z')) { + ret.created_at = parseDate(result.created_at); + } else { + ret.created_at = parseDate(result.created_at + 'Z'); + } + mapped.created_at = true; + } + if (typeof result.updated_at !== 'undefined') { + if (result.updated_at == null || result.updated_at instanceof Date) { + ret.updated_at = result.updated_at; + } else if (typeof result.updated_at === 'bigint') { + ret.updated_at = parseDate(Number(result.updated_at)); + } else if (typeof result.updated_at === 'number' || result.updated_at.includes('+') || result.updated_at.lastIndexOf('-') > 10 || result.updated_at.endsWith('Z')) { + ret.updated_at = parseDate(result.updated_at); + } else { + ret.updated_at = parseDate(result.updated_at + 'Z'); + } + mapped.updated_at = true; + } + if (typeof result.job_id !== 'undefined') { + ret.jobId = result.job_id; + mapped.job_id = true; + } + if (typeof result.payload !== 'undefined') { + ret.payload = result.payload; + mapped.payload = true; + } + if (typeof result.status !== 'undefined') { + ret.status = result.status; + mapped.status = true; + } + if (typeof result.available_at !== 'undefined') { + if (result.available_at == null || result.available_at instanceof Date) { + ret.availableAt = result.available_at; + } else if (typeof result.available_at === 'bigint') { + ret.availableAt = parseDate(Number(result.available_at)); + } else if (typeof result.available_at === 'number' || result.available_at.includes('+') || result.available_at.lastIndexOf('-') > 10 || result.available_at.endsWith('Z')) { + ret.availableAt = parseDate(result.available_at); + } else { + ret.availableAt = parseDate(result.available_at + 'Z'); + } + mapped.available_at = true; + } + if (typeof result.locked_by !== 'undefined') { + ret.lockedBy = result.locked_by; + mapped.locked_by = true; + } + if (typeof result.locked_until !== 'undefined') { + if (result.locked_until == null || result.locked_until instanceof Date) { + ret.lockedUntil = result.locked_until; + } else if (typeof result.locked_until === 'bigint') { + ret.lockedUntil = parseDate(Number(result.locked_until)); + } else if (typeof result.locked_until === 'number' || result.locked_until.includes('+') || result.locked_until.lastIndexOf('-') > 10 || result.locked_until.endsWith('Z')) { + ret.lockedUntil = parseDate(result.locked_until); + } else { + ret.lockedUntil = parseDate(result.locked_until + 'Z'); + } + mapped.locked_until = true; + } + if (typeof result.attempt_count !== 'undefined') { + ret.attemptCount = result.attempt_count; + mapped.attempt_count = true; + } + if (typeof result.max_attempts !== 'undefined') { + ret.maxAttempts = result.max_attempts; + mapped.max_attempts = true; + } + if (typeof result.last_error !== 'undefined') { + ret.lastError = result.last_error; + mapped.last_error = true; + } + if (typeof result.completed_at !== 'undefined') { + if (result.completed_at == null || result.completed_at instanceof Date) { + ret.completedAt = result.completed_at; + } else if (typeof result.completed_at === 'bigint') { + ret.completedAt = parseDate(Number(result.completed_at)); + } else if (typeof result.completed_at === 'number' || result.completed_at.includes('+') || result.completed_at.lastIndexOf('-') > 10 || result.completed_at.endsWith('Z')) { + ret.completedAt = parseDate(result.completed_at); + } else { + ret.completedAt = parseDate(result.completed_at + 'Z'); + } + mapped.completed_at = true; + } + for (let k in result) { if (Object.hasOwn(result, k) && !mapped[k] && ret[k] === undefined) ret[k] = result[k]; } + return ret; + } + }, + 'hydrator-background_jobs_1000-reference-false': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity BackgroundJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + } + }, + 'hydrator-background_jobs_1000-reference-true': function(isPrimaryKey, isEntity, isScalarReference, Collection, Reference, PolymorphicRef, ValidationError) { + // compiled hydrator for entity BackgroundJobEntity ( normalized) + return function(entity, data, factory, newEntity, convertCustomTypes, schema, parentSchema, normalizeAccessors) { + if (data.id === null) { + entity.id = null; + } else if (typeof data.id !== 'undefined') { + entity.id = data.id; + } + } + }, + 'pkGetter-background_jobs_1000': function(isEntityOrRef) { + // compiled pk getter for entity BackgroundJobEntity + return function(entity) { + return entity.id; + } + }, + 'pkGetterConverted-background_jobs_1000': function(isEntityOrRef) { + // compiled pk getter (with converted custom types) for entity BackgroundJobEntity + return function(entity) { + return entity.id; + } + }, + 'pkSerializer-background_jobs_1000': function(isEntityOrRef, getCompositeKeyValue, getPrimaryKeyHash) { + // compiled pk serializer for entity BackgroundJobEntity + return function(entity) { + return '' + entity.id; + } } }; diff --git a/packages/server/src/entrypoints/scheduler/cron.ts b/packages/server/src/entrypoints/scheduler/cron.ts new file mode 100644 index 00000000..9ec5a570 --- /dev/null +++ b/packages/server/src/entrypoints/scheduler/cron.ts @@ -0,0 +1,35 @@ +import { Cron } from 'croner'; + +export function validateCronExpression(expression: string): string { + let job: Cron | undefined; + try { + job = new Cron(expression, { paused: true }); + const nextRunAt = job.nextRun(new Date()) ?? null; + if (!nextRunAt) { + throw new Error('Cron expression has no future run'); + } + } catch (err) { + const message = err instanceof Error ? err.message : String(err); + throw new Error(`Invalid cron expression "${expression}": ${message}`); + } finally { + job?.stop(); + } + + return expression; +} + +export function getNextCronRunAt(expression: string, from: Date): Date { + let job: Cron | undefined; + try { + job = new Cron(expression, { paused: true }); + const nextRunAt = job.nextRun(from) ?? null; + + if (!nextRunAt) { + throw new Error(`Cron expression has no future run: ${expression}`); + } + + return nextRunAt; + } finally { + job?.stop(); + } +} diff --git a/packages/server/src/entrypoints/scheduler/croner.test.ts b/packages/server/src/entrypoints/scheduler/croner.test.ts index 12b17e68..f3d455cd 100644 --- a/packages/server/src/entrypoints/scheduler/croner.test.ts +++ b/packages/server/src/entrypoints/scheduler/croner.test.ts @@ -1,4 +1,5 @@ import { afterEach, describe, expect, test, vi } from 'vitest'; +import { createLogger } from '../../lib/logger.ts'; import { croner } from './croner.ts'; afterEach(() => { @@ -12,7 +13,15 @@ describe('croner scheduler factory', () => { const scheduler = croner(); const handle = await scheduler.start({ - runCleanup: async () => {}, + scheduledJobs: [ + { + id: 'cleanup.run-all', + name: 'Run cleanup tasks', + schedule: { type: 'cron', expression: scheduler.cleanupCron ?? '' }, + handler: async () => {}, + }, + ], + backgroundJobs: [], }); const nextRunAt = handle.getNextRunAt?.() ?? null; @@ -22,29 +31,84 @@ describe('croner scheduler factory', () => { await handle.stop(); }); - test('supports overriding the cron schedule', async () => { + test('rejects invalid cleanup cron expressions', () => { + expect(() => croner({ cleanupCron: 'not a cron' })).toThrow( + 'Invalid cron expression', + ); + }); + + test('uses each scheduled job cron expression', async () => { vi.useFakeTimers(); vi.setSystemTime(new Date('2026-03-12T00:05:00.000Z')); - const defaultHandle = await croner().start({ - runCleanup: async () => {}, + const handle = await croner().start({ + scheduledJobs: [ + { + id: 'daily', + name: 'Daily', + schedule: { type: 'cron', expression: '0 2 * * *' }, + handler: async () => {}, + }, + { + id: 'frequent', + name: 'Frequent', + schedule: { type: 'cron', expression: '*/30 * * * *' }, + handler: async () => {}, + }, + ], + backgroundJobs: [], }); - const customHandle = await croner({ - cron: '*/30 * * * *', - }).start({ - runCleanup: async () => {}, + + const nextRunAt = handle.getNextRunAt?.() ?? null; + + expect(nextRunAt).toEqual(new Date('2026-03-12T00:30:00.000Z')); + + await handle.stop(); + }); + + test('rejects background enqueue because croner is not durable', async () => { + const handle = await croner().start({ + scheduledJobs: [], + backgroundJobs: [], }); - const defaultNextRun = defaultHandle.getNextRunAt?.() ?? null; - const customNextRun = customHandle.getNextRunAt?.() ?? null; + await expect( + handle.enqueue?.({ jobId: 'example', payload: null }), + ).rejects.toThrow('Background jobs require a durable scheduler backend'); - expect(defaultNextRun).toBeInstanceOf(Date); - expect(customNextRun).toBeInstanceOf(Date); - expect(customNextRun?.getTime()).toBeLessThan( - defaultNextRun?.getTime() ?? 0, - ); + await handle.stop(); + }); + + test('logs scheduled job failures without rejecting the cron callback', async () => { + const logger = createLogger({ logging: { level: 'silent' } }); + const errorSpy = vi.spyOn(logger, 'error'); + const handle = await croner().start({ + scheduledJobs: [ + { + id: 'failing-job', + name: 'Failing Job', + schedule: { type: 'cron', expression: '* * * * * *' }, + handler: async () => { + throw new Error('scheduled boom'); + }, + }, + ], + backgroundJobs: [], + logger, + }); - await defaultHandle.stop(); - await customHandle.stop(); + try { + await vi.waitFor( + () => { + expect(errorSpy).toHaveBeenCalledWith( + { err: expect.any(Error), jobId: 'failing-job' }, + 'Scheduled job failed', + ); + }, + { timeout: 1500 }, + ); + } finally { + await handle.stop(); + } }); }); diff --git a/packages/server/src/entrypoints/scheduler/croner.ts b/packages/server/src/entrypoints/scheduler/croner.ts index 3701f1dc..db2be2ad 100644 --- a/packages/server/src/entrypoints/scheduler/croner.ts +++ b/packages/server/src/entrypoints/scheduler/croner.ts @@ -3,28 +3,56 @@ import type { SchedulerConfig, SchedulerHandle, } from '../../lib/config/index.ts'; +import { validateCronExpression } from './cron.ts'; const DEFAULT_CRON = '0 2 * * *'; export interface CronerSchedulerOptions { - cron?: string | undefined; + cleanupCron?: string | undefined; } export function croner(options: CronerSchedulerOptions = {}): SchedulerConfig { - const cron = options.cron ?? DEFAULT_CRON; + const cleanupCron = validateCronExpression( + options.cleanupCron ?? DEFAULT_CRON, + ); return { - start({ runCleanup }) { - const job = new Cron(cron, async () => { - await runCleanup(); - }); + cleanupCron, + start({ scheduledJobs, logger }) { + const cronJobs = scheduledJobs.map( + (job) => + new Cron(job.schedule.expression, async () => { + try { + await job.handler({ logger }); + } catch (err) { + logger?.error({ err, jobId: job.id }, 'Scheduled job failed'); + } + }), + ); const handle: SchedulerHandle = { stop() { - job.stop(); + for (const cronJob of cronJobs) { + cronJob.stop(); + } }, getNextRunAt() { - return job.nextRun() ?? null; + const nextRuns = cronJobs + .map((cronJob) => cronJob.nextRun() ?? null) + .filter((nextRun) => nextRun !== null); + + return nextRuns.reduce((earliest, nextRun) => { + if (!earliest || nextRun.getTime() < earliest.getTime()) { + return nextRun; + } + + return earliest; + }, null); + }, + async enqueue() { + throw new Error( + 'Background jobs require a durable scheduler backend', + ); }, }; diff --git a/packages/server/src/entrypoints/scheduler/database.test.ts b/packages/server/src/entrypoints/scheduler/database.test.ts new file mode 100644 index 00000000..0e7370ec --- /dev/null +++ b/packages/server/src/entrypoints/scheduler/database.test.ts @@ -0,0 +1,1625 @@ +import { EntityRepository } from '@mikro-orm/core'; +import { afterEach, describe, expect, test, vi } from 'vitest'; +import { BackgroundJobEntitySchema } from '../../entities/background-job.entity.ts'; +import { SchedulerJobEntitySchema } from '../../entities/scheduler-job.entity.ts'; +import type { SchedulerHandle } from '../../lib/config/index.ts'; +import type { ServiceContainer } from '../../services/container.ts'; +import { createTestApp } from '../../test-utils/index.ts'; +import { MINIMAL_TEST_CONFIG } from '../../test-utils/setup.ts'; +import { + DatabaseBackgroundJobStore, + DatabaseSchedulerStore, + database, +} from './database.ts'; + +interface Deferred { + promise: Promise; + resolve: () => void; +} + +function createDeferred(): Deferred { + let resolve: () => void = () => {}; + const promise = new Promise((promiseResolve) => { + resolve = promiseResolve; + }); + + return { promise, resolve }; +} + +describe('database scheduler factory', () => { + let cleanup: (() => Promise) | undefined; + + afterEach(async () => { + if (cleanup) { + await cleanup(); + cleanup = undefined; + } + vi.useRealTimers(); + vi.restoreAllMocks(); + }); + + async function createScheduledServices(): Promise { + const result = await createTestApp({ + ...MINIMAL_TEST_CONFIG, + scheduler: database({ + cleanupCron: '* * * * *', + pollIntervalMs: 10, + lockTtlMs: 1000, + instanceId: 'test-instance', + }), + }); + cleanup = result.cleanup; + return result.services; + } + + async function findCleanupJob(services: ServiceContainer) { + return services.mikro.em + .fork() + .getRepository(SchedulerJobEntitySchema) + .findOne({ id: 'cleanup.run-all' }); + } + + async function findJob(services: ServiceContainer, id: string) { + return services.mikro.em + .fork() + .getRepository(SchedulerJobEntitySchema) + .findOne({ id }); + } + + async function findBackgroundJob(services: ServiceContainer, id: string) { + return services.mikro.em + .fork() + .getRepository(BackgroundJobEntitySchema) + .findOne({ id }); + } + + test('creates a persistent cleanup job on startup', async () => { + const services = await createScheduledServices(); + + const job = await findCleanupJob(services); + + expect(job).toMatchObject({ + id: 'cleanup.run-all', + name: 'Run cleanup tasks', + enabled: true, + cron: '* * * * *', + runCount: 0, + failureCount: 0, + }); + expect(job?.nextRunAt).toBeInstanceOf(Date); + }); + + test('rejects invalid runtime interval options', () => { + expect(() => database({ pollIntervalMs: 0 })).toThrow( + 'pollIntervalMs must be a positive number', + ); + expect(() => database({ lockTtlMs: -1 })).toThrow( + 'lockTtlMs must be a positive number', + ); + expect(() => database({ backgroundRetryDelayMs: Number.NaN })).toThrow( + 'backgroundRetryDelayMs must be a positive number', + ); + expect(() => database({ backgroundMaxAttempts: 0 })).toThrow( + 'backgroundMaxAttempts must be a positive number', + ); + expect(() => database({ backgroundMaxAttempts: 1.5 })).toThrow( + 'backgroundMaxAttempts must be a positive integer', + ); + }); + + test('rejects invalid cleanup cron expressions', () => { + expect(() => database({ cleanupCron: 'not a cron' })).toThrow( + 'Invalid cron expression', + ); + }); + + test('rejects non JSON-safe background job payloads when enqueueing', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const scheduler = database({ + pollIntervalMs: 1000, + lockTtlMs: 1000, + instanceId: 'background-json-safe-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-json-safe-test', + name: 'Background JSON Safe Test', + handler: async () => {}, + }, + ], + }); + const enqueue = handle.enqueue; + if (!enqueue) { + throw new Error('Expected background enqueue handle'); + } + + const circularPayload: { child?: unknown } = {}; + circularPayload.child = circularPayload; + const nonEnumerableToJsonPayload = { value: 'visible' }; + Object.defineProperty(nonEnumerableToJsonPayload, 'toJSON', { + value: () => 'hidden', + }); + const sparseArrayPayload = [1]; + delete sparseArrayPayload[0]; + + try { + await expect( + enqueue({ + jobId: 'background-json-safe-test', + // @ts-expect-error Runtime validation rejects invalid callers. + payload: undefined, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + payload: Number.NaN, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + payload: Number.POSITIVE_INFINITY, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + // @ts-expect-error Runtime validation rejects invalid callers. + payload: circularPayload, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + // @ts-expect-error Runtime validation rejects invalid callers. + payload: 1n, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + // @ts-expect-error Runtime validation rejects invalid callers. + payload: { nested: undefined }, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + payload: sparseArrayPayload, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + // @ts-expect-error Runtime validation rejects invalid callers. + payload: new Date(), + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + // @ts-expect-error Runtime validation rejects invalid callers. + payload: { value: 'visible', toJSON: () => 'hidden' }, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + await expect( + enqueue({ + jobId: 'background-json-safe-test', + payload: nonEnumerableToJsonPayload, + }), + ).rejects.toThrow('Background job payload must be JSON-safe'); + } finally { + await handle.stop(); + } + }); + + test('runs a due cleanup job once and advances the schedule', async () => { + const services = await createScheduledServices(); + const runAllSpy = vi + .spyOn(services.cleanupService, 'runAll') + .mockResolvedValue({ + tasks: [], + totalDeleted: 0, + totalSkipped: 0, + totalFailed: 0, + totalDurationMs: 0, + }); + + await services.mikro.schedulerJob.nativeUpdate( + { id: 'cleanup.run-all' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + + await vi.waitFor(async () => { + const job = await findCleanupJob(services); + expect(job?.runCount).toBe(1); + }); + + const job = await findCleanupJob(services); + expect(runAllSpy).toHaveBeenCalledTimes(1); + expect(job?.lockedBy).toBeNull(); + expect(job?.lockedUntil).toBeNull(); + expect(job?.lastSuccessAt).toBeInstanceOf(Date); + expect(job?.nextRunAt?.getTime()).toBeGreaterThan(Date.now()); + }); + + test('records cleanup failures in the persistent job state', async () => { + const services = await createScheduledServices(); + vi.spyOn(services.cleanupService, 'runAll').mockRejectedValue( + new Error('cleanup failed'), + ); + + await services.mikro.schedulerJob.nativeUpdate( + { id: 'cleanup.run-all' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + + await vi.waitFor(async () => { + const job = await findCleanupJob(services); + expect(job?.runCount).toBe(1); + }); + + const job = await findCleanupJob(services); + expect(job?.lockedBy).toBeNull(); + expect(job?.lockedUntil).toBeNull(); + expect(job?.lastSuccessAt).toBeNull(); + expect(job?.lastErrorAt).toBeInstanceOf(Date); + expect(job?.lastError).toContain('cleanup failed'); + expect(job?.failureCount).toBe(1); + }); + + test('reconciles jobs idempotently during concurrent startup', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const handler = vi.fn(async () => {}); + const schedulerA = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 1000, + lockTtlMs: 1000, + instanceId: 'startup-a', + mikro: services.mikro, + }); + const schedulerB = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 1000, + lockTtlMs: 1000, + instanceId: 'startup-b', + mikro: services.mikro, + }); + const handles = await Promise.all([ + schedulerA.start({ + scheduledJobs: [ + { + id: 'startup-test', + name: 'Startup Test', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }), + schedulerB.start({ + scheduledJobs: [ + { + id: 'startup-test', + name: 'Startup Test', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }), + ]); + + try { + const jobs = await services.mikro.em + .fork() + .getRepository(SchedulerJobEntitySchema) + .find({ id: 'startup-test' }); + + expect(jobs).toHaveLength(1); + expect(jobs[0]).toMatchObject({ + id: 'startup-test', + name: 'Startup Test', + enabled: true, + }); + } finally { + await Promise.all(handles.map((handle) => handle.stop())); + } + }); + + test('disables stale scheduled jobs when no scheduled jobs are registered', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const scheduler = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 1000, + lockTtlMs: 1000, + instanceId: 'empty-reconcile', + mikro: services.mikro, + }); + const initialHandle = await scheduler.start({ + scheduledJobs: [ + { + id: 'stale-empty-test', + name: 'Stale Empty Test', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => {}, + }, + ], + backgroundJobs: [], + }); + await initialHandle.stop(); + + const emptyHandle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [], + }); + + try { + const job = await findJob(services, 'stale-empty-test'); + expect(job?.enabled).toBe(false); + } finally { + await emptyHandle.stop(); + } + }); + + test('runs a due job once when two instances contend for it', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const started = createDeferred(); + const release = createDeferred(); + const handler = vi.fn(async () => { + started.resolve(); + await release.promise; + }); + const schedulerA = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 5, + lockTtlMs: 1000, + instanceId: 'contend-a', + mikro: services.mikro, + }); + const schedulerB = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 5, + lockTtlMs: 1000, + instanceId: 'contend-b', + mikro: services.mikro, + }); + const handleA = await schedulerA.start({ + scheduledJobs: [ + { + id: 'contend-test', + name: 'Contend Test', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }); + const handleB = await schedulerB.start({ + scheduledJobs: [ + { + id: 'contend-test', + name: 'Contend Test', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }); + + try { + await services.mikro.schedulerJob.nativeUpdate( + { id: 'contend-test' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + await started.promise; + await new Promise((resolve) => setTimeout(resolve, 50)); + + expect(handler).toHaveBeenCalledTimes(1); + } finally { + release.resolve(); + await Promise.all([handleA.stop(), handleB.stop()]); + } + + const job = await findJob(services, 'contend-test'); + expect(job?.runCount).toBe(1); + }); + + test('continues to another scheduled job after a CAS miss', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const now = new Date(); + const em = services.mikro.em.fork(); + em.persist( + em.create(SchedulerJobEntitySchema, { + id: 'scheduled-cas-first', + name: 'Scheduled CAS First', + enabled: true, + cron: '* * * * *', + nextRunAt: new Date(now.getTime() - 2000), + lastRunAt: null, + lastSuccessAt: null, + lastErrorAt: null, + lastError: null, + lockedBy: null, + lockedUntil: null, + runCount: 0, + failureCount: 0, + created_at: now, + updated_at: now, + }), + ); + em.persist( + em.create(SchedulerJobEntitySchema, { + id: 'scheduled-cas-second', + name: 'Scheduled CAS Second', + enabled: true, + cron: '* * * * *', + nextRunAt: new Date(now.getTime() - 1000), + lastRunAt: null, + lastSuccessAt: null, + lastErrorAt: null, + lastError: null, + lockedBy: null, + lockedUntil: null, + runCount: 0, + failureCount: 0, + created_at: now, + updated_at: now, + }), + ); + await em.flush(); + + vi.spyOn(EntityRepository.prototype, 'nativeUpdate').mockResolvedValueOnce( + 0, + ); + + const store = new DatabaseSchedulerStore(services.mikro); + const acquired = await store.acquireDueJob( + now, + new Date(now.getTime() + 1000), + 'scheduled-cas-a', + ); + + expect(acquired?.id).toBe('scheduled-cas-second'); + }); + + test('does not record success when completion lost the lease', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const started = createDeferred(); + const release = createDeferred(); + const handler = vi.fn(async () => { + started.resolve(); + await release.promise; + }); + const scheduler = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 5, + lockTtlMs: 10000, + instanceId: 'stale-success-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [ + { + id: 'stale-success', + name: 'Stale Success', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }); + + try { + await services.mikro.schedulerJob.nativeUpdate( + { id: 'stale-success' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + await started.promise; + const takeoverUntil = new Date(Date.now() + 60000); + await services.mikro.schedulerJob.nativeUpdate( + { id: 'stale-success' }, + { lockedBy: 'stale-success-b', lockedUntil: takeoverUntil }, + ); + + release.resolve(); + await handle.stop(); + } finally { + release.resolve(); + } + + const job = await findJob(services, 'stale-success'); + expect(job?.lockedBy).toBe('stale-success-b'); + expect(job?.lockedUntil?.getTime()).toBeGreaterThan(Date.now()); + expect(job?.runCount).toBe(0); + expect(job?.lastSuccessAt).toBeNull(); + }); + + test('does not record failure when completion lost the lease', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const started = createDeferred(); + const release = createDeferred(); + const handler = vi.fn(async () => { + started.resolve(); + await release.promise; + throw new Error('stale failure'); + }); + const scheduler = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 5, + lockTtlMs: 10000, + instanceId: 'stale-failure-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [ + { + id: 'stale-failure', + name: 'Stale Failure', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }); + + try { + await services.mikro.schedulerJob.nativeUpdate( + { id: 'stale-failure' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + await started.promise; + const takeoverUntil = new Date(Date.now() + 60000); + await services.mikro.schedulerJob.nativeUpdate( + { id: 'stale-failure' }, + { lockedBy: 'stale-failure-b', lockedUntil: takeoverUntil }, + ); + + release.resolve(); + await handle.stop(); + } finally { + release.resolve(); + } + + const job = await findJob(services, 'stale-failure'); + expect(job?.lockedBy).toBe('stale-failure-b'); + expect(job?.lockedUntil?.getTime()).toBeGreaterThan(Date.now()); + expect(job?.runCount).toBe(0); + expect(job?.failureCount).toBe(0); + expect(job?.lastErrorAt).toBeNull(); + expect(job?.lastError).toBeNull(); + }); + + test('does not overwrite a reconciled cron schedule with stale completion data', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const started = createDeferred(); + const release = createDeferred(); + const handler = vi.fn(async () => { + started.resolve(); + await release.promise; + }); + const scheduler = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 5, + lockTtlMs: 10000, + instanceId: 'cron-change-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [ + { + id: 'cron-change', + name: 'Cron Change', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }); + + const reconciledNextRunAt = new Date(Date.now() + 24 * 60 * 60 * 1000); + try { + await services.mikro.schedulerJob.nativeUpdate( + { id: 'cron-change' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + await started.promise; + await services.mikro.schedulerJob.nativeUpdate( + { id: 'cron-change' }, + { + cron: '0 0 * * *', + nextRunAt: reconciledNextRunAt, + }, + ); + + release.resolve(); + await handle.stop(); + } finally { + release.resolve(); + } + + const job = await findJob(services, 'cron-change'); + expect(job?.cron).toBe('0 0 * * *'); + expect(job?.nextRunAt?.getTime()).toBe(reconciledNextRunAt.getTime()); + expect(job?.runCount).toBe(0); + expect(job?.lastSuccessAt).toBeNull(); + }); + + test('does not record scheduled completion after its lease expires', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const started = createDeferred(); + const release = createDeferred(); + const handler = vi.fn(async () => { + started.resolve(); + await release.promise; + }); + const scheduler = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 5, + lockTtlMs: 10000, + instanceId: 'expired-completion-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [ + { + id: 'expired-completion', + name: 'Expired Completion', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }); + + try { + await services.mikro.schedulerJob.nativeUpdate( + { id: 'expired-completion' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + await started.promise; + await services.mikro.schedulerJob.nativeUpdate( + { id: 'expired-completion' }, + { lockedUntil: new Date(Date.now() - 1000) }, + ); + + release.resolve(); + await handle.stop(); + } finally { + release.resolve(); + } + + const job = await findJob(services, 'expired-completion'); + expect(job?.lockedBy).toBe('expired-completion-a'); + expect(job?.runCount).toBe(0); + expect(job?.lastSuccessAt).toBeNull(); + }); + + test('aborts a running scheduled job when lease renewal loses ownership', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + vi.useFakeTimers(); + vi.setSystemTime(new Date('2026-05-13T00:00:00.000Z')); + const started = createDeferred(); + const release = createDeferred(); + let signal: AbortSignal | undefined; + let abortFired = false; + const handler = vi.fn(async (context) => { + signal = context.signal; + context.signal?.addEventListener('abort', () => { + abortFired = true; + }); + started.resolve(); + await release.promise; + }); + const scheduler = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 10, + lockTtlMs: 20, + instanceId: 'scheduled-lease-loss-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [ + { + id: 'scheduled-lease-loss', + name: 'Scheduled Lease Loss', + schedule: { type: 'cron', expression: '* * * * *' }, + handler, + }, + ], + backgroundJobs: [], + }); + + try { + await services.mikro.schedulerJob.nativeUpdate( + { id: 'scheduled-lease-loss' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + await vi.advanceTimersByTimeAsync(10); + await started.promise; + await services.mikro.schedulerJob.nativeUpdate( + { id: 'scheduled-lease-loss' }, + { lockedBy: 'scheduled-lease-loss-b' }, + ); + + await vi.advanceTimersByTimeAsync(10); + + if (!signal) { + throw new Error('Expected scheduled job AbortSignal'); + } + expect(signal).toBeInstanceOf(AbortSignal); + expect(signal.aborted).toBe(true); + expect(abortFired).toBe(true); + } finally { + release.resolve(); + await handle.stop(); + } + }); + + test('renews leases so long-running jobs are not acquired twice', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const started = createDeferred(); + const release = createDeferred(); + const handler = vi.fn(async () => { + started.resolve(); + await release.promise; + }); + const schedulerA = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 5, + lockTtlMs: 50, + instanceId: 'lease-a', + mikro: services.mikro, + }); + const schedulerB = database({ + cleanupCron: '* * * * *', + pollIntervalMs: 5, + lockTtlMs: 50, + instanceId: 'lease-b', + mikro: services.mikro, + }); + let handleA: SchedulerHandle | undefined; + let handleB: SchedulerHandle | undefined; + + try { + handleA = await schedulerA.start({ + scheduledJobs: [ + { + id: 'lease-test', + name: 'Lease Test', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }); + await services.mikro.schedulerJob.nativeUpdate( + { id: 'lease-test' }, + { nextRunAt: new Date(Date.now() - 1000) }, + ); + + await started.promise; + handleB = await schedulerB.start({ + scheduledJobs: [ + { + id: 'lease-test', + name: 'Lease Test', + schedule: { type: 'cron', expression: '* * * * *' }, + handler: async () => handler(), + }, + ], + backgroundJobs: [], + }); + await new Promise((resolve) => setTimeout(resolve, 150)); + + expect(handler).toHaveBeenCalledTimes(1); + } finally { + release.resolve(); + if (handleB) { + await handleB.stop(); + } + if (handleA) { + await handleA.stop(); + } + } + + await vi.waitFor(async () => { + const job = await services.mikro.em + .fork() + .getRepository(SchedulerJobEntitySchema) + .findOne({ id: 'lease-test' }); + expect(job?.runCount).toBe(1); + }); + }); + + test('enqueues and runs a durable background job once', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const handler = vi.fn(async () => {}); + const scheduler = database({ + pollIntervalMs: 5, + lockTtlMs: 1000, + instanceId: 'background-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-test', + name: 'Background Test', + handler, + }, + ], + }); + + try { + const id = await handle.enqueue?.({ + jobId: 'background-test', + payload: { value: 'ok' }, + }); + if (!id) { + throw new Error('Expected background job id'); + } + + await vi.waitFor(async () => { + const job = await findBackgroundJob(services, id); + expect(job?.status).toBe('succeeded'); + }); + + const job = await findBackgroundJob(services, id); + expect(job?.attemptCount).toBe(1); + expect(handler).toHaveBeenCalledTimes(1); + expect(handler).toHaveBeenCalledWith({ value: 'ok' }, expect.anything()); + } finally { + await handle.stop(); + } + }); + + test('does not record background completion after its lease expires', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const started = createDeferred(); + const release = createDeferred(); + const handler = vi.fn(async () => { + started.resolve(); + await release.promise; + }); + const scheduler = database({ + pollIntervalMs: 5, + lockTtlMs: 10000, + instanceId: 'background-expired-completion-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-expired-completion-test', + name: 'Background Expired Completion Test', + handler, + }, + ], + }); + + try { + const id = await handle.enqueue?.({ + jobId: 'background-expired-completion-test', + payload: null, + }); + if (!id) { + throw new Error('Expected background job id'); + } + + await started.promise; + await services.mikro.backgroundJob.nativeUpdate( + { id }, + { lockedUntil: new Date(Date.now() - 1000) }, + ); + + release.resolve(); + await handle.stop(); + + const job = await findBackgroundJob(services, id); + expect(job?.status).toBe('running'); + expect(job?.lockedBy).toBe('background-expired-completion-a'); + expect(job?.attemptCount).toBe(1); + expect(job?.completedAt).toBeNull(); + } finally { + release.resolve(); + } + }); + + test('aborts a running background job when lease renewal loses ownership', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + vi.useFakeTimers(); + vi.setSystemTime(new Date('2026-05-13T00:00:00.000Z')); + const started = createDeferred(); + const release = createDeferred(); + let signal: AbortSignal | undefined; + let abortFired = false; + const handler = vi.fn(async (_payload, context) => { + signal = context.signal; + context.signal?.addEventListener('abort', () => { + abortFired = true; + }); + started.resolve(); + await release.promise; + }); + const scheduler = database({ + pollIntervalMs: 10, + lockTtlMs: 20, + instanceId: 'background-lease-loss-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-lease-loss-test', + name: 'Background Lease Loss Test', + handler, + }, + ], + }); + + try { + const id = await handle.enqueue?.({ + jobId: 'background-lease-loss-test', + payload: null, + }); + if (!id) { + throw new Error('Expected background job id'); + } + + await vi.advanceTimersByTimeAsync(10); + await started.promise; + await services.mikro.backgroundJob.nativeUpdate( + { id }, + { lockedBy: 'background-lease-loss-b' }, + ); + + await vi.advanceTimersByTimeAsync(10); + + if (!signal) { + throw new Error('Expected background job AbortSignal'); + } + expect(signal).toBeInstanceOf(AbortSignal); + expect(signal.aborted).toBe(true); + expect(abortFired).toBe(true); + } finally { + release.resolve(); + await handle.stop(); + } + }); + + test('records durable background job failures and stops retrying', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const scheduler = database({ + pollIntervalMs: 5, + lockTtlMs: 1000, + backgroundRetryDelayMs: 5, + backgroundMaxAttempts: 2, + instanceId: 'background-failure-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-failure-test', + name: 'Background Failure Test', + handler: async () => { + throw new Error('background failed'); + }, + }, + ], + }); + + try { + const id = await handle.enqueue?.({ + jobId: 'background-failure-test', + payload: null, + }); + if (!id) { + throw new Error('Expected background job id'); + } + + await vi.waitFor(async () => { + const job = await findBackgroundJob(services, id); + expect(job?.status).toBe('failed'); + }); + + const job = await findBackgroundJob(services, id); + expect(job?.attemptCount).toBe(2); + expect(job?.lastError).toContain('background failed'); + expect(job?.completedAt).toBeInstanceOf(Date); + } finally { + await handle.stop(); + } + }); + + test('marks background jobs with invalid persisted payloads as failed', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const handler = vi.fn(async () => {}); + const scheduler = database({ + pollIntervalMs: 5, + lockTtlMs: 1000, + instanceId: 'background-invalid-payload-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-invalid-payload-test', + name: 'Background Invalid Payload Test', + handler, + }, + ], + }); + + try { + const now = new Date(); + const id = crypto.randomUUID(); + const em = services.mikro.em.fork(); + const job = em.create(BackgroundJobEntitySchema, { + id, + jobId: 'background-invalid-payload-test', + payload: '{invalid-json', + status: 'pending', + availableAt: now, + lockedBy: null, + lockedUntil: null, + attemptCount: 0, + maxAttempts: 3, + lastError: null, + completedAt: null, + created_at: now, + updated_at: now, + }); + em.persist(job); + await em.flush(); + + await vi.waitFor(async () => { + const persistedJob = await findBackgroundJob(services, id); + expect(persistedJob?.status).toBe('failed'); + }); + + const persistedJob = await findBackgroundJob(services, id); + expect(handler).not.toHaveBeenCalled(); + expect(persistedJob?.lockedBy).toBeNull(); + expect(persistedJob?.lockedUntil).toBeNull(); + expect(persistedJob?.attemptCount).toBe(1); + expect(persistedJob?.lastError).toContain('JSON'); + expect(persistedJob?.completedAt).toBeInstanceOf(Date); + } finally { + await handle.stop(); + } + }); + + test('continues to due background jobs after invalid payloads', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const handler = vi.fn(async () => {}); + const now = new Date(); + const invalidId = crypto.randomUUID(); + const runnableId = crypto.randomUUID(); + const em = services.mikro.em.fork(); + em.persist( + em.create(BackgroundJobEntitySchema, { + id: invalidId, + jobId: 'background-invalid-continue-test', + payload: '{invalid-json', + status: 'pending', + availableAt: new Date(now.getTime() - 1000), + lockedBy: null, + lockedUntil: null, + attemptCount: 0, + maxAttempts: 3, + lastError: null, + completedAt: null, + created_at: now, + updated_at: now, + }), + ); + em.persist( + em.create(BackgroundJobEntitySchema, { + id: runnableId, + jobId: 'background-invalid-continue-test', + payload: JSON.stringify({ value: 'next' }), + status: 'pending', + availableAt: now, + lockedBy: null, + lockedUntil: null, + attemptCount: 0, + maxAttempts: 3, + lastError: null, + completedAt: null, + created_at: now, + updated_at: now, + }), + ); + await em.flush(); + + const scheduler = database({ + pollIntervalMs: 1000, + lockTtlMs: 1000, + instanceId: 'background-invalid-continue-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-invalid-continue-test', + name: 'Background Invalid Continue Test', + handler, + }, + ], + }); + + try { + await vi.waitFor(async () => { + const invalid = await findBackgroundJob(services, invalidId); + const runnable = await findBackgroundJob(services, runnableId); + expect(invalid?.status).toBe('failed'); + expect(runnable?.status).toBe('succeeded'); + }); + + expect(handler).toHaveBeenCalledTimes(1); + expect(handler).toHaveBeenCalledWith( + { value: 'next' }, + expect.anything(), + ); + } finally { + await handle.stop(); + } + }); + + test('reclaims an expired running background job', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const handler = vi.fn(async () => {}); + const scheduler = database({ + pollIntervalMs: 5, + lockTtlMs: 1000, + instanceId: 'background-reclaim-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-reclaim-test', + name: 'Background Reclaim Test', + handler, + }, + ], + }); + + try { + const id = await handle.enqueue?.({ + jobId: 'background-reclaim-test', + payload: { value: 'reclaim' }, + runAt: new Date(Date.now() + 60000), + }); + if (!id) { + throw new Error('Expected background job id'); + } + + await services.mikro.backgroundJob.nativeUpdate( + { id }, + { + status: 'running', + lockedBy: 'dead-worker', + lockedUntil: new Date(Date.now() - 1000), + attemptCount: 1, + }, + ); + + await vi.waitFor(async () => { + const job = await findBackgroundJob(services, id); + expect(job?.status).toBe('succeeded'); + }); + + const job = await findBackgroundJob(services, id); + expect(handler).toHaveBeenCalledTimes(1); + expect(job?.attemptCount).toBe(2); + expect(job?.lockedBy).toBeNull(); + expect(job?.lockedUntil).toBeNull(); + } finally { + await handle.stop(); + } + }); + + test('does not reclaim expired running background jobs after max attempts', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const handler = vi.fn(async () => {}); + const scheduler = database({ + pollIntervalMs: 5, + lockTtlMs: 1000, + instanceId: 'background-max-attempts-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-max-attempts-test', + name: 'Background Max Attempts Test', + handler, + }, + ], + }); + + try { + const id = await handle.enqueue?.({ + jobId: 'background-max-attempts-test', + payload: { value: 'expired' }, + runAt: new Date(Date.now() + 60000), + }); + if (!id) { + throw new Error('Expected background job id'); + } + + await services.mikro.backgroundJob.nativeUpdate( + { id }, + { + status: 'running', + lockedBy: 'dead-worker', + lockedUntil: new Date(Date.now() - 1000), + attemptCount: 3, + maxAttempts: 3, + }, + ); + + await vi.waitFor(async () => { + const job = await findBackgroundJob(services, id); + expect(job?.status).toBe('failed'); + }); + + const job = await findBackgroundJob(services, id); + expect(handler).not.toHaveBeenCalled(); + expect(job?.attemptCount).toBe(3); + expect(job?.lockedBy).toBeNull(); + expect(job?.lockedUntil).toBeNull(); + expect(job?.lastError).toContain('maximum attempts'); + expect(job?.completedAt).toBeInstanceOf(Date); + } finally { + await handle.stop(); + } + }); + + test('continues to due background jobs after expiring exhausted jobs', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const handler = vi.fn(async () => {}); + const now = new Date(); + const exhaustedId = crypto.randomUUID(); + const runnableId = crypto.randomUUID(); + const em = services.mikro.em.fork(); + em.persist( + em.create(BackgroundJobEntitySchema, { + id: exhaustedId, + jobId: 'background-head-of-line-test', + payload: JSON.stringify(null), + status: 'running', + availableAt: new Date(now.getTime() - 2000), + lockedBy: 'dead-worker', + lockedUntil: new Date(now.getTime() - 1000), + attemptCount: 3, + maxAttempts: 3, + lastError: null, + completedAt: null, + created_at: now, + updated_at: now, + }), + ); + em.persist( + em.create(BackgroundJobEntitySchema, { + id: runnableId, + jobId: 'background-head-of-line-test', + payload: JSON.stringify({ value: 'next' }), + status: 'pending', + availableAt: now, + lockedBy: null, + lockedUntil: null, + attemptCount: 0, + maxAttempts: 3, + lastError: null, + completedAt: null, + created_at: now, + updated_at: now, + }), + ); + await em.flush(); + + const scheduler = database({ + pollIntervalMs: 1000, + lockTtlMs: 1000, + instanceId: 'background-head-of-line-a', + mikro: services.mikro, + }); + const handle = await scheduler.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-head-of-line-test', + name: 'Background Head Of Line Test', + handler, + }, + ], + }); + + try { + await vi.waitFor(async () => { + const exhausted = await findBackgroundJob(services, exhaustedId); + const runnable = await findBackgroundJob(services, runnableId); + expect(exhausted?.status).toBe('failed'); + expect(runnable?.status).toBe('succeeded'); + }); + + expect(handler).toHaveBeenCalledTimes(1); + expect(handler).toHaveBeenCalledWith( + { value: 'next' }, + expect.anything(), + ); + } finally { + await handle.stop(); + } + }); + + test('reclaims an expired running background job once under contention', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const started = createDeferred(); + const release = createDeferred(); + const handler = vi.fn(async () => { + started.resolve(); + await release.promise; + }); + const schedulerA = database({ + pollIntervalMs: 5, + lockTtlMs: 1000, + instanceId: 'background-contend-a', + mikro: services.mikro, + }); + const schedulerB = database({ + pollIntervalMs: 5, + lockTtlMs: 1000, + instanceId: 'background-contend-b', + mikro: services.mikro, + }); + const handleA = await schedulerA.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-contend-test', + name: 'Background Contend Test', + handler, + }, + ], + }); + const handleB = await schedulerB.start({ + scheduledJobs: [], + backgroundJobs: [ + { + id: 'background-contend-test', + name: 'Background Contend Test', + handler, + }, + ], + }); + + try { + const id = await handleA.enqueue?.({ + jobId: 'background-contend-test', + payload: null, + runAt: new Date(Date.now() + 60000), + }); + if (!id) { + throw new Error('Expected background job id'); + } + + await services.mikro.backgroundJob.nativeUpdate( + { id }, + { + status: 'running', + lockedBy: 'dead-worker', + lockedUntil: new Date(Date.now() - 1000), + attemptCount: 1, + }, + ); + + await started.promise; + await new Promise((resolve) => setTimeout(resolve, 50)); + expect(handler).toHaveBeenCalledTimes(1); + } finally { + release.resolve(); + await Promise.all([handleA.stop(), handleB.stop()]); + } + }); + + test('continues to another background job after a CAS miss', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const now = new Date(); + const firstId = crypto.randomUUID(); + const secondId = crypto.randomUUID(); + const em = services.mikro.em.fork(); + em.persist( + em.create(BackgroundJobEntitySchema, { + id: firstId, + jobId: 'background-cas-test', + payload: JSON.stringify({ value: 'first' }), + status: 'pending', + availableAt: new Date(now.getTime() - 2000), + lockedBy: null, + lockedUntil: null, + attemptCount: 0, + maxAttempts: 3, + lastError: null, + completedAt: null, + created_at: now, + updated_at: now, + }), + ); + em.persist( + em.create(BackgroundJobEntitySchema, { + id: secondId, + jobId: 'background-cas-test', + payload: JSON.stringify({ value: 'second' }), + status: 'pending', + availableAt: new Date(now.getTime() - 1000), + lockedBy: null, + lockedUntil: null, + attemptCount: 0, + maxAttempts: 3, + lastError: null, + completedAt: null, + created_at: now, + updated_at: now, + }), + ); + await em.flush(); + + vi.spyOn(EntityRepository.prototype, 'nativeUpdate').mockResolvedValueOnce( + 0, + ); + + const store = new DatabaseBackgroundJobStore(services.mikro); + const acquired = await store.acquireDueJob( + now, + new Date(now.getTime() + 1000), + 'background-cas-a', + ); + + expect(acquired).toMatchObject({ + id: secondId, + jobId: 'background-cas-test', + payload: { value: 'second' }, + attemptCount: 1, + maxAttempts: 3, + }); + }); + + test('cleans up only old completed background jobs', async () => { + const result = await createTestApp(MINIMAL_TEST_CONFIG); + cleanup = result.cleanup; + const services = result.services; + const now = new Date(); + const oldCompletedAt = new Date(now.getTime() - 1000); + const recentCompletedAt = new Date(now.getTime() + 1000); + const oldSucceededId = crypto.randomUUID(); + const oldFailedId = crypto.randomUUID(); + const oldPendingId = crypto.randomUUID(); + const oldRunningId = crypto.randomUUID(); + const recentSucceededId = crypto.randomUUID(); + const em = services.mikro.em.fork(); + const baseJob = { + jobId: 'background-retention-test', + payload: JSON.stringify(null), + availableAt: oldCompletedAt, + lockedBy: null, + lockedUntil: null, + attemptCount: 1, + maxAttempts: 3, + lastError: null, + created_at: oldCompletedAt, + updated_at: oldCompletedAt, + }; + + for (const job of [ + { + ...baseJob, + id: oldSucceededId, + status: 'succeeded', + completedAt: oldCompletedAt, + }, + { + ...baseJob, + id: oldFailedId, + status: 'failed', + completedAt: oldCompletedAt, + }, + { ...baseJob, id: oldPendingId, status: 'pending', completedAt: null }, + { + ...baseJob, + id: oldRunningId, + status: 'running', + completedAt: null, + }, + { + ...baseJob, + id: recentSucceededId, + status: 'succeeded', + completedAt: recentCompletedAt, + }, + ]) { + em.persist(em.create(BackgroundJobEntitySchema, job)); + } + await em.flush(); + + const store = new DatabaseBackgroundJobStore(services.mikro); + const deleted = await store.cleanupCompletedJobs(now); + + expect(deleted).toBe(2); + await expect( + findBackgroundJob(services, oldSucceededId), + ).resolves.toBeNull(); + await expect(findBackgroundJob(services, oldFailedId)).resolves.toBeNull(); + await expect( + findBackgroundJob(services, oldPendingId), + ).resolves.toMatchObject({ + status: 'pending', + }); + await expect( + findBackgroundJob(services, oldRunningId), + ).resolves.toMatchObject({ status: 'running' }); + await expect( + findBackgroundJob(services, recentSucceededId), + ).resolves.toMatchObject({ status: 'succeeded' }); + }); +}); diff --git a/packages/server/src/entrypoints/scheduler/database.ts b/packages/server/src/entrypoints/scheduler/database.ts new file mode 100644 index 00000000..53235c6c --- /dev/null +++ b/packages/server/src/entrypoints/scheduler/database.ts @@ -0,0 +1,684 @@ +import os from 'node:os'; +import { BackgroundJobEntitySchema } from '../../entities/background-job.entity.ts'; +import { SchedulerJobEntitySchema } from '../../entities/scheduler-job.entity.ts'; +import type { + JobPayload, + SchedulerConfig, + SchedulerConfigResolver, + SchedulerRuntimeConfig, +} from '../../lib/config/index.ts'; +import type { MikroService } from '../../services/mikro.service.ts'; +import { validateCronExpression } from './cron.ts'; +import { + type AcquiredBackgroundJob, + type AcquiredSchedulerJob, + type BackgroundJobCompletionInput, + type BackgroundJobEnqueueInput, + type BackgroundJobFailureCompletionInput, + DistributedBackgroundJobRunner, + type DistributedBackgroundJobStore, + DistributedSchedulerRunner, + type DistributedSchedulerStore, + getDistributedSchedulerNextRunAt, + type PersistedSchedulerJobDefinition, + type SchedulerCompletionInput, + type SchedulerFailureCompletionInput, +} from './distributed-runner.ts'; + +const DEFAULT_CLEANUP_CRON = '0 2 * * *'; +const DEFAULT_POLL_INTERVAL_MS = 5000; +const DEFAULT_LOCK_TTL_MS = 60000; +const DEFAULT_BACKGROUND_RETRY_DELAY_MS = 1000; +const DEFAULT_BACKGROUND_MAX_ATTEMPTS = 3; +const DEFAULT_BACKGROUND_RETENTION_MS = 7 * 24 * 60 * 60 * 1000; +const MAX_ERROR_LENGTH = 2000; +const JSON_SAFE_PAYLOAD_ERROR = 'Background job payload must be JSON-safe'; + +export interface DatabaseSchedulerOptions { + cleanupCron?: string | undefined; + pollIntervalMs?: number | undefined; + lockTtlMs?: number | undefined; + backgroundRetryDelayMs?: number | undefined; + backgroundMaxAttempts?: number | undefined; + backgroundRetentionMs?: number | undefined; + instanceId?: string | undefined; +} + +export interface BoundDatabaseSchedulerOptions + extends DatabaseSchedulerOptions { + mikro: MikroService; +} + +interface ResolvedDatabaseSchedulerOptions { + cleanupCron: string; + pollIntervalMs: number; + lockTtlMs: number; + backgroundRetryDelayMs: number; + backgroundMaxAttempts: number; + backgroundRetentionMs: number; + instanceId: string; +} + +function createInstanceId(instanceId: string | undefined): string { + return instanceId ?? `${os.hostname()}:${process.pid}:${crypto.randomUUID()}`; +} + +function resolvePositiveNumber( + name: string, + value: number | undefined, + defaultValue: number, +): number { + const resolved = value ?? defaultValue; + + if (!Number.isFinite(resolved) || resolved <= 0) { + throw new Error(`${name} must be a positive number`); + } + + return resolved; +} + +function resolvePositiveInteger( + name: string, + value: number | undefined, + defaultValue: number, +): number { + const resolved = resolvePositiveNumber(name, value, defaultValue); + + if (!Number.isInteger(resolved)) { + throw new Error(`${name} must be a positive integer`); + } + + return resolved; +} + +function errorToMessage(err: unknown): string { + const message = err instanceof Error ? err.message : String(err); + return message.slice(0, MAX_ERROR_LENGTH); +} + +function validateJsonSafePayload( + value: unknown, + path: string, + seen: WeakSet, +): void { + if (value === null) { + return; + } + + switch (typeof value) { + case 'boolean': + case 'string': + return; + case 'number': + if (!Number.isFinite(value)) { + throw new Error(`${JSON_SAFE_PAYLOAD_ERROR}: ${path} must be finite`); + } + return; + case 'undefined': + throw new Error(`${JSON_SAFE_PAYLOAD_ERROR}: ${path} is undefined`); + case 'bigint': + case 'function': + case 'symbol': + throw new Error( + `${JSON_SAFE_PAYLOAD_ERROR}: ${path} has unsupported type ${typeof value}`, + ); + } + + if (seen.has(value)) { + throw new Error(`${JSON_SAFE_PAYLOAD_ERROR}: ${path} contains a cycle`); + } + + if (Object.hasOwn(value, 'toJSON')) { + throw new Error( + `${JSON_SAFE_PAYLOAD_ERROR}: ${path} must not define toJSON`, + ); + } + + const prototype = Object.getPrototypeOf(value); + if ( + !Array.isArray(value) && + prototype !== Object.prototype && + prototype !== null + ) { + throw new Error( + `${JSON_SAFE_PAYLOAD_ERROR}: ${path} must be a plain object`, + ); + } + + seen.add(value); + if (Array.isArray(value)) { + for (let index = 0; index < value.length; index += 1) { + if (!(index in value)) { + throw new Error( + `${JSON_SAFE_PAYLOAD_ERROR}: ${path}[${index}] is undefined`, + ); + } + validateJsonSafePayload(value[index], `${path}[${index}]`, seen); + } + } else { + for (const [key, child] of Object.entries(value)) { + validateJsonSafePayload(child, `${path}.${key}`, seen); + } + } + seen.delete(value); +} + +function stringifyJsonSafePayload(payload: JobPayload): string { + validateJsonSafePayload(payload, 'payload', new WeakSet()); + const serialized = JSON.stringify(payload); + if (serialized === undefined) { + throw new Error(`${JSON_SAFE_PAYLOAD_ERROR}: payload is undefined`); + } + + return serialized; +} + +function resolveOptions( + options: DatabaseSchedulerOptions, +): ResolvedDatabaseSchedulerOptions { + return { + cleanupCron: validateCronExpression( + options.cleanupCron ?? DEFAULT_CLEANUP_CRON, + ), + pollIntervalMs: resolvePositiveNumber( + 'pollIntervalMs', + options.pollIntervalMs, + DEFAULT_POLL_INTERVAL_MS, + ), + lockTtlMs: resolvePositiveNumber( + 'lockTtlMs', + options.lockTtlMs, + DEFAULT_LOCK_TTL_MS, + ), + backgroundRetryDelayMs: resolvePositiveNumber( + 'backgroundRetryDelayMs', + options.backgroundRetryDelayMs, + DEFAULT_BACKGROUND_RETRY_DELAY_MS, + ), + backgroundMaxAttempts: resolvePositiveInteger( + 'backgroundMaxAttempts', + options.backgroundMaxAttempts, + DEFAULT_BACKGROUND_MAX_ATTEMPTS, + ), + backgroundRetentionMs: resolvePositiveNumber( + 'backgroundRetentionMs', + options.backgroundRetentionMs, + DEFAULT_BACKGROUND_RETENTION_MS, + ), + instanceId: createInstanceId(options.instanceId), + }; +} + +export class DatabaseSchedulerStore implements DistributedSchedulerStore { + private readonly mikro: MikroService; + + constructor(mikro: MikroService) { + this.mikro = mikro; + } + + async reconcileJobs( + jobs: readonly PersistedSchedulerJobDefinition[], + now: Date, + ): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(SchedulerJobEntitySchema); + const jobIds = jobs.map((job) => job.id); + + for (const job of jobs) { + const existing = await repo.findOne({ id: job.id }); + const nextRunAt = getDistributedSchedulerNextRunAt(job.cron, now); + const shouldResetNextRunAt = + !existing?.nextRunAt || existing.cron !== job.cron; + + await em.upsert( + SchedulerJobEntitySchema, + { + id: job.id, + name: job.name, + enabled: true, + cron: job.cron, + nextRunAt: shouldResetNextRunAt ? nextRunAt : existing.nextRunAt, + created_at: now, + updated_at: now, + }, + { + onConflictFields: ['id'], + onConflictAction: 'merge', + onConflictExcludeFields: ['id', 'created_at'], + }, + ); + } + + const staleJobFilter = jobIds.length > 0 ? { id: { $nin: jobIds } } : {}; + await repo.nativeUpdate(staleJobFilter, { enabled: false }); + } + + async acquireDueJob( + now: Date, + lockedUntil: Date, + instanceId: string, + ): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(SchedulerJobEntitySchema); + const seenCandidateIds: string[] = []; + const eligibleFilter = { + enabled: true, + nextRunAt: { $lte: now }, + $or: [{ lockedUntil: null }, { lockedUntil: { $lte: now } }], + }; + + while (true) { + const candidateFilter = { + ...eligibleFilter, + ...(seenCandidateIds.length > 0 + ? { id: { $nin: seenCandidateIds } } + : {}), + }; + const candidate = await repo.findOne(candidateFilter, { + orderBy: { nextRunAt: 'ASC' }, + }); + + if (!candidate) { + return null; + } + + const updated = await repo.nativeUpdate( + { + id: candidate.id, + ...eligibleFilter, + }, + { + lockedBy: instanceId, + lockedUntil, + lastRunAt: now, + }, + ); + + if (updated !== 1) { + seenCandidateIds.push(candidate.id); + continue; + } + + return { + id: candidate.id, + cron: candidate.cron, + runCount: candidate.runCount, + failureCount: candidate.failureCount, + }; + } + } + + async renewLease( + jobId: string, + instanceId: string, + lockedUntil: Date, + now: Date, + ): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(SchedulerJobEntitySchema); + const updated = await repo.nativeUpdate( + { + id: jobId, + lockedBy: instanceId, + lockedUntil: { $gt: now, $lt: lockedUntil }, + }, + { lockedUntil }, + ); + + return updated === 1; + } + + async completeJobSuccess(input: SchedulerCompletionInput): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(SchedulerJobEntitySchema); + const updated = await repo.nativeUpdate( + { + id: input.jobId, + cron: input.cron, + lockedBy: input.instanceId, + lockedUntil: { $gt: input.now }, + }, + { + lockedBy: null, + lockedUntil: null, + nextRunAt: input.nextRunAt, + runCount: input.runCount, + lastSuccessAt: input.now, + }, + ); + + return updated === 1; + } + + async completeJobFailure( + input: SchedulerFailureCompletionInput, + ): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(SchedulerJobEntitySchema); + const updated = await repo.nativeUpdate( + { + id: input.jobId, + cron: input.cron, + lockedBy: input.instanceId, + lockedUntil: { $gt: input.now }, + }, + { + lockedBy: null, + lockedUntil: null, + nextRunAt: input.nextRunAt, + runCount: input.runCount, + lastErrorAt: input.now, + lastError: input.error, + failureCount: input.failureCount, + }, + ); + + return updated === 1; + } + + async findNextRunAt(): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(SchedulerJobEntitySchema); + const next = await repo.findOne( + { enabled: true, nextRunAt: { $ne: null } }, + { orderBy: { nextRunAt: 'ASC' } }, + ); + + return next?.nextRunAt ?? null; + } +} + +export class DatabaseBackgroundJobStore + implements DistributedBackgroundJobStore +{ + private readonly mikro: MikroService; + + constructor(mikro: MikroService) { + this.mikro = mikro; + } + + async enqueue(input: BackgroundJobEnqueueInput): Promise { + const em = this.mikro.em.fork(); + const id = crypto.randomUUID(); + const job = em.create(BackgroundJobEntitySchema, { + id, + jobId: input.jobId, + payload: stringifyJsonSafePayload(input.payload), + status: 'pending', + availableAt: input.availableAt, + lockedBy: null, + lockedUntil: null, + attemptCount: 0, + maxAttempts: input.maxAttempts, + lastError: null, + completedAt: null, + created_at: input.now, + updated_at: input.now, + }); + + em.persist(job); + await em.flush(); + + return id; + } + + async acquireDueJob( + now: Date, + lockedUntil: Date, + instanceId: string, + ): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(BackgroundJobEntitySchema); + const seenCandidateIds: string[] = []; + const eligibleFilter = { + $or: [ + { + status: 'pending', + availableAt: { $lte: now }, + }, + { + status: 'running', + lockedUntil: { $lte: now }, + }, + ], + }; + while (true) { + const candidateFilter = { + ...eligibleFilter, + ...(seenCandidateIds.length > 0 + ? { id: { $nin: seenCandidateIds } } + : {}), + }; + const candidate = await repo.findOne(candidateFilter, { + orderBy: { availableAt: 'ASC' }, + }); + + if (!candidate) { + return null; + } + + if ( + candidate.status === 'running' && + candidate.attemptCount >= candidate.maxAttempts + ) { + await repo.nativeUpdate( + { id: candidate.id, ...eligibleFilter }, + { + status: 'failed', + availableAt: now, + lockedBy: null, + lockedUntil: null, + lastError: 'Background job exceeded maximum attempts', + completedAt: now, + }, + ); + + continue; + } + + const attemptCount = candidate.attemptCount + 1; + const updated = await repo.nativeUpdate( + { id: candidate.id, ...eligibleFilter }, + { + status: 'running', + lockedBy: instanceId, + lockedUntil, + attemptCount, + }, + ); + + if (updated !== 1) { + seenCandidateIds.push(candidate.id); + continue; + } + + let payload: JobPayload; + try { + payload = JSON.parse(candidate.payload); + } catch (err) { + await repo.nativeUpdate( + { + id: candidate.id, + lockedBy: instanceId, + status: 'running', + lockedUntil: { $gt: now }, + }, + { + status: 'failed', + availableAt: now, + lockedBy: null, + lockedUntil: null, + attemptCount, + lastError: errorToMessage(err), + completedAt: now, + }, + ); + + continue; + } + + return { + id: candidate.id, + jobId: candidate.jobId, + payload, + attemptCount, + maxAttempts: candidate.maxAttempts, + }; + } + } + + async renewLease( + id: string, + instanceId: string, + lockedUntil: Date, + now: Date, + ): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(BackgroundJobEntitySchema); + const updated = await repo.nativeUpdate( + { + id, + lockedBy: instanceId, + status: 'running', + lockedUntil: { $gt: now, $lt: lockedUntil }, + }, + { lockedUntil }, + ); + + return updated === 1; + } + + async completeJobSuccess( + input: BackgroundJobCompletionInput, + ): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(BackgroundJobEntitySchema); + const updated = await repo.nativeUpdate( + { + id: input.id, + lockedBy: input.instanceId, + status: 'running', + lockedUntil: { $gt: input.now }, + }, + { + status: 'succeeded', + lockedBy: null, + lockedUntil: null, + completedAt: input.now, + }, + ); + + return updated === 1; + } + + async completeJobFailure( + input: BackgroundJobFailureCompletionInput, + ): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(BackgroundJobEntitySchema); + const updated = await repo.nativeUpdate( + { + id: input.id, + lockedBy: input.instanceId, + status: 'running', + lockedUntil: { $gt: input.now }, + }, + { + status: input.retryAt ? 'pending' : 'failed', + availableAt: input.retryAt ?? input.now, + lockedBy: null, + lockedUntil: null, + attemptCount: input.attemptCount, + lastError: input.error, + completedAt: input.retryAt ? null : input.now, + }, + ); + + return updated === 1; + } + + async cleanupCompletedJobs(before: Date): Promise { + const em = this.mikro.em.fork(); + const repo = em.getRepository(BackgroundJobEntitySchema); + + return repo.nativeDelete({ + status: { $in: ['succeeded', 'failed'] }, + completedAt: { $lte: before }, + }); + } +} + +function createDatabaseSchedulerConfig( + options: ResolvedDatabaseSchedulerOptions, + mikro: MikroService, +): SchedulerConfig { + return { + cleanupCron: options.cleanupCron, + async start({ scheduledJobs, backgroundJobs, logger }) { + const scheduledRunner = new DistributedSchedulerRunner({ + name: 'Database', + pollIntervalMs: options.pollIntervalMs, + lockTtlMs: options.lockTtlMs, + instanceId: options.instanceId, + jobs: scheduledJobs, + logger, + store: new DatabaseSchedulerStore(mikro), + }); + const backgroundRunner = new DistributedBackgroundJobRunner({ + name: 'Database', + pollIntervalMs: options.pollIntervalMs, + lockTtlMs: options.lockTtlMs, + retryDelayMs: options.backgroundRetryDelayMs, + maxAttempts: options.backgroundMaxAttempts, + retentionMs: options.backgroundRetentionMs, + instanceId: options.instanceId, + jobs: backgroundJobs, + logger, + store: new DatabaseBackgroundJobStore(mikro), + }); + const scheduledHandle = await scheduledRunner.start(); + const backgroundHandle = backgroundRunner.start(); + + return { + stop: async () => { + await backgroundHandle.stop(); + await scheduledHandle.stop(); + }, + getNextRunAt: () => scheduledHandle.getNextRunAt?.() ?? null, + enqueue: async (enqueueOptions) => { + if (!backgroundHandle.enqueue) { + throw new Error( + 'Background jobs require a durable scheduler backend', + ); + } + + return backgroundHandle.enqueue(enqueueOptions); + }, + }; + }, + }; +} + +function hasBoundMikro( + options: DatabaseSchedulerOptions | BoundDatabaseSchedulerOptions, +): options is BoundDatabaseSchedulerOptions { + return 'mikro' in options; +} + +export function database( + options: BoundDatabaseSchedulerOptions, +): SchedulerConfig; +export function database( + options?: DatabaseSchedulerOptions, +): SchedulerConfigResolver; +export function database( + options: DatabaseSchedulerOptions | BoundDatabaseSchedulerOptions = {}, +): SchedulerRuntimeConfig { + const resolved = resolveOptions(options); + + if (hasBoundMikro(options)) { + return createDatabaseSchedulerConfig(resolved, options.mikro); + } + + return ({ mikro }) => createDatabaseSchedulerConfig(resolved, mikro); +} diff --git a/packages/server/src/entrypoints/scheduler/distributed-runner.ts b/packages/server/src/entrypoints/scheduler/distributed-runner.ts new file mode 100644 index 00000000..2826d32c --- /dev/null +++ b/packages/server/src/entrypoints/scheduler/distributed-runner.ts @@ -0,0 +1,546 @@ +import type { + BackgroundJobConfig, + EnqueueBackgroundJobOptions, + JobPayload, + ScheduledJobConfig, + SchedulerHandle, +} from '../../lib/config/index.ts'; +import type { Logger } from '../../lib/logger.ts'; +import { getNextCronRunAt } from './cron.ts'; + +const MAX_ERROR_LENGTH = 2000; +const MAX_CLEANUP_INTERVAL_MS = 24 * 60 * 60 * 1000; + +export interface PersistedSchedulerJobDefinition { + id: string; + name: string; + cron: string; +} + +export interface AcquiredSchedulerJob { + id: string; + cron: string; + runCount: number; + failureCount: number; +} + +export interface AcquiredBackgroundJob { + id: string; + jobId: string; + payload: JobPayload; + attemptCount: number; + maxAttempts: number; +} + +export interface SchedulerCompletionInput { + jobId: string; + cron: string; + instanceId: string; + nextRunAt: Date; + now: Date; + runCount: number; +} + +export interface SchedulerFailureCompletionInput + extends SchedulerCompletionInput { + failureCount: number; + error: string; +} + +export interface BackgroundJobEnqueueInput { + jobId: string; + payload: JobPayload; + availableAt: Date; + maxAttempts: number; + now: Date; +} + +export interface BackgroundJobCompletionInput { + id: string; + instanceId: string; + now: Date; +} + +export interface BackgroundJobFailureCompletionInput + extends BackgroundJobCompletionInput { + error: string; + retryAt: Date | null; + attemptCount: number; +} + +export interface DistributedSchedulerStore { + reconcileJobs: ( + jobs: readonly PersistedSchedulerJobDefinition[], + now: Date, + ) => Promise; + acquireDueJob: ( + now: Date, + lockedUntil: Date, + instanceId: string, + ) => Promise; + renewLease: ( + jobId: string, + instanceId: string, + lockedUntil: Date, + now: Date, + ) => Promise; + completeJobSuccess: (input: SchedulerCompletionInput) => Promise; + completeJobFailure: ( + input: SchedulerFailureCompletionInput, + ) => Promise; + findNextRunAt: () => Promise; +} + +export interface DistributedBackgroundJobStore { + enqueue: (input: BackgroundJobEnqueueInput) => Promise; + acquireDueJob: ( + now: Date, + lockedUntil: Date, + instanceId: string, + ) => Promise; + renewLease: ( + id: string, + instanceId: string, + lockedUntil: Date, + now: Date, + ) => Promise; + completeJobSuccess: (input: BackgroundJobCompletionInput) => Promise; + completeJobFailure: ( + input: BackgroundJobFailureCompletionInput, + ) => Promise; + cleanupCompletedJobs?: (before: Date) => Promise; +} + +interface DistributedSchedulerRunnerOptions { + name: string; + pollIntervalMs: number; + lockTtlMs: number; + instanceId: string; + jobs: readonly ScheduledJobConfig[]; + logger?: Logger | undefined; + store: DistributedSchedulerStore; +} + +interface DistributedBackgroundJobRunnerOptions { + name: string; + pollIntervalMs: number; + lockTtlMs: number; + retryDelayMs: number; + maxAttempts: number; + retentionMs: number; + instanceId: string; + jobs: readonly BackgroundJobConfig[]; + logger?: Logger | undefined; + store: DistributedBackgroundJobStore; +} + +function errorToMessage(err: unknown): string { + const message = err instanceof Error ? err.message : String(err); + return message.slice(0, MAX_ERROR_LENGTH); +} + +export class DistributedSchedulerRunner { + private readonly name: string; + private readonly pollIntervalMs: number; + private readonly lockTtlMs: number; + private readonly instanceId: string; + private readonly jobs: ReadonlyMap; + private readonly logger: Logger | undefined; + private readonly store: DistributedSchedulerStore; + + private interval: ReturnType | null = null; + private runningTick: Promise | null = null; + private nextRunAt: Date | null = null; + private stopped = false; + + constructor(options: DistributedSchedulerRunnerOptions) { + this.name = options.name; + this.pollIntervalMs = options.pollIntervalMs; + this.lockTtlMs = options.lockTtlMs; + this.instanceId = options.instanceId; + this.jobs = new Map(options.jobs.map((job) => [job.id, job])); + this.logger = options.logger; + this.store = options.store; + } + + async start(): Promise { + await this.reconcileJobs(); + this.queueTick(); + this.interval = setInterval(() => this.queueTick(), this.pollIntervalMs); + + return { + stop: async () => { + this.stopped = true; + if (this.interval) { + clearInterval(this.interval); + this.interval = null; + } + if (this.runningTick) { + await this.runningTick; + } + }, + getNextRunAt: () => this.nextRunAt, + }; + } + + private queueTick(): void { + if (this.runningTick || this.stopped) { + return; + } + + this.runningTick = this.runTick() + .catch((err) => { + this.logger?.error({ err }, `${this.name} scheduler tick failed`); + }) + .finally(() => { + this.runningTick = null; + }); + } + + private async reconcileJobs(): Promise { + const now = new Date(); + const definitions = [...this.jobs.values()].map((job) => ({ + id: job.id, + name: job.name, + cron: job.schedule.expression, + })); + + await this.store.reconcileJobs(definitions, now); + this.nextRunAt = await this.store.findNextRunAt(); + } + + private async runTick(): Promise { + while (!this.stopped) { + const now = new Date(); + const lockedUntil = new Date(now.getTime() + this.lockTtlMs); + const acquired = await this.store.acquireDueJob( + now, + lockedUntil, + this.instanceId, + ); + if (!acquired) { + this.nextRunAt = await this.store.findNextRunAt(); + return; + } + + const job = this.jobs.get(acquired.id); + if (!job) { + await this.completeJob( + acquired, + new Error(`Missing scheduler handler: ${acquired.id}`), + ); + continue; + } + + const abortController = new AbortController(); + const stopLeaseRenewal = this.startLeaseRenewal(acquired.id, () => { + abortController.abort(); + }); + try { + await job.handler({ + logger: this.logger, + signal: abortController.signal, + }); + await this.completeJob(acquired); + } catch (err) { + await this.completeJob(acquired, err); + } finally { + stopLeaseRenewal(); + } + } + } + + private startLeaseRenewal( + jobId: string, + onLeaseLost: () => void, + ): () => void { + const renewIntervalMs = Math.max(1, Math.floor(this.lockTtlMs / 2)); + let renewInFlight = false; + const interval = setInterval(() => { + if (renewInFlight) { + return; + } + renewInFlight = true; + const now = new Date(); + const lockedUntil = new Date(now.getTime() + this.lockTtlMs); + void this.store + .renewLease(jobId, this.instanceId, lockedUntil, now) + .then((renewed) => { + if (!renewed) { + this.logger?.warn( + { jobId, instanceId: this.instanceId }, + `${this.name} scheduler lease renewal skipped because lease was lost`, + ); + onLeaseLost(); + } + }) + .catch((err) => { + this.logger?.error( + { err, jobId }, + `${this.name} scheduler lease renewal failed`, + ); + }) + .finally(() => { + renewInFlight = false; + }); + }, renewIntervalMs); + + return () => clearInterval(interval); + } + + private async completeJob( + job: AcquiredSchedulerJob, + err?: unknown, + ): Promise { + const now = new Date(); + const nextRunAt = getNextCronRunAt(job.cron, now); + const runCount = job.runCount + 1; + + const completed = + err === undefined + ? await this.store.completeJobSuccess({ + jobId: job.id, + cron: job.cron, + instanceId: this.instanceId, + nextRunAt, + now, + runCount, + }) + : await this.store.completeJobFailure({ + jobId: job.id, + cron: job.cron, + instanceId: this.instanceId, + nextRunAt, + now, + runCount, + failureCount: job.failureCount + 1, + error: errorToMessage(err), + }); + + if (!completed) { + this.logger?.warn( + { jobId: job.id, instanceId: this.instanceId }, + `${this.name} scheduler completion skipped because lease was lost`, + ); + } + + this.nextRunAt = await this.store.findNextRunAt(); + } +} + +export class DistributedBackgroundJobRunner { + private readonly name: string; + private readonly pollIntervalMs: number; + private readonly lockTtlMs: number; + private readonly retryDelayMs: number; + private readonly maxAttempts: number; + private readonly retentionMs: number; + private readonly cleanupIntervalMs: number; + private readonly instanceId: string; + private readonly jobs: ReadonlyMap; + private readonly logger: Logger | undefined; + private readonly store: DistributedBackgroundJobStore; + + private interval: ReturnType | null = null; + private runningTick: Promise | null = null; + private nextCleanupAt = 0; + private stopped = false; + + constructor(options: DistributedBackgroundJobRunnerOptions) { + this.name = options.name; + this.pollIntervalMs = options.pollIntervalMs; + this.lockTtlMs = options.lockTtlMs; + this.retryDelayMs = options.retryDelayMs; + this.maxAttempts = options.maxAttempts; + this.retentionMs = options.retentionMs; + this.cleanupIntervalMs = Math.min( + this.retentionMs, + MAX_CLEANUP_INTERVAL_MS, + ); + this.instanceId = options.instanceId; + this.jobs = new Map(options.jobs.map((job) => [job.id, job])); + this.logger = options.logger; + this.store = options.store; + } + + start(): SchedulerHandle { + this.queueTick(); + this.interval = setInterval(() => this.queueTick(), this.pollIntervalMs); + + return { + stop: async () => { + this.stopped = true; + if (this.interval) { + clearInterval(this.interval); + this.interval = null; + } + if (this.runningTick) { + await this.runningTick; + } + }, + enqueue: async (options) => this.enqueue(options), + }; + } + + async enqueue( + options: EnqueueBackgroundJobOptions, + ): Promise { + if (!this.jobs.has(options.jobId)) { + throw new Error(`Unknown background job: ${options.jobId}`); + } + + const now = new Date(); + return this.store.enqueue({ + jobId: options.jobId, + payload: options.payload, + availableAt: options.runAt ?? now, + maxAttempts: this.maxAttempts, + now, + }); + } + + private queueTick(): void { + if (this.runningTick || this.stopped) { + return; + } + + this.runningTick = this.runTick() + .catch((err) => { + this.logger?.error({ err }, `${this.name} background job tick failed`); + }) + .finally(() => { + this.runningTick = null; + }); + } + + private async runTick(): Promise { + await this.cleanupCompletedJobs(); + + while (!this.stopped) { + const now = new Date(); + const lockedUntil = new Date(now.getTime() + this.lockTtlMs); + const acquired = await this.store.acquireDueJob( + now, + lockedUntil, + this.instanceId, + ); + if (!acquired) { + return; + } + + const job = this.jobs.get(acquired.jobId); + if (!job) { + await this.completeJob( + acquired, + new Error(`Missing background job handler: ${acquired.jobId}`), + ); + continue; + } + + const abortController = new AbortController(); + const stopLeaseRenewal = this.startLeaseRenewal(acquired.id, () => { + abortController.abort(); + }); + try { + await job.handler(acquired.payload, { + logger: this.logger, + signal: abortController.signal, + }); + await this.completeJob(acquired); + } catch (err) { + await this.completeJob(acquired, err); + } finally { + stopLeaseRenewal(); + } + } + } + + private async cleanupCompletedJobs(): Promise { + if (!this.store.cleanupCompletedJobs) { + return; + } + + const now = new Date(); + if (now.getTime() < this.nextCleanupAt) { + return; + } + + const before = new Date(now.getTime() - this.retentionMs); + await this.store.cleanupCompletedJobs(before); + this.nextCleanupAt = now.getTime() + this.cleanupIntervalMs; + } + + private startLeaseRenewal(id: string, onLeaseLost: () => void): () => void { + const renewIntervalMs = Math.max(1, Math.floor(this.lockTtlMs / 2)); + let renewInFlight = false; + const interval = setInterval(() => { + if (renewInFlight) { + return; + } + renewInFlight = true; + const now = new Date(); + const lockedUntil = new Date(now.getTime() + this.lockTtlMs); + void this.store + .renewLease(id, this.instanceId, lockedUntil, now) + .then((renewed) => { + if (!renewed) { + this.logger?.warn( + { id, instanceId: this.instanceId }, + `${this.name} background job lease renewal skipped because lease was lost`, + ); + onLeaseLost(); + } + }) + .catch((err) => { + this.logger?.error( + { err, id }, + `${this.name} background job lease renewal failed`, + ); + }) + .finally(() => { + renewInFlight = false; + }); + }, renewIntervalMs); + + return () => clearInterval(interval); + } + + private async completeJob( + job: AcquiredBackgroundJob, + err?: unknown, + ): Promise { + const now = new Date(); + const completed = + err === undefined + ? await this.store.completeJobSuccess({ + id: job.id, + instanceId: this.instanceId, + now, + }) + : await this.store.completeJobFailure({ + id: job.id, + instanceId: this.instanceId, + now, + attemptCount: job.attemptCount, + retryAt: + job.attemptCount < job.maxAttempts + ? new Date(now.getTime() + this.retryDelayMs) + : null, + error: errorToMessage(err), + }); + + if (!completed) { + this.logger?.warn( + { id: job.id, instanceId: this.instanceId }, + `${this.name} background job completion skipped because lease was lost`, + ); + } + } +} + +export function getDistributedSchedulerNextRunAt( + cron: string, + from: Date, +): Date { + return getNextCronRunAt(cron, from); +} diff --git a/packages/server/src/lib/config/index.ts b/packages/server/src/lib/config/index.ts index 6c2e75d0..e8e6b64f 100644 --- a/packages/server/src/lib/config/index.ts +++ b/packages/server/src/lib/config/index.ts @@ -52,11 +52,22 @@ export type { } from './resolved.ts'; export { TinyAuthRuntimeConfigSchema } from './resolved.ts'; export type { + BackgroundJobConfig, + EnqueueBackgroundJobOptions, + JobPayload, + JobRunContext, + ScheduledJobConfig, SchedulerConfig, + SchedulerConfigResolver, SchedulerHandle, + SchedulerRuntimeConfig, + SchedulerRuntimeContext, SchedulerStartOptions, } from './scheduler.ts'; -export { SchedulerConfigSchema } from './scheduler.ts'; +export { + isSchedulerConfigResolver, + SchedulerConfigSchema, +} from './scheduler.ts'; export type { SecurityConfig } from './security.ts'; export { SecurityConfigSchema } from './security.ts'; export type { ServerConfig } from './server.ts'; diff --git a/packages/server/src/lib/config/resolved.ts b/packages/server/src/lib/config/resolved.ts index fbdeeefb..fed6a490 100644 --- a/packages/server/src/lib/config/resolved.ts +++ b/packages/server/src/lib/config/resolved.ts @@ -44,9 +44,7 @@ export const TinyAuthRuntimeConfigSchema = z 'Security and cryptographic settings.', ), cleanup: CleanupConfigSchema.describe('Data cleanup settings.'), - scheduler: SchedulerConfigSchema.describe( - 'In-process cleanup scheduler adapter.', - ), + scheduler: SchedulerConfigSchema.describe('Cleanup scheduler adapter.'), terms: TermsConfigSchema.describe('Terms of service settings.'), clients: ClientConfigsSchema.describe( 'Registered OAuth/OIDC client applications.', diff --git a/packages/server/src/lib/config/scheduler.ts b/packages/server/src/lib/config/scheduler.ts index 963849ee..448dfde1 100644 --- a/packages/server/src/lib/config/scheduler.ts +++ b/packages/server/src/lib/config/scheduler.ts @@ -1,20 +1,77 @@ import z from 'zod'; +import type { MikroService } from '../../services/mikro.service.ts'; +import type { Logger } from '../logger.ts'; + +export type JobPayload = + | null + | boolean + | number + | string + | readonly JobPayload[] + | { readonly [key: string]: JobPayload }; + +export interface JobRunContext { + logger?: Logger | undefined; + signal?: AbortSignal | undefined; +} + +export interface CronJobSchedule { + type: 'cron'; + expression: string; +} + +export interface ScheduledJobConfig { + id: string; + name: string; + schedule: CronJobSchedule; + handler: (context: JobRunContext) => Promise; +} + +export interface BackgroundJobConfig { + id: string; + name: string; + handler: (payload: TPayload, context: JobRunContext) => Promise; +} + +export interface EnqueueBackgroundJobOptions< + TPayload extends JobPayload = JobPayload, +> { + jobId: string; + payload: TPayload; + runAt?: Date | undefined; +} export interface SchedulerStartOptions { - runCleanup: () => Promise; + scheduledJobs: readonly ScheduledJobConfig[]; + backgroundJobs: readonly BackgroundJobConfig[]; + logger?: Logger; } export interface SchedulerHandle { stop: () => void | Promise; getNextRunAt?: () => Date | null; + enqueue?: ( + options: EnqueueBackgroundJobOptions, + ) => Promise; } export interface SchedulerConfig { + cleanupCron?: string | undefined; start: ( options: SchedulerStartOptions, ) => SchedulerHandle | Promise; } +export interface SchedulerRuntimeContext { + mikro: MikroService; +} + +export type SchedulerConfigResolver = ( + context: SchedulerRuntimeContext, +) => SchedulerConfig; + +export type SchedulerRuntimeConfig = SchedulerConfig | SchedulerConfigResolver; + function isSchedulerConfig(value: unknown): value is SchedulerConfig { if (typeof value !== 'object' || value === null) { return false; @@ -23,9 +80,21 @@ function isSchedulerConfig(value: unknown): value is SchedulerConfig { return 'start' in value && typeof value.start === 'function'; } +export function isSchedulerConfigResolver( + value: SchedulerRuntimeConfig, +): value is SchedulerConfigResolver { + return typeof value === 'function'; +} + +function isSchedulerRuntimeConfig( + value: unknown, +): value is SchedulerRuntimeConfig { + return isSchedulerConfig(value) || typeof value === 'function'; +} + export const SchedulerConfigSchema = z - .custom(isSchedulerConfig, { - message: 'Invalid SchedulerConfig: must have a start function', + .custom(isSchedulerRuntimeConfig, { + message: 'Invalid SchedulerConfig: must have a start function or resolver', }) .optional() - .describe('In-process cleanup scheduler adapter.'); + .describe('Scheduler adapter.'); diff --git a/packages/server/src/lib/database/entities.ts b/packages/server/src/lib/database/entities.ts index 132fb1a7..4f483105 100644 --- a/packages/server/src/lib/database/entities.ts +++ b/packages/server/src/lib/database/entities.ts @@ -1,4 +1,5 @@ import type { EntityName } from '@mikro-orm/core'; +import { BackgroundJobEntitySchema } from '../../entities/background-job.entity.ts'; import { BootstrapStateEntitySchema } from '../../entities/bootstrap-state.entity.ts'; import { EmailVerificationEntitySchema } from '../../entities/email-verification.entity.ts'; import { JwtKeyEntitySchema } from '../../entities/jwt-key.entity.ts'; @@ -7,6 +8,7 @@ import { OAuthCodeEntitySchema } from '../../entities/oauth-code.entity.ts'; import { PasswordResetEntitySchema } from '../../entities/password-reset.entity.ts'; import { PendingOAuthRegistrationEntitySchema } from '../../entities/pending-oauth-registration.entity.ts'; import { RevokedTokenEntitySchema } from '../../entities/revoked-token.entity.ts'; +import { SchedulerJobEntitySchema } from '../../entities/scheduler-job.entity.ts'; import { TermsEntitySchema } from '../../entities/terms.entity.ts'; import { TermsContentEntitySchema } from '../../entities/terms-content.entity.ts'; import { UserEntitySchema } from '../../entities/user.entity.ts'; @@ -34,6 +36,8 @@ function createDatabaseEntities() { PasswordResetEntitySchema, PendingOAuthRegistrationEntitySchema, RevokedTokenEntitySchema, + BackgroundJobEntitySchema, + SchedulerJobEntitySchema, TermsEntitySchema, TermsContentEntitySchema, UserConsentEntitySchema, diff --git a/packages/server/src/migrations/postgres/Migration20260512120000_add_scheduler_jobs.ts b/packages/server/src/migrations/postgres/Migration20260512120000_add_scheduler_jobs.ts new file mode 100644 index 00000000..e27872f0 --- /dev/null +++ b/packages/server/src/migrations/postgres/Migration20260512120000_add_scheduler_jobs.ts @@ -0,0 +1,33 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20260512120000_add_scheduler_jobs extends Migration { + override up(): void | Promise { + this.addSql( + `create table "scheduled_jobs" ("id" varchar(255) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, "name" varchar(255) not null, "enabled" boolean not null default true, "cron" varchar(255) not null, "next_run_at" timestamptz null, "last_run_at" timestamptz null, "last_success_at" timestamptz null, "last_error_at" timestamptz null, "last_error" text null, "locked_by" varchar(255) null, "locked_until" timestamptz null, "run_count" int not null default 0 check ("run_count" >= 0), "failure_count" int not null default 0 check ("failure_count" >= 0), primary key ("id"));`, + ); + this.addSql( + `comment on table "scheduled_jobs" is 'Persistent scheduler jobs and leases';`, + ); + this.addSql( + `create index "scheduled_jobs_enabled_next_run_at_idx" on "scheduled_jobs" ("enabled", "next_run_at");`, + ); + this.addSql( + `create index "scheduled_jobs_locked_until_idx" on "scheduled_jobs" ("locked_until");`, + ); + this.addSql( + `create table "background_jobs" ("id" varchar(255) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, "job_id" varchar(255) not null, "payload" text not null, "status" varchar(255) not null default 'pending' check ("status" in ('pending', 'running', 'succeeded', 'failed')), "available_at" timestamptz not null, "locked_by" varchar(255) null, "locked_until" timestamptz null, "attempt_count" int not null default 0 check ("attempt_count" >= 0), "max_attempts" int not null default 3 check ("max_attempts" > 0), "last_error" text null, "completed_at" timestamptz null, primary key ("id"));`, + ); + this.addSql( + `comment on table "background_jobs" is 'Durable background job queue';`, + ); + this.addSql( + `create index "background_jobs_status_available_at_idx" on "background_jobs" ("status", "available_at");`, + ); + this.addSql( + `create index "background_jobs_locked_until_idx" on "background_jobs" ("locked_until");`, + ); + this.addSql( + `create index "background_jobs_job_id_idx" on "background_jobs" ("job_id");`, + ); + } +} diff --git a/packages/server/src/migrations/postgres/index.ts b/packages/server/src/migrations/postgres/index.ts index efd5ae84..7d4b3083 100644 --- a/packages/server/src/migrations/postgres/index.ts +++ b/packages/server/src/migrations/postgres/index.ts @@ -1,3 +1,7 @@ import { Migration20260509171036_initial } from './Migration20260509171036_initial.js'; +import { Migration20260512120000_add_scheduler_jobs } from './Migration20260512120000_add_scheduler_jobs.js'; -export const POSTGRES_MIGRATIONS = [Migration20260509171036_initial]; +export const POSTGRES_MIGRATIONS = [ + Migration20260509171036_initial, + Migration20260512120000_add_scheduler_jobs, +]; diff --git a/packages/server/src/migrations/sqlite/Migration20260512120000_add_scheduler_jobs.ts b/packages/server/src/migrations/sqlite/Migration20260512120000_add_scheduler_jobs.ts new file mode 100644 index 00000000..727c36a1 --- /dev/null +++ b/packages/server/src/migrations/sqlite/Migration20260512120000_add_scheduler_jobs.ts @@ -0,0 +1,27 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20260512120000_add_scheduler_jobs extends Migration { + override up(): void | Promise { + this.addSql( + `create table \`scheduled_jobs\` (\`id\` text not null primary key, \`created_at\` datetime not null, \`updated_at\` datetime not null, \`name\` text not null, \`enabled\` integer not null default true, \`cron\` text not null, \`next_run_at\` datetime null, \`last_run_at\` datetime null, \`last_success_at\` datetime null, \`last_error_at\` datetime null, \`last_error\` text null, \`locked_by\` text null, \`locked_until\` datetime null, \`run_count\` integer not null default 0 check (\`run_count\` >= 0), \`failure_count\` integer not null default 0 check (\`failure_count\` >= 0)) /* Persistent scheduler jobs and leases */;`, + ); + this.addSql( + `create index \`scheduled_jobs_enabled_next_run_at_idx\` on \`scheduled_jobs\` (\`enabled\`, \`next_run_at\`);`, + ); + this.addSql( + `create index \`scheduled_jobs_locked_until_idx\` on \`scheduled_jobs\` (\`locked_until\`);`, + ); + this.addSql( + `create table \`background_jobs\` (\`id\` text not null primary key, \`created_at\` datetime not null, \`updated_at\` datetime not null, \`job_id\` text not null, \`payload\` text not null, \`status\` text not null default 'pending' check (\`status\` in ('pending', 'running', 'succeeded', 'failed')), \`available_at\` datetime not null, \`locked_by\` text null, \`locked_until\` datetime null, \`attempt_count\` integer not null default 0 check (\`attempt_count\` >= 0), \`max_attempts\` integer not null default 3 check (\`max_attempts\` > 0), \`last_error\` text null, \`completed_at\` datetime null) /* Durable background job queue */;`, + ); + this.addSql( + `create index \`background_jobs_status_available_at_idx\` on \`background_jobs\` (\`status\`, \`available_at\`);`, + ); + this.addSql( + `create index \`background_jobs_locked_until_idx\` on \`background_jobs\` (\`locked_until\`);`, + ); + this.addSql( + `create index \`background_jobs_job_id_idx\` on \`background_jobs\` (\`job_id\`);`, + ); + } +} diff --git a/packages/server/src/migrations/sqlite/index.ts b/packages/server/src/migrations/sqlite/index.ts index 6e06a36d..02825392 100644 --- a/packages/server/src/migrations/sqlite/index.ts +++ b/packages/server/src/migrations/sqlite/index.ts @@ -1,3 +1,7 @@ import { Migration20260509171226_initial } from './Migration20260509171226_initial.js'; +import { Migration20260512120000_add_scheduler_jobs } from './Migration20260512120000_add_scheduler_jobs.js'; -export const SQLITE_MIGRATIONS = [Migration20260509171226_initial]; +export const SQLITE_MIGRATIONS = [ + Migration20260509171226_initial, + Migration20260512120000_add_scheduler_jobs, +]; diff --git a/packages/server/src/repositories/background-job.repository.ts b/packages/server/src/repositories/background-job.repository.ts new file mode 100644 index 00000000..12043d99 --- /dev/null +++ b/packages/server/src/repositories/background-job.repository.ts @@ -0,0 +1,4 @@ +import { EntityRepository } from '@mikro-orm/core'; +import type { IBackgroundJobEntity } from '../entities/background-job.entity.ts'; + +export class BackgroundJobRepository extends EntityRepository {} diff --git a/packages/server/src/repositories/scheduler-job.repository.ts b/packages/server/src/repositories/scheduler-job.repository.ts new file mode 100644 index 00000000..2ffe0a60 --- /dev/null +++ b/packages/server/src/repositories/scheduler-job.repository.ts @@ -0,0 +1,4 @@ +import { EntityRepository } from '@mikro-orm/core'; +import type { ISchedulerJobEntity } from '../entities/scheduler-job.entity.ts'; + +export class SchedulerJobRepository extends EntityRepository {} diff --git a/packages/server/src/services/container.ts b/packages/server/src/services/container.ts index 8ddca138..b389ce46 100644 --- a/packages/server/src/services/container.ts +++ b/packages/server/src/services/container.ts @@ -1,4 +1,7 @@ -import type { TinyAuthRuntimeConfig } from '../lib/config/index.ts'; +import { + isSchedulerConfigResolver, + type TinyAuthRuntimeConfig, +} from '../lib/config/index.ts'; import type { Logger } from '../lib/logger.ts'; import { type ConfigSeedMode, @@ -103,8 +106,13 @@ export async function initializeServices( // 4. Scheduler const schedulerLogger = logger.child({ service: 'scheduler' }); + const schedulerConfig = config.scheduler + ? isSchedulerConfigResolver(config.scheduler) + ? config.scheduler({ mikro }) + : config.scheduler + : undefined; const scheduler = new SchedulerService( - config.scheduler, + schedulerConfig, cleanupService, schedulerLogger, ); diff --git a/packages/server/src/services/mikro.service.ts b/packages/server/src/services/mikro.service.ts index 08a03745..62812e99 100644 --- a/packages/server/src/services/mikro.service.ts +++ b/packages/server/src/services/mikro.service.ts @@ -1,4 +1,5 @@ import { MikroORM } from '@mikro-orm/core'; +import { BackgroundJobEntitySchema } from '../entities/background-job.entity.ts'; import { EmailVerificationEntitySchema } from '../entities/email-verification.entity.ts'; import { JwtKeyEntity } from '../entities/jwt-key.entity.ts'; import { OAuthClientEntitySchema } from '../entities/oauth-client.entity.ts'; @@ -6,6 +7,7 @@ import { OAuthCodeEntitySchema } from '../entities/oauth-code.entity.ts'; import { PasswordResetEntitySchema } from '../entities/password-reset.entity.ts'; import { PendingOAuthRegistrationEntitySchema } from '../entities/pending-oauth-registration.entity.ts'; import { RevokedTokenEntitySchema } from '../entities/revoked-token.entity.ts'; +import { SchedulerJobEntitySchema } from '../entities/scheduler-job.entity.ts'; import { TermsEntitySchema } from '../entities/terms.entity.ts'; import { TermsContentEntitySchema } from '../entities/terms-content.entity.ts'; import { UserEntity } from '../entities/user.entity.ts'; @@ -17,6 +19,7 @@ import { UserTotpEntitySchema } from '../entities/user-totp.entity.ts'; import { UserTotpRecoveryCodeEntitySchema } from '../entities/user-totp-recovery-code.entity.ts'; import type { TinyAuthRuntimeConfig } from '../lib/config/index.ts'; import type { Logger } from '../lib/logger.ts'; +import type { BackgroundJobRepository } from '../repositories/background-job.repository.ts'; import type { EmailVerificationRepository } from '../repositories/email-verification.repository.ts'; import type { JwtKeyRepository } from '../repositories/jwt-key.repository.ts'; import type { OAuthClientRepository } from '../repositories/oauth-client.repository.ts'; @@ -24,6 +27,7 @@ import type { OAuthCodeRepository } from '../repositories/oauth-code.repository. import type { PasswordResetRepository } from '../repositories/password-reset.repository.ts'; import type { PendingOAuthRegistrationRepository } from '../repositories/pending-oauth-registration.repository.ts'; import type { RevokedTokenRepository } from '../repositories/revoked-token.repository.ts'; +import type { SchedulerJobRepository } from '../repositories/scheduler-job.repository.ts'; import type { TermsRepository } from '../repositories/terms.repository.ts'; import type { TermsContentRepository } from '../repositories/terms-content.repository.ts'; import type { UserRepository } from '../repositories/user.repository.ts'; @@ -46,6 +50,8 @@ export class MikroService { public readonly pendingOAuthRegistration: PendingOAuthRegistrationRepository; public readonly jwtKey: JwtKeyRepository; public readonly revokedToken: RevokedTokenRepository; + public readonly backgroundJob: BackgroundJobRepository; + public readonly schedulerJob: SchedulerJobRepository; public readonly userConsent: UserConsentRepository; public readonly userTermsConsent: UserTermsConsentRepository; public readonly userTotp: UserTotpRepository; @@ -70,6 +76,8 @@ export class MikroService { ); this.jwtKey = orm.em.getRepository(JwtKeyEntity); this.revokedToken = orm.em.getRepository(RevokedTokenEntitySchema); + this.backgroundJob = orm.em.getRepository(BackgroundJobEntitySchema); + this.schedulerJob = orm.em.getRepository(SchedulerJobEntitySchema); this.userConsent = orm.em.getRepository(UserConsentEntity); this.userTermsConsent = orm.em.getRepository(UserTermsConsentEntity); this.userTotp = orm.em.getRepository(UserTotpEntitySchema); diff --git a/packages/server/src/services/scheduler.service.ts b/packages/server/src/services/scheduler.service.ts index 6014bbf4..def978e1 100644 --- a/packages/server/src/services/scheduler.service.ts +++ b/packages/server/src/services/scheduler.service.ts @@ -1,7 +1,15 @@ -import type { SchedulerConfig, SchedulerHandle } from '../lib/config/index.ts'; +import type { + BackgroundJobConfig, + JobPayload, + ScheduledJobConfig, + SchedulerConfig, + SchedulerHandle, +} from '../lib/config/index.ts'; import type { Logger } from '../lib/logger.ts'; import type { CleanupService } from './cleanup.service.ts'; +const DEFAULT_CLEANUP_CRON = '0 2 * * *'; + export class SchedulerService { private readonly cleanupService: CleanupService; private readonly logger: Logger; @@ -31,16 +39,9 @@ export class SchedulerService { } const handle = await this.schedulerConfig.start({ - runCleanup: async () => { - try { - await this.cleanupService.runAll({ - dryRun: false, - verbose: false, - }); - } catch (err) { - this.logger.error({ err }, 'Scheduled cleanup failed'); - } - }, + scheduledJobs: this.createScheduledJobs(), + backgroundJobs: this.createBackgroundJobs(), + logger: this.logger, }); this.handle = handle; @@ -70,4 +71,51 @@ export class SchedulerService { public getNextRunAt(): Date | null { return this.handle?.getNextRunAt?.() ?? null; } + + public async enqueue( + jobId: string, + payload: TPayload, + options: { runAt?: Date | undefined } = {}, + ): Promise { + if (!this.handle) { + throw new Error('Scheduler is not running'); + } + if (!this.handle.enqueue) { + throw new Error('Scheduler backend does not support background jobs'); + } + + return this.handle.enqueue({ + jobId, + payload, + runAt: options.runAt, + }); + } + + private createScheduledJobs(): readonly ScheduledJobConfig[] { + return [ + { + id: 'cleanup.run-all', + name: 'Run cleanup tasks', + schedule: { + type: 'cron', + expression: this.schedulerConfig?.cleanupCron ?? DEFAULT_CLEANUP_CRON, + }, + handler: async () => { + try { + await this.cleanupService.runAll({ + dryRun: false, + verbose: false, + }); + } catch (err) { + this.logger.error({ err }, 'Scheduled cleanup failed'); + throw err; + } + }, + }, + ]; + } + + private createBackgroundJobs(): readonly BackgroundJobConfig[] { + return []; + } } diff --git a/packages/server/src/services/scheduler.test.ts b/packages/server/src/services/scheduler.test.ts index aff11ae1..a6cfe641 100644 --- a/packages/server/src/services/scheduler.test.ts +++ b/packages/server/src/services/scheduler.test.ts @@ -1,5 +1,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import type { SchedulerConfig } from '../lib/config/index.ts'; +import type { + BackgroundJobConfig, + ScheduledJobConfig, + SchedulerConfig, +} from '../lib/config/index.ts'; import { createTestApp } from '../test-utils/index.ts'; import { MINIMAL_TEST_CONFIG } from '../test-utils/setup.ts'; import type { CleanupSummary } from './cleanup.service.ts'; @@ -9,7 +13,8 @@ interface FakeSchedulerDriver { config: SchedulerConfig; start: ReturnType; stop: ReturnType; - triggerCleanup: () => Promise; + enqueue: ReturnType; + triggerJob: (id: string) => Promise; } function createCleanupSummary(): CleanupSummary { @@ -25,17 +30,36 @@ function createCleanupSummary(): CleanupSummary { function createFakeSchedulerDriver(options?: { nextRunAt?: Date | null; }): FakeSchedulerDriver { - let runCleanupCallback: (() => Promise) | undefined; + let scheduledJobs: readonly ScheduledJobConfig[] = []; + let backgroundJobs: readonly BackgroundJobConfig[] = []; const nextRunAt = options?.nextRunAt ?? null; const stop = vi.fn(() => {}); + const enqueue = vi.fn(async ({ jobId }: { jobId: string }) => { + const job = backgroundJobs.find( + (backgroundJob) => backgroundJob.id === jobId, + ); + if (!job) { + throw new Error(`Background job was not registered: ${jobId}`); + } + + return 'background-job-id'; + }); const start = vi.fn( - async ({ runCleanup }: { runCleanup: () => Promise }) => { - runCleanupCallback = runCleanup; + async ({ + scheduledJobs: startedScheduledJobs, + backgroundJobs: startedBackgroundJobs, + }: { + scheduledJobs: readonly ScheduledJobConfig[]; + backgroundJobs: readonly BackgroundJobConfig[]; + }) => { + scheduledJobs = startedScheduledJobs; + backgroundJobs = startedBackgroundJobs; return { stop, getNextRunAt: () => nextRunAt, + enqueue, }; }, ); @@ -46,12 +70,14 @@ function createFakeSchedulerDriver(options?: { }, start, stop, - async triggerCleanup() { - if (!runCleanupCallback) { - throw new Error('Scheduler was not started'); + enqueue, + async triggerJob(id: string) { + const job = scheduledJobs.find((scheduledJob) => scheduledJob.id === id); + if (!job) { + throw new Error(`Scheduler job was not registered: ${id}`); } - await runCleanupCallback(); + await job.handler({}); }, }; } @@ -105,7 +131,7 @@ describe('scheduler service', () => { .spyOn(services.cleanupService, 'runAll') .mockResolvedValue(createCleanupSummary()); - await driver.triggerCleanup(); + await driver.triggerJob('cleanup.run-all'); expect(runAllSpy).toHaveBeenCalledWith({ dryRun: false, @@ -113,12 +139,14 @@ describe('scheduler service', () => { }); }); - it('swallows cleanup failures and keeps the scheduler running', async () => { + it('propagates cleanup failures so adapters can record them', async () => { vi.spyOn(services.cleanupService, 'runAll').mockRejectedValue( new Error('cleanup failed'), ); - await expect(driver.triggerCleanup()).resolves.toBeUndefined(); + await expect(driver.triggerJob('cleanup.run-all')).rejects.toThrow( + 'cleanup failed', + ); expect(services.scheduler.isRunning()).toBe(true); }); @@ -130,5 +158,17 @@ describe('scheduler service', () => { cleanup = async () => {}; }); + + it('delegates background job enqueue to the scheduler handle', async () => { + await expect( + services.scheduler.enqueue('unknown.job', { value: 'test' }), + ).rejects.toThrow('Background job was not registered: unknown.job'); + + expect(driver.enqueue).toHaveBeenCalledWith({ + jobId: 'unknown.job', + payload: { value: 'test' }, + runAt: undefined, + }); + }); }); }); diff --git a/packages/standalone/config.example.yaml b/packages/standalone/config.example.yaml index 267f8028..2b320f3d 100644 --- a/packages/standalone/config.example.yaml +++ b/packages/standalone/config.example.yaml @@ -131,7 +131,19 @@ auth: scheduler: enabled: ${TINYAUTH_SCHEDULER_ENABLED:-true} - cron: ${TINYAUTH_SCHEDULER_CRON:-0 2 * * *} + mode: ${TINYAUTH_SCHEDULER_MODE:-croner} + cleanup_cron: ${TINYAUTH_SCHEDULER_CLEANUP_CRON:-0 2 * * *} + # Database scheduler mode only. Leave instance_id empty to generate a + # unique per-process id automatically; if set manually, it must be unique + # for every replica/process that runs the scheduler. + poll_interval_ms: ${TINYAUTH_SCHEDULER_POLL_INTERVAL_MS:-5000} + lock_ttl_ms: ${TINYAUTH_SCHEDULER_LOCK_TTL_MS:-60000} + background_retry_delay_ms: ${TINYAUTH_SCHEDULER_BACKGROUND_RETRY_DELAY_MS:-1000} + background_max_attempts: ${TINYAUTH_SCHEDULER_BACKGROUND_MAX_ATTEMPTS:-3} + # Retains terminal background jobs (succeeded/failed) for 7 days by default. + # Pending/running jobs are never deleted by this retention cleanup. + background_retention_ms: ${TINYAUTH_SCHEDULER_BACKGROUND_RETENTION_MS:-604800000} + instance_id: ${TINYAUTH_SCHEDULER_INSTANCE_ID:-} cleanup: revoked_tokens: diff --git a/packages/standalone/e2e/config-loading.e2e.test.ts b/packages/standalone/e2e/config-loading.e2e.test.ts index 3508dff3..09927857 100644 --- a/packages/standalone/e2e/config-loading.e2e.test.ts +++ b/packages/standalone/e2e/config-loading.e2e.test.ts @@ -71,7 +71,7 @@ describe('config combinations', { timeout: 30_000 }, () => { it('starts with scheduler enabled', async () => { const { configPath, port, cleanup } = await createTestConfigFile({ - scheduler: { enabled: true, cron: '0 3 * * *' }, + scheduler: { enabled: true, cleanup_cron: '0 3 * * *' }, }); configCleanup = cleanup; diff --git a/packages/standalone/package.json b/packages/standalone/package.json index 9f91dcfa..76721c9a 100644 --- a/packages/standalone/package.json +++ b/packages/standalone/package.json @@ -63,6 +63,7 @@ "@mikro-orm/cli": "catalog:", "@stricli/core": "catalog:", "@tinyrack/tinyauth-server": "workspace:*", + "croner": "catalog:", "dotenv": "catalog:", "hono": "catalog:", "hono-openapi": "catalog:", diff --git a/packages/standalone/src/lib/config/defaults.ts b/packages/standalone/src/lib/config/defaults.ts index b280f2e2..400bccdc 100644 --- a/packages/standalone/src/lib/config/defaults.ts +++ b/packages/standalone/src/lib/config/defaults.ts @@ -99,7 +99,23 @@ export const STANDALONE_CONFIG_DEFAULTS = { scheduler: { enabled: envDefault('TINYAUTH_SCHEDULER_ENABLED', 'true'), - cron: envDefault('TINYAUTH_SCHEDULER_CRON', '0 2 * * *'), + mode: envDefault('TINYAUTH_SCHEDULER_MODE', 'croner'), + cleanup_cron: envDefault('TINYAUTH_SCHEDULER_CLEANUP_CRON', '0 2 * * *'), + poll_interval_ms: envDefault('TINYAUTH_SCHEDULER_POLL_INTERVAL_MS', '5000'), + lock_ttl_ms: envDefault('TINYAUTH_SCHEDULER_LOCK_TTL_MS', '60000'), + background_retry_delay_ms: envDefault( + 'TINYAUTH_SCHEDULER_BACKGROUND_RETRY_DELAY_MS', + '1000', + ), + background_max_attempts: envDefault( + 'TINYAUTH_SCHEDULER_BACKGROUND_MAX_ATTEMPTS', + '3', + ), + background_retention_ms: envDefault( + 'TINYAUTH_SCHEDULER_BACKGROUND_RETENTION_MS', + String(7 * 24 * 60 * 60 * 1000), + ), + instance_id: envDefault('TINYAUTH_SCHEDULER_INSTANCE_ID', ''), }, cleanup: { diff --git a/packages/standalone/src/lib/config/loader.test.ts b/packages/standalone/src/lib/config/loader.test.ts index f9109d3b..1a26ccce 100644 --- a/packages/standalone/src/lib/config/loader.test.ts +++ b/packages/standalone/src/lib/config/loader.test.ts @@ -110,9 +110,23 @@ describe('resolveConfig', () => { if (!resolved.scheduler) { throw new Error('Expected scheduler to be defined'); } + if (typeof resolved.scheduler === 'function') { + throw new Error('Expected direct scheduler adapter'); + } const handle = await resolved.scheduler.start({ - runCleanup: async () => {}, + scheduledJobs: [ + { + id: 'cleanup.run-all', + name: 'Run cleanup tasks', + schedule: { + type: 'cron', + expression: resolved.scheduler.cleanupCron ?? '', + }, + handler: async () => {}, + }, + ], + backgroundJobs: [], }); expect(handle.getNextRunAt?.()).toBeInstanceOf(Date); @@ -130,6 +144,52 @@ describe('resolveConfig', () => { expect(resolved.scheduler).toBeUndefined(); }); + test('composes a database scheduler adapter from standalone config', async () => { + const resolved = await resolveConfig({ + ...MINIMAL_CONFIG, + scheduler: { + enabled: true, + mode: 'database', + cleanup_cron: '* * * * *', + poll_interval_ms: '25', + lock_ttl_ms: '1000', + instance_id: 'standalone-test', + }, + }); + + expect(resolved.scheduler).toBeDefined(); + if (!resolved.scheduler) { + throw new Error('Expected scheduler to be defined'); + } + + expect(typeof resolved.scheduler).toBe('function'); + }); + + test('rejects invalid standalone scheduler cron expressions', async () => { + await expect( + resolveConfig({ + ...MINIMAL_CONFIG, + scheduler: { + enabled: true, + cleanup_cron: 'not a cron', + }, + }), + ).rejects.toThrow('Invalid cron expression'); + }); + + test('rejects invalid standalone scheduler background retention', async () => { + await expect( + resolveConfig({ + ...MINIMAL_CONFIG, + scheduler: { + enabled: true, + mode: 'database', + background_retention_ms: '0', + }, + }), + ).rejects.toThrow('background_retention_ms'); + }); + test('rejects password policy where max_length is less than min_length', async () => { await expect( resolveConfig({ diff --git a/packages/standalone/src/lib/config/scheduler.ts b/packages/standalone/src/lib/config/scheduler.ts index 2262b8d1..2994eb51 100644 --- a/packages/standalone/src/lib/config/scheduler.ts +++ b/packages/standalone/src/lib/config/scheduler.ts @@ -1,30 +1,112 @@ +import { Cron } from 'croner'; import z from 'zod'; import { StandaloneBooleanSchema } from './coerce.ts'; +const PositiveIntegerSchema = z + .union([z.string(), z.number()]) + .transform((value) => { + if (typeof value === 'string') { + return Number(value); + } + + return value; + }) + .pipe(z.number().int().positive()); + +const PositiveNumberSchema = z + .union([z.string(), z.number()]) + .transform((value) => { + if (typeof value === 'string') { + return Number(value); + } + + return value; + }) + .pipe(z.number().finite().positive()); + +function isValidCronExpression(expression: string): boolean { + let job: Cron | undefined; + try { + job = new Cron(expression, { paused: true }); + return job.nextRun(new Date()) !== null; + } catch { + return false; + } finally { + job?.stop(); + } +} + const CronExpressionSchema = z .string() .min(9) + .refine(isValidCronExpression, 'Invalid cron expression') .describe('Cron expression in 5-field format.'); -export const STANDALONE_SCHEDULER_CONFIG_DEFAULT = { - enabled: true, - cron: '0 2 * * *', -}; +interface StandaloneSchedulerConfigDefault { + enabled: boolean; + mode: 'croner' | 'database'; + cleanup_cron: string; + poll_interval_ms: number; + lock_ttl_ms: number; + background_retry_delay_ms: number; + background_max_attempts: number; + background_retention_ms: number; +} + +export const STANDALONE_SCHEDULER_CONFIG_DEFAULT: StandaloneSchedulerConfigDefault = + { + enabled: true, + mode: 'croner', + cleanup_cron: '0 2 * * *', + poll_interval_ms: 5000, + lock_ttl_ms: 60000, + background_retry_delay_ms: 1000, + background_max_attempts: 3, + background_retention_ms: 7 * 24 * 60 * 60 * 1000, + }; export const StandaloneSchedulerConfigSchema = z .object({ enabled: StandaloneBooleanSchema.default( STANDALONE_SCHEDULER_CONFIG_DEFAULT.enabled, ).describe( - 'Enable in-process cleanup scheduler. Disable when using external schedulers.', + 'Enable internal application job scheduler. Disable when using external schedulers.', + ), + mode: z + .enum(['croner', 'database']) + .default(STANDALONE_SCHEDULER_CONFIG_DEFAULT.mode) + .describe('Scheduler mode: croner for single-node, database for HA.'), + cleanup_cron: CronExpressionSchema.default( + STANDALONE_SCHEDULER_CONFIG_DEFAULT.cleanup_cron, + ).describe('Cron schedule for the built-in cleanup job.'), + poll_interval_ms: PositiveIntegerSchema.default( + STANDALONE_SCHEDULER_CONFIG_DEFAULT.poll_interval_ms, + ).describe('Database scheduler polling interval in milliseconds.'), + lock_ttl_ms: PositiveIntegerSchema.default( + STANDALONE_SCHEDULER_CONFIG_DEFAULT.lock_ttl_ms, + ).describe('Database scheduler lease duration in milliseconds.'), + background_retry_delay_ms: PositiveNumberSchema.default( + STANDALONE_SCHEDULER_CONFIG_DEFAULT.background_retry_delay_ms, + ).describe( + 'Database scheduler background job retry delay in milliseconds.', + ), + background_max_attempts: PositiveIntegerSchema.default( + STANDALONE_SCHEDULER_CONFIG_DEFAULT.background_max_attempts, + ).describe('Database scheduler background job maximum attempts.'), + background_retention_ms: PositiveNumberSchema.default( + STANDALONE_SCHEDULER_CONFIG_DEFAULT.background_retention_ms, + ).describe( + 'Database scheduler completed background job retention in milliseconds.', ), - cron: CronExpressionSchema.default( - STANDALONE_SCHEDULER_CONFIG_DEFAULT.cron, - ).describe('Cron schedule for running all cleanup tasks.'), + instance_id: z + .string() + .transform((value) => (value === '' ? undefined : value)) + .optional() + .describe('Optional stable database scheduler instance id.'), }) .strict() .default(STANDALONE_SCHEDULER_CONFIG_DEFAULT) - .describe('Standalone in-process cleanup scheduler configuration.'); + .describe('Standalone internal application job scheduler configuration.'); export type StandaloneSchedulerConfig = z.infer< typeof StandaloneSchedulerConfigSchema diff --git a/packages/standalone/src/lib/load-config.test.ts b/packages/standalone/src/lib/load-config.test.ts index 71e6ef2f..95dd1bbd 100644 --- a/packages/standalone/src/lib/load-config.test.ts +++ b/packages/standalone/src/lib/load-config.test.ts @@ -125,6 +125,102 @@ describe('load-config', () => { expect(config.terms[0]?.content['en']?.type).toBe('text'); }); + test('loads database scheduler background options from env-style strings', async () => { + const dir = await fs.promises.mkdtemp( + path.join(os.tmpdir(), 'tinyauth-load-config-scheduler-retry-'), + ); + const configFile = await writeConfigFile( + dir, + 'scheduler-retry.yaml', + [ + 'scheduler:', + ' enabled: true', + ' mode: database', + ' background_retry_delay_ms: "2500"', + ' background_max_attempts: "5"', + ' background_retention_ms: "3600000"', + 'security:', + ' session_secret: scheduler-retry-secret-1234567890', + ' hash_secret: MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY', + ].join('\n'), + ); + + try { + const config = loadConfig(configFile); + await expect(resolveConfig(config)).resolves.toMatchObject({ + scheduler: expect.any(Function), + }); + + expect(config.scheduler.background_retry_delay_ms).toBe(2500); + expect(config.scheduler.background_max_attempts).toBe(5); + expect(config.scheduler.background_retention_ms).toBe(3600000); + } finally { + await fs.promises.rm(dir, { recursive: true, force: true }); + } + }); + + test('loads database scheduler retention from env vars', () => { + const missingPath = path.join( + os.tmpdir(), + `tinyauth-retention-env-${Date.now()}.yaml`, + ); + const originalSession = process.env['TINYAUTH_SESSION_SECRET']; + const originalHash = process.env['TINYAUTH_HASH_SECRET']; + const originalRetention = + process.env['TINYAUTH_SCHEDULER_BACKGROUND_RETENTION_MS']; + try { + process.env['TINYAUTH_SESSION_SECRET'] = + 'env-session-secret-1234567890abcdef'; + process.env['TINYAUTH_HASH_SECRET'] = + 'MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY'; + process.env['TINYAUTH_SCHEDULER_BACKGROUND_RETENTION_MS'] = '60000'; + + const config = loadConfig(missingPath); + + expect(config.scheduler.background_retention_ms).toBe(60000); + } finally { + if (originalSession === undefined) + delete process.env['TINYAUTH_SESSION_SECRET']; + else process.env['TINYAUTH_SESSION_SECRET'] = originalSession; + if (originalHash === undefined) + delete process.env['TINYAUTH_HASH_SECRET']; + else process.env['TINYAUTH_HASH_SECRET'] = originalHash; + if (originalRetention === undefined) + delete process.env['TINYAUTH_SCHEDULER_BACKGROUND_RETENTION_MS']; + else + process.env['TINYAUTH_SCHEDULER_BACKGROUND_RETENTION_MS'] = + originalRetention; + } + }); + + test('uses database scheduler background defaults matching server scheduler', () => { + const originalSession = process.env['TINYAUTH_SESSION_SECRET']; + const originalHash = process.env['TINYAUTH_HASH_SECRET']; + try { + process.env['TINYAUTH_SESSION_SECRET'] = + 'env-session-secret-1234567890abcdef'; + process.env['TINYAUTH_HASH_SECRET'] = + 'MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY'; + + const config = loadConfig( + path.join(os.tmpdir(), `tinyauth-defaults-${Date.now()}.yaml`), + ); + + expect(config.scheduler.background_retry_delay_ms).toBe(1000); + expect(config.scheduler.background_max_attempts).toBe(3); + expect(config.scheduler.background_retention_ms).toBe( + 7 * 24 * 60 * 60 * 1000, + ); + } finally { + if (originalSession === undefined) + delete process.env['TINYAUTH_SESSION_SECRET']; + else process.env['TINYAUTH_SESSION_SECRET'] = originalSession; + if (originalHash === undefined) + delete process.env['TINYAUTH_HASH_SECRET']; + else process.env['TINYAUTH_HASH_SECRET'] = originalHash; + } + }); + test('throws when session_secret is missing from YAML', async () => { const dir = await fs.promises.mkdtemp( path.join(os.tmpdir(), 'tinyauth-load-config-missing-security-'), diff --git a/packages/standalone/src/lib/load-config.ts b/packages/standalone/src/lib/load-config.ts index fa0c3c0b..3ad4f1de 100644 --- a/packages/standalone/src/lib/load-config.ts +++ b/packages/standalone/src/lib/load-config.ts @@ -9,6 +9,7 @@ import { genericOAuth } from '@tinyrack/tinyauth-server/identity-providers/gener import { github } from '@tinyrack/tinyauth-server/identity-providers/github'; import { google } from '@tinyrack/tinyauth-server/identity-providers/google'; import { croner } from '@tinyrack/tinyauth-server/scheduler/croner'; +import { database as databaseScheduler } from '@tinyrack/tinyauth-server/scheduler/database'; import YAML from 'yaml'; import type { StandaloneDatabaseConfig } from './config/database.ts'; import { STANDALONE_CONFIG_DEFAULTS } from './config/defaults.ts'; @@ -115,9 +116,22 @@ function composeSchedulerConfig( return undefined; } - return croner({ - cron: scheduler.cron, - }); + switch (scheduler.mode) { + case 'croner': + return croner({ + cleanupCron: scheduler.cleanup_cron, + }); + case 'database': + return databaseScheduler({ + cleanupCron: scheduler.cleanup_cron, + pollIntervalMs: scheduler.poll_interval_ms, + lockTtlMs: scheduler.lock_ttl_ms, + backgroundRetryDelayMs: scheduler.background_retry_delay_ms, + backgroundMaxAttempts: scheduler.background_max_attempts, + backgroundRetentionMs: scheduler.background_retention_ms, + instanceId: scheduler.instance_id, + }); + } } function composeFrontendConfig( diff --git a/packages/standalone/vitest.config.ts b/packages/standalone/vitest.config.ts index ba467db6..f0d22492 100644 --- a/packages/standalone/vitest.config.ts +++ b/packages/standalone/vitest.config.ts @@ -99,6 +99,15 @@ export default defineConfig({ ), ), }, + { + find: /^@tinyrack\/tinyauth-server\/scheduler\/database$/, + replacement: fileURLToPath( + new URL( + '../server/src/entrypoints/scheduler/database.ts', + import.meta.url, + ), + ), + }, { find: /^@tinyrack\/tinyauth-server\/frontend$/, replacement: fileURLToPath( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c17382d0..02f7c31f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -653,6 +653,9 @@ importers: '@tinyrack/tinyauth-server': specifier: workspace:* version: link:../server + croner: + specifier: 'catalog:' + version: 10.0.1 dotenv: specifier: 'catalog:' version: 17.4.2