@mrxsys/mrx-core 2.7.0 → 2.9.0-1-and-259-20250918
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-00s6t4tw.js +26 -0
- package/dist/chunk-0601exyg.js +7 -0
- package/dist/chunk-4mvsje21.js +7 -0
- package/dist/chunk-547mr88s.js +10 -0
- package/dist/chunk-5pwb7peq.js +9 -0
- package/dist/{chunk-z6q192p8.js → chunk-6g29g0tk.js} +17 -26
- package/dist/chunk-6tqh339a.js +9 -0
- package/dist/{chunk-qb6x364m.js → chunk-75hgws2d.js} +18 -39
- package/dist/chunk-8y9b2m5a.js +53 -0
- package/dist/chunk-9cgzhc50.js +15 -0
- package/dist/chunk-9dzsj7f2.js +23 -0
- package/dist/chunk-b23dvm2d.js +29 -0
- package/dist/chunk-b6f6ez2w.js +8 -0
- package/dist/{chunk-zaje5tv4.js → chunk-c9vjf06h.js} +31 -30
- package/dist/chunk-d0p9787v.js +272 -0
- package/dist/{chunk-5qtpggzv.js → chunk-grfyngq0.js} +3 -2
- package/dist/{chunk-4n72ks5x.js → chunk-h4dyeeqg.js} +4 -5
- package/dist/{chunk-9nw6qekv.js → chunk-h9t48r9q.js} +2 -1
- package/dist/chunk-k9dtqf1p.js +101 -0
- package/dist/{chunk-26brdrbz.js → chunk-kje1qysg.js} +59 -46
- package/dist/{chunk-4mt568fz.js → chunk-m3grz32t.js} +4 -3
- package/dist/{chunk-yvyahr2h.js → chunk-mvrxngm7.js} +2 -1
- package/dist/{chunk-j28jpfv2.js → chunk-n6d9ncnv.js} +2 -1
- package/dist/chunk-ngrxhdkb.js +32 -0
- package/dist/{chunk-79mw7w0g.js → chunk-nvt16s80.js} +2 -1
- package/dist/{chunk-yd82hdxv.js → chunk-w1547qd4.js} +2 -1
- package/dist/chunk-yagxbm1r.js +9 -0
- package/dist/{chunk-snqdnkk7.js → chunk-z9a175mk.js} +4 -3
- package/dist/chunk-zwrygafm.js +61 -0
- package/dist/errors/base-error.d.ts +5 -0
- package/dist/errors/enums/index.d.ts +1 -1
- package/dist/errors/enums/index.js +1 -1
- package/dist/errors/http-error.d.ts +11 -0
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.js +3 -3
- package/dist/errors/utils/index.d.ts +1 -0
- package/dist/errors/utils/index.js +16 -0
- package/dist/errors/utils/is-nowarajs-error.ts.d.ts +4 -0
- package/dist/modules/data/data.d.ts +3 -3
- package/dist/modules/data/enums/index.d.ts +1 -1
- package/dist/modules/data/enums/index.js +1 -1
- package/dist/modules/data/index.js +3 -3
- package/dist/modules/data/transformers/{camelCase.d.ts → camel-case.d.ts} +2 -2
- package/dist/modules/data/transformers/index.d.ts +4 -4
- package/dist/modules/data/transformers/index.js +4 -4
- package/dist/modules/data/transformers/{kebabCase.d.ts → kebab-case.d.ts} +2 -2
- package/dist/modules/data/transformers/{pascalCase.d.ts → pascal-case.d.ts} +2 -2
- package/dist/modules/data/transformers/{snakeCase.d.ts → snake-case.d.ts} +2 -2
- package/dist/modules/data/types/index.d.ts +10 -10
- package/dist/modules/data/types/{pascalCase.d.ts → pascal-case.d.ts} +1 -1
- package/dist/modules/data/types/{transformKeysCamelCase.d.ts → transform-keys-camel-case.d.ts} +1 -1
- package/dist/modules/data/types/{transformKeysKebabCase.d.ts → transform-keys-kebab-case.d.ts} +1 -1
- package/dist/modules/data/types/{transformKeysPascalCase.d.ts → transform-keys-pascal-case.d.ts} +1 -1
- package/dist/modules/data/types/{transformKeysSnakeCase.d.ts → transform-keys-snake-case.d.ts} +1 -1
- package/dist/modules/data/types/{transformObjectKeys.d.ts → transform-object-keys.d.ts} +8 -8
- package/dist/modules/database/enums/index.d.ts +2 -2
- package/dist/modules/database/enums/index.js +1 -1
- package/dist/modules/database/events/index.d.ts +2 -2
- package/dist/modules/database/events/{mssqlEventMap.d.ts → mssql-event-map.d.ts} +1 -1
- package/dist/modules/database/events/{tableEventMap.d.ts → table-event-map.d.ts} +1 -1
- package/dist/modules/database/index.js +8 -8
- package/dist/modules/database/mssql.d.ts +3 -3
- package/dist/modules/database/table.d.ts +2 -2
- package/dist/modules/database/types/index.d.ts +3 -3
- package/dist/modules/elysia/cache/cache.d.ts +189 -0
- package/dist/modules/elysia/cache/index.d.ts +1 -0
- package/dist/modules/elysia/cache/index.js +70 -0
- package/dist/modules/elysia/cache/types/cache-item.d.ts +7 -0
- package/dist/modules/elysia/cache/types/cache-options.d.ts +21 -0
- package/dist/modules/elysia/cache/types/index.d.ts +1 -0
- package/dist/modules/elysia/cache/utils/generate-cache-key.d.ts +5 -0
- package/dist/modules/elysia/cache/utils/index.d.ts +1 -0
- package/dist/modules/elysia/cache/utils/index.js +7 -0
- package/dist/modules/elysia/{crudSchema/crudSchema.d.ts → crud/crud-schema.d.ts} +4 -4
- package/dist/modules/elysia/crud/crud.d.ts +34 -42
- package/dist/modules/elysia/crud/index.d.ts +1 -0
- package/dist/modules/elysia/crud/index.js +128 -280
- package/dist/modules/elysia/crud/operations/count.d.ts +258 -0
- package/dist/modules/elysia/crud/operations/delete.d.ts +258 -0
- package/dist/modules/elysia/crud/operations/deleteOne.d.ts +258 -0
- package/dist/modules/elysia/crud/operations/find.d.ts +258 -0
- package/dist/modules/elysia/crud/operations/findOne.d.ts +258 -0
- package/dist/modules/elysia/crud/operations/index.d.ts +8 -0
- package/dist/modules/elysia/crud/operations/index.js +33 -0
- package/dist/modules/elysia/crud/operations/insert.d.ts +258 -0
- package/dist/modules/elysia/crud/operations/update.d.ts +268 -0
- package/dist/modules/elysia/crud/operations/updateOne.d.ts +268 -0
- package/dist/modules/elysia/{crudSchema/types/adaptiveWhereClauseSchema.d.ts → crud/types/adaptive-where-clause-schema.d.ts} +1 -1
- package/dist/modules/elysia/crud/types/count-response-200-schema.d.ts +5 -0
- package/dist/modules/elysia/crud/types/count-schema.d.ts +10 -0
- package/dist/modules/elysia/crud/types/crud-operation-base.d.ts +4 -0
- package/dist/modules/elysia/crud/types/crud-operation-count.d.ts +14 -0
- package/dist/modules/elysia/crud/types/crud-operation-delete-one.d.ts +14 -0
- package/dist/modules/elysia/crud/types/crud-operation-delete.d.ts +14 -0
- package/dist/modules/elysia/crud/types/crud-operation-find-one.d.ts +14 -0
- package/dist/modules/elysia/crud/types/crud-operation-find.d.ts +14 -0
- package/dist/modules/elysia/crud/types/crud-operation-insert.d.ts +14 -0
- package/dist/modules/elysia/crud/types/crud-operation-update-one.d.ts +16 -0
- package/dist/modules/elysia/crud/types/crud-operation-update.d.ts +14 -0
- package/dist/modules/elysia/crud/types/crud-operations.d.ts +19 -0
- package/dist/modules/elysia/crud/types/crud-options.d.ts +44 -0
- package/dist/modules/elysia/crud/types/crud-schema-models-type.d.ts +12 -0
- package/dist/modules/elysia/{crudSchema/types/crudSchemaOptions.d.ts → crud/types/crud-schema-options.d.ts} +1 -1
- package/dist/modules/elysia/crud/types/delete-schema.d.ts +12 -0
- package/dist/modules/elysia/crud/types/filter-schema.d.ts +9 -0
- package/dist/modules/elysia/crud/types/find-schema.d.ts +16 -0
- package/dist/modules/elysia/{crudSchema/utils/createIdParamSchema.d.ts → crud/types/id-param-schema.d.ts} +1 -1
- package/dist/modules/elysia/crud/types/index.d.ts +29 -11
- package/dist/modules/elysia/crud/types/insert-schema.d.ts +11 -0
- package/dist/modules/elysia/{crudSchema/types/orderSchema.d.ts → crud/types/order-schema.d.ts} +1 -1
- package/dist/modules/elysia/crud/types/properties-schema.d.ts +9 -0
- package/dist/modules/elysia/{crudSchema/types/qSchema.d.ts → crud/types/q-schema.d.ts} +1 -1
- package/dist/modules/elysia/crud/types/response-200-schema.d.ts +11 -0
- package/dist/modules/elysia/{crudSchema/types/selectedFieldSchema.d.ts → crud/types/selected-field-schema.d.ts} +1 -1
- package/dist/modules/elysia/crud/types/update-one-schema.d.ts +4 -0
- package/dist/modules/elysia/crud/types/update-schema.d.ts +13 -0
- package/dist/modules/elysia/{crudSchema/utils/createAdaptiveWhereClauseSchema.d.ts → crud/utils/create-adaptive-where-clause-schema.d.ts} +2 -2
- package/dist/modules/elysia/crud/utils/create-count-response-200-schema.d.ts +8 -0
- package/dist/modules/elysia/crud/utils/create-count-schema.d.ts +12 -0
- package/dist/modules/elysia/crud/utils/create-delete-schema.d.ts +12 -0
- package/dist/modules/elysia/{crudSchema/utils/createFiltersSchema.d.ts → crud/utils/create-filters-schema.d.ts} +3 -6
- package/dist/modules/elysia/crud/utils/create-find-schema.d.ts +12 -0
- package/dist/modules/elysia/crud/utils/create-id-param-schema.d.ts +2 -0
- package/dist/modules/elysia/crud/utils/create-insert-schema.d.ts +8 -0
- package/dist/modules/elysia/{crudSchema/utils/createOrderSchema.d.ts → crud/utils/create-order-schema.d.ts} +2 -2
- package/dist/modules/elysia/crud/utils/create-properties-schema.d.ts +12 -0
- package/dist/modules/elysia/{crudSchema/utils/createQSchema.d.ts → crud/utils/create-q-schema.d.ts} +2 -2
- package/dist/modules/elysia/crud/utils/create-response-200-schema.d.ts +3 -0
- package/dist/modules/elysia/{crudSchema/utils/createSelectedFieldsSchema.d.ts → crud/utils/create-selected-fields-schema.d.ts} +2 -2
- package/dist/modules/elysia/crud/utils/create-update-one-schema.d.ts +3 -0
- package/dist/modules/elysia/crud/utils/create-update-schema.d.ts +3 -0
- package/dist/modules/elysia/crud/utils/index.d.ts +16 -0
- package/dist/modules/elysia/{crudSchema → crud}/utils/index.js +7 -4
- package/dist/modules/elysia/{crudSchema/utils/isDateFromElysiaTypeBox.d.ts → crud/utils/is-date-from-elysia-typebox.d.ts} +1 -1
- package/dist/modules/elysia/db-resolver/db-resolver.d.ts +193 -0
- package/dist/modules/elysia/db-resolver/enums/db-resolver-error-keys.d.ts +3 -0
- package/dist/modules/elysia/db-resolver/enums/index.d.ts +1 -0
- package/dist/modules/elysia/{dbResolver → db-resolver}/enums/index.js +1 -1
- package/dist/modules/elysia/db-resolver/index.d.ts +1 -0
- package/dist/modules/elysia/db-resolver/index.js +18 -0
- package/dist/modules/elysia/error/error.d.ts +14 -3
- package/dist/modules/elysia/error/index.js +14 -5
- package/dist/modules/elysia/microservice/microservice.d.ts +17 -14
- package/dist/modules/elysia/rate-limit/enums/index.d.ts +1 -0
- package/dist/modules/elysia/{rateLimit → rate-limit}/enums/index.js +1 -1
- package/dist/modules/elysia/rate-limit/index.d.ts +1 -0
- package/dist/modules/elysia/rate-limit/index.js +55 -0
- package/dist/modules/elysia/{rateLimit/rateLimit.d.ts → rate-limit/rate-limit.d.ts} +33 -13
- package/dist/modules/elysia/rate-limit/types/index.d.ts +1 -0
- package/dist/modules/elysia/{rateLimit/types/rateLimitOptions.d.ts → rate-limit/types/rate-limit-options.d.ts} +3 -15
- package/dist/modules/jwt/enums/index.d.ts +2 -0
- package/dist/modules/jwt/enums/index.js +11 -0
- package/dist/modules/jwt/enums/jwt-error-keys.d.ts +5 -0
- package/dist/modules/jwt/enums/parse-human-time-to-seconds-error-keys.d.ts +3 -0
- package/dist/modules/jwt/index.d.ts +1 -0
- package/dist/modules/jwt/index.js +51 -0
- package/dist/modules/jwt/jwt.d.ts +3 -0
- package/dist/modules/jwt/utils/index.d.ts +1 -0
- package/dist/modules/jwt/utils/index.js +9 -0
- package/dist/modules/jwt/utils/parse-human-time-to-seconds.d.ts +17 -0
- package/dist/modules/kv-store/enums/index.d.ts +1 -0
- package/dist/modules/kv-store/enums/index.js +7 -0
- package/dist/modules/kv-store/enums/kv-store-error-keys.d.ts +5 -0
- package/dist/modules/kv-store/ioredis/index.d.ts +1 -0
- package/dist/modules/kv-store/ioredis/index.js +92 -0
- package/dist/modules/kv-store/ioredis/ioredis-store.d.ts +107 -0
- package/dist/modules/kv-store/memory/index.d.ts +1 -0
- package/dist/modules/kv-store/memory/index.js +9 -0
- package/dist/modules/kv-store/memory/memory-store.d.ts +119 -0
- package/dist/modules/{elysia/rateLimit/types/memoryStoreEntry.d.ts → kv-store/memory/types/memory-store-entry.d.ts} +2 -2
- package/dist/modules/kv-store/types/index.d.ts +1 -0
- package/dist/modules/kv-store/types/kv-store.d.ts +81 -0
- package/dist/modules/logger/enums/index.d.ts +1 -1
- package/dist/modules/logger/enums/index.js +1 -1
- package/dist/modules/logger/enums/logger-error-keys.d.ts +6 -0
- package/dist/modules/logger/events/index.d.ts +1 -1
- package/dist/modules/logger/events/logger-events.d.ts +11 -0
- package/dist/modules/logger/index.js +40 -52
- package/dist/modules/logger/logger.d.ts +172 -172
- package/dist/modules/logger/sinks/console-logger.d.ts +22 -0
- package/dist/modules/logger/sinks/file-logger.d.ts +25 -0
- package/dist/modules/logger/sinks/index.d.ts +2 -0
- package/dist/modules/logger/{strategies → sinks}/index.js +6 -6
- package/dist/modules/logger/types/bodies-intersection.d.ts +2 -0
- package/dist/modules/logger/types/index.d.ts +6 -6
- package/dist/modules/logger/types/log-stream-chunk.d.ts +15 -0
- package/dist/modules/logger/types/{loggerStrategy.d.ts → logger-sink.d.ts} +3 -3
- package/dist/modules/logger/types/sink-body.d.ts +2 -0
- package/dist/modules/logger/types/sink-map.d.ts +2 -0
- package/dist/modules/mailer/enums/index.d.ts +1 -1
- package/dist/modules/mailer/enums/index.js +1 -1
- package/dist/modules/mailer/index.js +5 -8
- package/dist/modules/mailer/smtp.d.ts +1 -1
- package/dist/modules/mailer/types/index.d.ts +3 -3
- package/dist/modules/mailer/types/{smtpOptions.d.ts → smtp-options.d.ts} +2 -2
- package/dist/modules/repository/index.js +6 -6
- package/dist/modules/repository/repository.d.ts +5 -5
- package/dist/modules/repository/types/filter.d.ts +2 -2
- package/dist/modules/repository/types/index.d.ts +6 -6
- package/dist/modules/repository/types/{queryOptionsExtendPagination.d.ts → query-options-extend-pagination.d.ts} +1 -1
- package/dist/modules/repository/types/{queryOptionsExtendStream.d.ts → query-options-extend-stream.d.ts} +1 -1
- package/dist/modules/repository/types/{queryOptions.d.ts → query-options.d.ts} +7 -3
- package/dist/modules/singleton-manager/enums/index.d.ts +1 -0
- package/dist/modules/{singletonManager → singleton-manager}/enums/index.js +1 -1
- package/dist/modules/singleton-manager/enums/singleton-manager-error-keys.d.ts +4 -0
- package/dist/modules/singleton-manager/index.d.ts +1 -0
- package/dist/modules/singleton-manager/index.js +9 -0
- package/dist/modules/{singletonManager/singletonManager.d.ts → singleton-manager/singleton-manager.d.ts} +9 -11
- package/dist/modules/totp/enums/index.d.ts +1 -1
- package/dist/modules/totp/enums/index.js +1 -1
- package/dist/modules/totp/hotp.d.ts +11 -0
- package/dist/modules/totp/index.d.ts +3 -1
- package/dist/modules/totp/index.js +33 -42
- package/dist/modules/totp/otp-auth-uri.d.ts +21 -0
- package/dist/modules/totp/totp.d.ts +2 -42
- package/dist/modules/totp/types/index.d.ts +3 -3
- package/dist/modules/totp/types/{verifyOptions.d.ts → verify-options.d.ts} +1 -1
- package/dist/modules/totp/utils/base32.d.ts +1 -1
- package/dist/modules/totp/utils/index.d.ts +5 -4
- package/dist/modules/totp/utils/index.js +12 -11
- package/dist/modules/totp/utils/time-remaining.d.ts +9 -0
- package/dist/modules/typed-event-emitter/index.d.ts +1 -0
- package/dist/modules/{typedEventEmitter → typed-event-emitter}/index.js +1 -1
- package/dist/modules/typed-event-emitter/typed-event-emitter.d.ts +221 -0
- package/dist/modules/typed-event-emitter/types/index.d.ts +1 -0
- package/dist/shared/enums/index.d.ts +1 -0
- package/dist/{utils → shared}/enums/index.js +1 -1
- package/dist/shared/types/index.d.ts +3 -0
- package/dist/shared/types/tflatten.d.ts +5 -0
- package/dist/shared/utils/flatten.d.ts +3 -0
- package/dist/{utils → shared/utils}/index.d.ts +2 -1
- package/dist/{utils → shared/utils}/index.js +10 -9
- package/package.json +96 -90
- package/CHANGELOG.md +0 -79
- package/dist/chunk-45gt9273.js +0 -8
- package/dist/chunk-4xs0e8cm.js +0 -9
- package/dist/chunk-683sda6e.js +0 -28
- package/dist/chunk-7jsxw1ts.js +0 -40
- package/dist/chunk-cqw9xq4y.js +0 -7
- package/dist/chunk-dwfyt1m6.js +0 -6
- package/dist/chunk-g821m8gq.js +0 -77
- package/dist/chunk-hcc6g1fd.js +0 -7
- package/dist/chunk-tm71j126.js +0 -54
- package/dist/chunk-vknq69e0.js +0 -23
- package/dist/errors/baseError.d.ts +0 -9
- package/dist/errors/httpError.d.ts +0 -14
- package/dist/errors/types/baseErrorOptions.d.ts +0 -15
- package/dist/errors/types/httpErrorOptions.d.ts +0 -13
- package/dist/errors/types/index.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationBaseOptions.d.ts +0 -6
- package/dist/modules/elysia/crud/types/crudOperationCountOptions.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationDeleteOneOptions.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationDeleteOptions.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationFindOneOptions.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationFindOptions.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationInsertOptions.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationUpdateOneOptions.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationUpdateOptions.d.ts +0 -2
- package/dist/modules/elysia/crud/types/crudOperationsOptions.d.ts +0 -18
- package/dist/modules/elysia/crud/types/crudOptions.d.ts +0 -23
- package/dist/modules/elysia/crudSchema/index.d.ts +0 -1
- package/dist/modules/elysia/crudSchema/index.js +0 -11
- package/dist/modules/elysia/crudSchema/types/crudModelsType.d.ts +0 -14
- package/dist/modules/elysia/crudSchema/types/index.d.ts +0 -8
- package/dist/modules/elysia/crudSchema/types/queryOptionsBuilderOptions.d.ts +0 -11
- package/dist/modules/elysia/crudSchema/utils/createCountResponse200Schema.d.ts +0 -11
- package/dist/modules/elysia/crudSchema/utils/createCountSchema.d.ts +0 -16
- package/dist/modules/elysia/crudSchema/utils/createDeleteSchema.d.ts +0 -18
- package/dist/modules/elysia/crudSchema/utils/createFindSchema.d.ts +0 -22
- package/dist/modules/elysia/crudSchema/utils/createInsertSchema.d.ts +0 -8
- package/dist/modules/elysia/crudSchema/utils/createPropertiesSchema.d.ts +0 -12
- package/dist/modules/elysia/crudSchema/utils/createResponse200Schema.d.ts +0 -5
- package/dist/modules/elysia/crudSchema/utils/createUpdateOneSchema.d.ts +0 -4
- package/dist/modules/elysia/crudSchema/utils/createUpdateSchema.d.ts +0 -10
- package/dist/modules/elysia/crudSchema/utils/index.d.ts +0 -15
- package/dist/modules/elysia/dbResolver/dbResolver.d.ts +0 -17
- package/dist/modules/elysia/dbResolver/enums/dbResolverErrorKeys.d.ts +0 -3
- package/dist/modules/elysia/dbResolver/enums/index.d.ts +0 -1
- package/dist/modules/elysia/dbResolver/index.d.ts +0 -1
- package/dist/modules/elysia/dbResolver/index.js +0 -18
- package/dist/modules/elysia/dbResolver/types/dynamicDbOptions.d.ts +0 -7
- package/dist/modules/elysia/dbResolver/types/index.d.ts +0 -1
- package/dist/modules/elysia/jwt/enums/index.d.ts +0 -1
- package/dist/modules/elysia/jwt/enums/index.js +0 -7
- package/dist/modules/elysia/jwt/enums/jwtErrorKeys.d.ts +0 -4
- package/dist/modules/elysia/jwt/index.d.ts +0 -1
- package/dist/modules/elysia/jwt/index.js +0 -77
- package/dist/modules/elysia/jwt/jwt.d.ts +0 -119
- package/dist/modules/elysia/jwt/types/index.d.ts +0 -1
- package/dist/modules/elysia/jwt/types/jwtOptions.d.ts +0 -98
- package/dist/modules/elysia/rateLimit/enums/index.d.ts +0 -1
- package/dist/modules/elysia/rateLimit/index.d.ts +0 -1
- package/dist/modules/elysia/rateLimit/index.js +0 -139
- package/dist/modules/elysia/rateLimit/stores/memoryStore.d.ts +0 -47
- package/dist/modules/elysia/rateLimit/types/index.d.ts +0 -1
- package/dist/modules/elysia/rateLimit/types/rateLimitStore.d.ts +0 -21
- package/dist/modules/logger/enums/loggerErrorKeys.d.ts +0 -6
- package/dist/modules/logger/events/loggerEvents.d.ts +0 -11
- package/dist/modules/logger/strategies/consoleLogger.d.ts +0 -22
- package/dist/modules/logger/strategies/fileLogger.d.ts +0 -25
- package/dist/modules/logger/strategies/index.d.ts +0 -2
- package/dist/modules/logger/types/bodiesIntersection.d.ts +0 -2
- package/dist/modules/logger/types/logStreamChunk.d.ts +0 -15
- package/dist/modules/logger/types/strategyBody.d.ts +0 -2
- package/dist/modules/logger/types/strategyMap.d.ts +0 -2
- package/dist/modules/singletonManager/enums/index.d.ts +0 -1
- package/dist/modules/singletonManager/enums/singletonManagerErrorKeys.d.ts +0 -4
- package/dist/modules/singletonManager/index.d.ts +0 -1
- package/dist/modules/singletonManager/index.js +0 -9
- package/dist/modules/typedEventEmitter/index.d.ts +0 -1
- package/dist/modules/typedEventEmitter/typedEventEmitter.d.ts +0 -221
- package/dist/modules/typedEventEmitter/types/index.d.ts +0 -1
- package/dist/modules/typedEventEmitter/types/index.js +0 -1
- package/dist/utils/enums/index.d.ts +0 -1
- package/dist/utils/types/index.d.ts +0 -2
- package/dist/utils/types/index.js +0 -1
- package/dist/errors/enums/{httpErrorStatusCodes.d.ts → http-status-codes.d.ts} +0 -0
- package/dist/modules/data/enums/{dataErrorKeys.d.ts → data-error-keys.d.ts} +0 -0
- package/dist/modules/data/types/{camelCase.d.ts → camel-case.d.ts} +0 -0
- package/dist/modules/data/types/{caseTransformer.d.ts → case-transformer.d.ts} +0 -0
- package/dist/modules/data/types/{kebabCase.d.ts → kebab-case.d.ts} +0 -0
- package/dist/modules/data/types/{snakeCase.d.ts → snake-case.d.ts} +0 -0
- package/dist/modules/database/enums/{databaseErrorKeys.d.ts → database-error-keys.d.ts} +15 -15
- package/dist/modules/database/enums/{mssqlErrorCode.d.ts → mssql-error-code.d.ts} +12 -12
- package/dist/modules/database/types/{mssqlDatabaseOption.d.ts → mssql-database-option.d.ts} +0 -0
- package/dist/modules/database/types/{mssqlEventLog.d.ts → mssql-event-log.d.ts} +0 -0
- package/dist/modules/database/types/{queryContext.d.ts → query-context.d.ts} +0 -0
- package/dist/{errors → modules/elysia/cache}/types/index.js +0 -0
- package/dist/modules/elysia/{crudSchema/types/crudSchemaOperations.d.ts → crud/types/crud-schema-operations.d.ts} +0 -0
- package/dist/modules/elysia/{rateLimit/enums/rateLimitErrorKeys.d.ts → rate-limit/enums/rate-limit-error-keys.d.ts} +0 -0
- package/dist/modules/elysia/{crudSchema → rate-limit}/types/index.js +0 -0
- package/dist/modules/{elysia/dbResolver → kv-store}/types/index.js +0 -0
- package/dist/modules/logger/types/{logLevels.d.ts → log-levels.d.ts} +0 -0
- package/dist/modules/mailer/enums/{mailerErrorKeys.d.ts → mailer-error-keys.d.ts} +1 -1
- package/dist/modules/mailer/types/{smtpCredentials.d.ts → smtp-credentials.d.ts} +0 -0
- package/dist/modules/mailer/types/{smtpPoolOptions.d.ts → smtp-pool-options.d.ts} +0 -0
- package/dist/modules/repository/types/{adaptiveWhereClause.d.ts → adaptive-where-clause.d.ts} +0 -0
- package/dist/modules/repository/types/{orderByItem.d.ts → order-by-item.d.ts} +0 -0
- package/dist/modules/repository/types/{selectedFields.d.ts → selected-fields.d.ts} +0 -0
- package/dist/modules/totp/enums/{totpErrorKeys.d.ts → totp-error-keys.d.ts} +2 -2
- /package/dist/modules/totp/types/{otpAuthUri.d.ts → otp-auth-uri.d.ts} +0 -0
- /package/dist/modules/totp/types/{totpOptions.d.ts → totp-options.d.ts} +0 -0
- /package/dist/modules/totp/utils/{createCounterBuffer.d.ts → create-counter-buffer.d.ts} +0 -0
- /package/dist/modules/totp/utils/{dynamicTruncation.d.ts → dynamic-truncation.d.ts} +0 -0
- /package/dist/modules/totp/utils/{generateHmac.d.ts → generate-hmac.d.ts} +0 -0
- /package/dist/modules/totp/utils/{generateSecretBytes.d.ts → generate-secret-bytes.d.ts} +0 -0
- /package/dist/modules/{typedEventEmitter/types/eventMap.d.ts → typed-event-emitter/types/event-map.d.ts} +0 -0
- /package/dist/modules/{elysia/jwt → typed-event-emitter}/types/index.js +0 -0
- /package/dist/{utils/enums/utilsErrorKeys.d.ts → shared/enums/utils-error-keys.d.ts} +0 -0
- /package/dist/{modules/elysia/rateLimit → shared}/types/index.js +0 -0
- /package/dist/{utils/types/renameKey.d.ts → shared/types/rename-key.d.ts} +0 -0
- /package/dist/{utils/types/streamWithAsyncIterable.d.ts → shared/types/stream-with-async-iterable.d.ts} +0 -0
- /package/dist/{utils → shared/utils}/env.d.ts +0 -0
- /package/dist/{utils/isDateString.d.ts → shared/utils/is-date-string.d.ts} +0 -0
- /package/dist/{utils → shared/utils}/stream.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { AdaptiveWhereClause } from './
|
|
1
|
+
export type { AdaptiveWhereClause } from './adaptive-where-clause';
|
|
2
2
|
export type { Filter } from './filter';
|
|
3
|
-
export type { OrderByItem } from './
|
|
4
|
-
export type { QueryOptions } from './
|
|
5
|
-
export type { QueryOptionsExtendPagination } from './
|
|
6
|
-
export type { QueryOptionsExtendStream } from './
|
|
7
|
-
export type { SelectedFields } from './
|
|
3
|
+
export type { OrderByItem } from './order-by-item';
|
|
4
|
+
export type { QueryOptions } from './query-options';
|
|
5
|
+
export type { QueryOptionsExtendPagination } from './query-options-extend-pagination';
|
|
6
|
+
export type { QueryOptionsExtendStream } from './query-options-extend-stream';
|
|
7
|
+
export type { SelectedFields } from './selected-fields';
|
|
8
8
|
export type { Transaction } from './transaction';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { HTTP_ERROR_STATUS_CODES } from '../../../errors/enums/http-status-codes';
|
|
1
2
|
import type { Filter } from './filter';
|
|
2
|
-
import type { OrderByItem } from './
|
|
3
|
-
import type { SelectedFields } from './
|
|
3
|
+
import type { OrderByItem } from './order-by-item';
|
|
4
|
+
import type { SelectedFields } from './selected-fields';
|
|
4
5
|
import type { Transaction } from './transaction';
|
|
5
6
|
/**
|
|
6
7
|
* This interface defines the basic options for a repository query.
|
|
@@ -28,7 +29,10 @@ export interface QueryOptions<TModel> {
|
|
|
28
29
|
* Whether to throw an error if the query does not return any result.
|
|
29
30
|
* @defaultValue false
|
|
30
31
|
*/
|
|
31
|
-
readonly throwIfNoResult?: boolean |
|
|
32
|
+
readonly throwIfNoResult?: boolean | {
|
|
33
|
+
message?: string;
|
|
34
|
+
httpStatusCode?: keyof typeof HTTP_ERROR_STATUS_CODES | typeof HTTP_ERROR_STATUS_CODES[keyof typeof HTTP_ERROR_STATUS_CODES];
|
|
35
|
+
};
|
|
32
36
|
/**
|
|
33
37
|
* The transaction context for the query. ({@link Transaction})
|
|
34
38
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SINGLETON_MANAGER_ERROR_KEYS } from './singleton-manager-error-keys';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SingletonManager } from './singleton-manager';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SingletonManager is a static class that manages the singletons in the application.
|
|
3
|
-
* When a class is registered, the SingletonManager
|
|
3
|
+
* When a class instance is registered, the SingletonManager stores it and returns the same instance when requested.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
* }
|
|
20
20
|
* }
|
|
21
21
|
*
|
|
22
|
-
* SingletonManager.register('ExampleSingleton', ExampleSingleton);
|
|
22
|
+
* SingletonManager.register('ExampleSingleton', new ExampleSingleton());
|
|
23
23
|
*
|
|
24
|
-
* SingletonManager.get<ExampleSingleton>('ExampleSingleton').sayHello(); // Output:
|
|
24
|
+
* SingletonManager.get<ExampleSingleton>('ExampleSingleton').sayHello(); // Output: Hello from instance 1!
|
|
25
25
|
* SingletonManager.get<ExampleSingleton>('ExampleSingleton').sayHello(); // Output: Hello from instance 1!
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
@@ -32,24 +32,22 @@ export declare class SingletonManager {
|
|
|
32
32
|
*/
|
|
33
33
|
private static readonly _registry;
|
|
34
34
|
/**
|
|
35
|
-
* Registers a class
|
|
35
|
+
* Registers a class instance in the SingletonManager.
|
|
36
36
|
*
|
|
37
|
-
* @template TClass - The type of the class.
|
|
38
|
-
* @template TArgs - The tuple type of the constructor arguments.
|
|
37
|
+
* @template TClass - The type of the class instance.
|
|
39
38
|
*
|
|
40
39
|
* @param name - The name of the class.
|
|
41
|
-
* @param
|
|
42
|
-
* @param args - The arguments to pass to the constructor of the class.
|
|
40
|
+
* @param instance - The instance of the class to register as singleton.
|
|
43
41
|
*
|
|
44
|
-
* @throws ({@link BaseError})
|
|
42
|
+
* @throws ({@link BaseError}) If the name is already registered, it throws an error.
|
|
45
43
|
*/
|
|
46
|
-
static register<TClass extends object
|
|
44
|
+
static register<TClass extends object>(name: string, instance: TClass): void;
|
|
47
45
|
/**
|
|
48
46
|
* Unregisters a class from the SingletonManager.
|
|
49
47
|
*
|
|
50
48
|
* @param name - The name of the class to unregister.
|
|
51
49
|
*
|
|
52
|
-
* @throws ({@link BaseError}) If the
|
|
50
|
+
* @throws ({@link BaseError}) If the name is not registered, it throws an error.
|
|
53
51
|
*/
|
|
54
52
|
static unregister(name: string): void;
|
|
55
53
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TOTP_ERROR_KEYS } from './
|
|
1
|
+
export { TOTP_ERROR_KEYS } from './totp-error-keys';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TotpOptions } from './types/totp-options';
|
|
2
|
+
/**
|
|
3
|
+
* HMAC-based One-Time Password (HOTP) implementation
|
|
4
|
+
*
|
|
5
|
+
* @param secret - Secret key as bytes
|
|
6
|
+
* @param counter - Counter value
|
|
7
|
+
* @param opts - HOTP options
|
|
8
|
+
*
|
|
9
|
+
* @returns Promise resolving to the HOTP code
|
|
10
|
+
*/
|
|
11
|
+
export declare const hotp: (secret: Uint8Array, counter: number | bigint, { algorithm, digits }?: TotpOptions) => Promise<string>;
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
createCounterBuffer,
|
|
4
4
|
dynamicTruncation,
|
|
5
5
|
generateHmac
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-m3grz32t.js";
|
|
7
7
|
import {
|
|
8
8
|
TOTP_ERROR_KEYS
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-z9a175mk.js";
|
|
10
10
|
import {
|
|
11
11
|
BaseError
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-9cgzhc50.js";
|
|
13
13
|
|
|
14
|
-
// source/modules/totp/
|
|
14
|
+
// source/modules/totp/hotp.ts
|
|
15
15
|
import { webcrypto } from "crypto";
|
|
16
16
|
var hotp = async (secret, counter, {
|
|
17
17
|
algorithm = "SHA-1",
|
|
@@ -22,31 +22,7 @@ var hotp = async (secret, counter, {
|
|
|
22
22
|
const hmacArray = await generateHmac(key, counterBuffer);
|
|
23
23
|
return dynamicTruncation(hmacArray, digits);
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
algorithm = "SHA-1",
|
|
27
|
-
digits = 6,
|
|
28
|
-
period = 30,
|
|
29
|
-
now = Date.now()
|
|
30
|
-
} = {}) => {
|
|
31
|
-
const timeStep = Math.floor(now / 1000 / period);
|
|
32
|
-
return hotp(secret, timeStep, { algorithm, digits });
|
|
33
|
-
};
|
|
34
|
-
var verifyTotp = async (secret, code, {
|
|
35
|
-
algorithm = "SHA-1",
|
|
36
|
-
digits = 6,
|
|
37
|
-
period = 30,
|
|
38
|
-
window = 0,
|
|
39
|
-
now = Date.now()
|
|
40
|
-
} = {}) => {
|
|
41
|
-
const currentTimeStep = Math.floor(now / 1000 / period);
|
|
42
|
-
for (let i = -window;i <= window; ++i) {
|
|
43
|
-
const timeStep = currentTimeStep + i;
|
|
44
|
-
const expectedCode = await hotp(secret, timeStep, { algorithm, digits });
|
|
45
|
-
if (expectedCode === code)
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
};
|
|
25
|
+
// source/modules/totp/otp-auth-uri.ts
|
|
50
26
|
var buildOtpAuthUri = ({
|
|
51
27
|
secretBase32,
|
|
52
28
|
label,
|
|
@@ -71,19 +47,13 @@ var buildOtpAuthUri = ({
|
|
|
71
47
|
var parseOtpAuthUri = (uri) => {
|
|
72
48
|
const url = new URL(uri);
|
|
73
49
|
if (url.protocol !== "otpauth:")
|
|
74
|
-
throw new BaseError(
|
|
75
|
-
message: TOTP_ERROR_KEYS.INVALID_OTP_AUTH_URI
|
|
76
|
-
});
|
|
50
|
+
throw new BaseError(TOTP_ERROR_KEYS.INVALID_OTP_AUTH_URI);
|
|
77
51
|
if (url.hostname !== "totp")
|
|
78
|
-
throw new BaseError(
|
|
79
|
-
message: TOTP_ERROR_KEYS.INVALID_OTP_AUTH_URI
|
|
80
|
-
});
|
|
52
|
+
throw new BaseError(TOTP_ERROR_KEYS.INVALID_OTP_AUTH_URI);
|
|
81
53
|
const label = decodeURIComponent(url.pathname.slice(1));
|
|
82
54
|
const secretBase32 = url.searchParams.get("secret");
|
|
83
55
|
if (!secretBase32)
|
|
84
|
-
throw new BaseError(
|
|
85
|
-
message: TOTP_ERROR_KEYS.MISSING_SECRET
|
|
86
|
-
});
|
|
56
|
+
throw new BaseError(TOTP_ERROR_KEYS.MISSING_SECRET);
|
|
87
57
|
const issuerParam = url.searchParams.get("issuer");
|
|
88
58
|
const issuer = issuerParam ? decodeURIComponent(issuerParam) : undefined;
|
|
89
59
|
const algorithm = url.searchParams.get("algorithm") || "SHA-1";
|
|
@@ -99,14 +69,35 @@ var parseOtpAuthUri = (uri) => {
|
|
|
99
69
|
};
|
|
100
70
|
return result;
|
|
101
71
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
72
|
+
// source/modules/totp/totp.ts
|
|
73
|
+
var totp = async (secret, {
|
|
74
|
+
algorithm = "SHA-1",
|
|
75
|
+
digits = 6,
|
|
76
|
+
period = 30,
|
|
77
|
+
now = Date.now()
|
|
78
|
+
} = {}) => {
|
|
79
|
+
const timeStep = Math.floor(now / 1000 / period);
|
|
80
|
+
return hotp(secret, timeStep, { algorithm, digits });
|
|
81
|
+
};
|
|
82
|
+
var verifyTotp = async (secret, code, {
|
|
83
|
+
algorithm = "SHA-1",
|
|
84
|
+
digits = 6,
|
|
85
|
+
period = 30,
|
|
86
|
+
window = 0,
|
|
87
|
+
now = Date.now()
|
|
88
|
+
} = {}) => {
|
|
89
|
+
const currentTimeStep = Math.floor(now / 1000 / period);
|
|
90
|
+
for (let i = -window;i <= window; ++i) {
|
|
91
|
+
const timeStep = currentTimeStep + i;
|
|
92
|
+
const expectedCode = await hotp(secret, timeStep, { algorithm, digits });
|
|
93
|
+
if (expectedCode === code)
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
105
97
|
};
|
|
106
98
|
export {
|
|
107
99
|
verifyTotp,
|
|
108
100
|
totp,
|
|
109
|
-
timeRemaining,
|
|
110
101
|
parseOtpAuthUri,
|
|
111
102
|
hotp,
|
|
112
103
|
buildOtpAuthUri
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OtpAuthUri } from './types/otp-auth-uri';
|
|
2
|
+
/**
|
|
3
|
+
* Build an OTPAuth URI for QR code generation
|
|
4
|
+
*
|
|
5
|
+
* @param params - URI parameters
|
|
6
|
+
*
|
|
7
|
+
* @returns OTPAuth URI string
|
|
8
|
+
*/
|
|
9
|
+
export declare const buildOtpAuthUri: ({ secretBase32, label, issuer, algorithm, digits, period }: OtpAuthUri) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Parse an OTPAuth URI
|
|
12
|
+
*
|
|
13
|
+
* @param uri - OTPAuth URI to parse
|
|
14
|
+
*
|
|
15
|
+
* @throws ({@link BaseError}) - if the URI is invalid or missing required parameters
|
|
16
|
+
*
|
|
17
|
+
* @returns Parsed URI parameters
|
|
18
|
+
*/
|
|
19
|
+
export declare const parseOtpAuthUri: (uri: string) => Required<Omit<OtpAuthUri, "issuer">> & {
|
|
20
|
+
issuer?: string;
|
|
21
|
+
};
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { VerifyOptions } from './types/verifyOptions';
|
|
4
|
-
/**
|
|
5
|
-
* HMAC-based One-Time Password (HOTP) implementation
|
|
6
|
-
*
|
|
7
|
-
* @param secret - Secret key as bytes
|
|
8
|
-
* @param counter - Counter value
|
|
9
|
-
* @param opts - HOTP options
|
|
10
|
-
*
|
|
11
|
-
* @returns Promise resolving to the HOTP code
|
|
12
|
-
*/
|
|
13
|
-
export declare const hotp: (secret: Uint8Array, counter: number | bigint, { algorithm, digits }?: TotpOptions) => Promise<string>;
|
|
1
|
+
import type { TotpOptions } from './types/totp-options';
|
|
2
|
+
import type { VerifyOptions } from './types/verify-options';
|
|
14
3
|
/**
|
|
15
4
|
* Time-based One-Time Password (TOTP) implementation
|
|
16
5
|
*
|
|
@@ -32,32 +21,3 @@ export declare const totp: (secret: Uint8Array, { algorithm, digits, period, now
|
|
|
32
21
|
* @returns Promise resolving to true if code is valid
|
|
33
22
|
*/
|
|
34
23
|
export declare const verifyTotp: (secret: Uint8Array, code: string, { algorithm, digits, period, window, now }?: VerifyOptions) => Promise<boolean>;
|
|
35
|
-
/**
|
|
36
|
-
* Build an OTPAuth URI for QR code generation
|
|
37
|
-
*
|
|
38
|
-
* @param params - URI parameters
|
|
39
|
-
*
|
|
40
|
-
* @returns OTPAuth URI string
|
|
41
|
-
*/
|
|
42
|
-
export declare const buildOtpAuthUri: ({ secretBase32, label, issuer, algorithm, digits, period }: OtpAuthUri) => string;
|
|
43
|
-
/**
|
|
44
|
-
* Parse an OTPAuth URI
|
|
45
|
-
*
|
|
46
|
-
* @param uri - OTPAuth URI to parse
|
|
47
|
-
*
|
|
48
|
-
* @throws ({@link BaseError}) if the URI is invalid or missing required parameters
|
|
49
|
-
*
|
|
50
|
-
* @returns Parsed URI parameters
|
|
51
|
-
*/
|
|
52
|
-
export declare const parseOtpAuthUri: (uri: string) => Required<Omit<OtpAuthUri, "issuer">> & {
|
|
53
|
-
issuer?: string;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Calculate remaining time until next TOTP code
|
|
57
|
-
*
|
|
58
|
-
* @param period - Time period in seconds (default: 30)
|
|
59
|
-
* @param now - Current timestamp in milliseconds (default: Date.now())
|
|
60
|
-
*
|
|
61
|
-
* @returns Seconds remaining until next code
|
|
62
|
-
*/
|
|
63
|
-
export declare const timeRemaining: (period?: number, now?: number) => number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { OtpAuthUri } from './
|
|
2
|
-
export type { TotpOptions } from './
|
|
3
|
-
export type { VerifyOptions } from './
|
|
1
|
+
export type { OtpAuthUri } from './otp-auth-uri';
|
|
2
|
+
export type { TotpOptions } from './totp-options';
|
|
3
|
+
export type { VerifyOptions } from './verify-options';
|
|
@@ -12,7 +12,7 @@ export declare const base32Encode: (input: string | Uint8Array, withPadding?: bo
|
|
|
12
12
|
*
|
|
13
13
|
* @param base32 - Base32 string to decode
|
|
14
14
|
*
|
|
15
|
-
* @throws ({@link BaseError}) if invalid Base32 character is found
|
|
15
|
+
* @throws ({@link BaseError}) - if invalid Base32 character is found
|
|
16
16
|
*
|
|
17
17
|
* @returns Decoded bytes
|
|
18
18
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { base32Decode, base32Encode } from './base32';
|
|
2
|
-
export { createCounterBuffer } from './
|
|
3
|
-
export {
|
|
4
|
-
export { generateHmac } from './
|
|
5
|
-
export {
|
|
2
|
+
export { createCounterBuffer } from './create-counter-buffer';
|
|
3
|
+
export { dynamicTruncation } from './dynamic-truncation';
|
|
4
|
+
export { generateHmac } from './generate-hmac';
|
|
5
|
+
export { generateSecretBytes } from './generate-secret-bytes';
|
|
6
|
+
export { timeRemaining } from './time-remaining';
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
createCounterBuffer,
|
|
4
4
|
dynamicTruncation,
|
|
5
5
|
generateHmac
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-m3grz32t.js";
|
|
7
7
|
import {
|
|
8
8
|
TOTP_ERROR_KEYS
|
|
9
|
-
} from "../../../chunk-
|
|
9
|
+
} from "../../../chunk-z9a175mk.js";
|
|
10
10
|
import {
|
|
11
11
|
BaseError
|
|
12
|
-
} from "../../../chunk-
|
|
12
|
+
} from "../../../chunk-9cgzhc50.js";
|
|
13
13
|
|
|
14
14
|
// source/modules/totp/utils/base32.ts
|
|
15
15
|
var BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
@@ -43,10 +43,7 @@ var base32Decode = (base32) => {
|
|
|
43
43
|
for (const char of cleanBase32) {
|
|
44
44
|
const charValue = BASE32_ALPHABET.indexOf(char);
|
|
45
45
|
if (charValue === -1)
|
|
46
|
-
throw new BaseError({
|
|
47
|
-
message: TOTP_ERROR_KEYS.INVALID_BASE32_CHARACTER,
|
|
48
|
-
cause: `Invalid Base32 character: ${char}`
|
|
49
|
-
});
|
|
46
|
+
throw new BaseError(TOTP_ERROR_KEYS.INVALID_BASE32_CHARACTER, `Invalid Base32 character: ${char}`);
|
|
50
47
|
value = value << 5 | charValue;
|
|
51
48
|
bits += 5;
|
|
52
49
|
if (bits >= 8) {
|
|
@@ -56,16 +53,20 @@ var base32Decode = (base32) => {
|
|
|
56
53
|
}
|
|
57
54
|
return new Uint8Array(result);
|
|
58
55
|
};
|
|
59
|
-
// source/modules/totp/utils/
|
|
56
|
+
// source/modules/totp/utils/generate-secret-bytes.ts
|
|
60
57
|
import { getRandomValues } from "crypto";
|
|
61
58
|
var generateSecretBytes = (length = 20) => {
|
|
62
59
|
if (length <= 0)
|
|
63
|
-
throw new BaseError(
|
|
64
|
-
message: TOTP_ERROR_KEYS.INVALID_SECRET_LENGTH
|
|
65
|
-
});
|
|
60
|
+
throw new BaseError(TOTP_ERROR_KEYS.INVALID_SECRET_LENGTH);
|
|
66
61
|
return getRandomValues(new Uint8Array(length));
|
|
67
62
|
};
|
|
63
|
+
// source/modules/totp/utils/time-remaining.ts
|
|
64
|
+
var timeRemaining = (period = 30, now = Date.now()) => {
|
|
65
|
+
const elapsed = Math.floor(now / 1000) % period;
|
|
66
|
+
return period - elapsed;
|
|
67
|
+
};
|
|
68
68
|
export {
|
|
69
|
+
timeRemaining,
|
|
69
70
|
generateSecretBytes,
|
|
70
71
|
generateHmac,
|
|
71
72
|
dynamicTruncation,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate remaining time until next TOTP code
|
|
3
|
+
*
|
|
4
|
+
* @param period - Time period in seconds (default: 30)
|
|
5
|
+
* @param now - Current timestamp in milliseconds (default: Date.now())
|
|
6
|
+
*
|
|
7
|
+
* @returns Seconds remaining until next code
|
|
8
|
+
*/
|
|
9
|
+
export declare const timeRemaining: (period?: number, now?: number) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TypedEventEmitter } from './typed-event-emitter';
|