@windrun-huaiin/backend-core 15.0.0 → 15.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/api/stripe/checkout/route.js +2 -2
- package/dist/app/api/stripe/checkout/route.mjs +1 -1
- package/dist/app/api/stripe/customer-portal/route.js +2 -2
- package/dist/app/api/stripe/customer-portal/route.mjs +1 -1
- package/dist/app/api/user/anonymous/init/route.js +6 -6
- package/dist/app/api/user/anonymous/init/route.mjs +1 -1
- package/dist/app/api/webhook/clerk/user/route.js +4 -4
- package/dist/app/api/webhook/clerk/user/route.mjs +1 -1
- package/dist/app/api/webhook/stripe/route.js +2 -2
- package/dist/app/api/webhook/stripe/route.mjs +1 -1
- package/dist/auth/auth-middleware.js +3 -3
- package/dist/auth/auth-middleware.mjs +1 -1
- package/dist/auth/auth-utils.js +10 -10
- package/dist/auth/auth-utils.mjs +1 -1
- package/dist/lib/money-price-helper.js +3 -3
- package/dist/lib/money-price-helper.mjs +1 -1
- package/dist/lib/stripe-config.js +8 -8
- package/dist/lib/stripe-config.mjs +1 -1
- package/dist/lib/upstash/qstash.js +12 -12
- package/dist/lib/upstash/qstash.mjs +2 -2
- package/dist/lib/upstash/redis-counter.js +7 -7
- package/dist/lib/upstash/redis-counter.mjs +1 -1
- package/dist/lib/upstash/redis-favorite.js +9 -9
- package/dist/lib/upstash/redis-favorite.mjs +1 -1
- package/dist/lib/upstash/redis-like.js +9 -9
- package/dist/lib/upstash/redis-like.mjs +1 -1
- package/dist/lib/upstash/redis-lock.js +6 -6
- package/dist/lib/upstash/redis-lock.mjs +1 -1
- package/dist/lib/upstash/redis-structures.js +25 -25
- package/dist/lib/upstash/redis-structures.mjs +1 -1
- package/dist/lib/upstash-config.js +14 -14
- package/dist/lib/upstash-config.mjs +4 -4
- package/dist/prisma/prisma-transaction-util.js +2 -2
- package/dist/prisma/prisma-transaction-util.mjs +1 -1
- package/dist/services/aggregate/anonymous.aggregate.service.js +6 -6
- package/dist/services/aggregate/anonymous.aggregate.service.mjs +1 -1
- package/dist/services/aggregate/billing.aggregate.service.js +21 -21
- package/dist/services/aggregate/billing.aggregate.service.mjs +1 -1
- package/dist/services/aggregate/user.aggregate.service.js +10 -10
- package/dist/services/aggregate/user.aggregate.service.mjs +1 -1
- package/dist/services/context/user-context-service.js +3 -3
- package/dist/services/context/user-context-service.mjs +1 -1
- package/dist/services/database/apilog.service.js +14 -14
- package/dist/services/database/apilog.service.mjs +1 -1
- package/dist/services/database/credit.service.js +20 -20
- package/dist/services/database/credit.service.mjs +1 -1
- package/dist/services/database/creditAuditLog.service.js +13 -13
- package/dist/services/database/creditAuditLog.service.mjs +1 -1
- package/dist/services/database/subscription.service.js +16 -16
- package/dist/services/database/subscription.service.mjs +1 -1
- package/dist/services/database/transaction.service.js +18 -18
- package/dist/services/database/transaction.service.mjs +1 -1
- package/dist/services/database/user.service.js +14 -14
- package/dist/services/database/user.service.mjs +1 -1
- package/dist/services/database/userBackup.service.js +15 -15
- package/dist/services/database/userBackup.service.mjs +1 -1
- package/dist/services/stripe/webhook-handler.js +13 -13
- package/dist/services/stripe/webhook-handler.mjs +3 -3
- package/package.json +6 -3
- package/dist/_virtual/_commonjs-dynamic-modules.js +0 -7
- package/dist/_virtual/_commonjs-dynamic-modules.mjs +0 -5
- package/dist/_virtual/_commonjsHelpers.js +0 -10
- package/dist/_virtual/_commonjsHelpers.mjs +0 -7
- package/dist/_virtual/aes.js +0 -5
- package/dist/_virtual/aes.mjs +0 -3
- package/dist/_virtual/blowfish.js +0 -5
- package/dist/_virtual/blowfish.mjs +0 -3
- package/dist/_virtual/cipher-core.js +0 -5
- package/dist/_virtual/cipher-core.mjs +0 -3
- package/dist/_virtual/core.js +0 -5
- package/dist/_virtual/core.mjs +0 -3
- package/dist/_virtual/enc-base64.js +0 -5
- package/dist/_virtual/enc-base64.mjs +0 -3
- package/dist/_virtual/enc-base64url.js +0 -5
- package/dist/_virtual/enc-base64url.mjs +0 -3
- package/dist/_virtual/enc-utf16.js +0 -5
- package/dist/_virtual/enc-utf16.mjs +0 -3
- package/dist/_virtual/evpkdf.js +0 -5
- package/dist/_virtual/evpkdf.mjs +0 -3
- package/dist/_virtual/format-hex.js +0 -5
- package/dist/_virtual/format-hex.mjs +0 -3
- package/dist/_virtual/hmac.js +0 -5
- package/dist/_virtual/hmac.mjs +0 -3
- package/dist/_virtual/index.js +0 -11
- package/dist/_virtual/index.mjs +0 -7
- package/dist/_virtual/index2.js +0 -5
- package/dist/_virtual/index2.mjs +0 -3
- package/dist/_virtual/lib-typedarrays.js +0 -5
- package/dist/_virtual/lib-typedarrays.mjs +0 -3
- package/dist/_virtual/md5.js +0 -5
- package/dist/_virtual/md5.mjs +0 -3
- package/dist/_virtual/mode-cfb.js +0 -5
- package/dist/_virtual/mode-cfb.mjs +0 -3
- package/dist/_virtual/mode-ctr-gladman.js +0 -5
- package/dist/_virtual/mode-ctr-gladman.mjs +0 -3
- package/dist/_virtual/mode-ctr.js +0 -5
- package/dist/_virtual/mode-ctr.mjs +0 -3
- package/dist/_virtual/mode-ecb.js +0 -5
- package/dist/_virtual/mode-ecb.mjs +0 -3
- package/dist/_virtual/mode-ofb.js +0 -5
- package/dist/_virtual/mode-ofb.mjs +0 -3
- package/dist/_virtual/pad-ansix923.js +0 -5
- package/dist/_virtual/pad-ansix923.mjs +0 -3
- package/dist/_virtual/pad-iso10126.js +0 -5
- package/dist/_virtual/pad-iso10126.mjs +0 -3
- package/dist/_virtual/pad-iso97971.js +0 -5
- package/dist/_virtual/pad-iso97971.mjs +0 -3
- package/dist/_virtual/pad-nopadding.js +0 -5
- package/dist/_virtual/pad-nopadding.mjs +0 -3
- package/dist/_virtual/pad-zeropadding.js +0 -5
- package/dist/_virtual/pad-zeropadding.mjs +0 -3
- package/dist/_virtual/pbkdf2.js +0 -5
- package/dist/_virtual/pbkdf2.mjs +0 -3
- package/dist/_virtual/rabbit-legacy.js +0 -5
- package/dist/_virtual/rabbit-legacy.mjs +0 -3
- package/dist/_virtual/rabbit.js +0 -5
- package/dist/_virtual/rabbit.mjs +0 -3
- package/dist/_virtual/rc4.js +0 -5
- package/dist/_virtual/rc4.mjs +0 -3
- package/dist/_virtual/ripemd160.js +0 -5
- package/dist/_virtual/ripemd160.mjs +0 -3
- package/dist/_virtual/sha1.js +0 -5
- package/dist/_virtual/sha1.mjs +0 -3
- package/dist/_virtual/sha224.js +0 -5
- package/dist/_virtual/sha224.mjs +0 -3
- package/dist/_virtual/sha256.js +0 -5
- package/dist/_virtual/sha256.mjs +0 -3
- package/dist/_virtual/sha3.js +0 -5
- package/dist/_virtual/sha3.mjs +0 -3
- package/dist/_virtual/sha384.js +0 -5
- package/dist/_virtual/sha384.mjs +0 -3
- package/dist/_virtual/sha512.js +0 -5
- package/dist/_virtual/sha512.mjs +0 -3
- package/dist/_virtual/tripledes.js +0 -5
- package/dist/_virtual/tripledes.mjs +0 -3
- package/dist/_virtual/x64-core.js +0 -5
- package/dist/_virtual/x64-core.mjs +0 -3
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +0 -48
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs +0 -45
- package/dist/node_modules/.pnpm/@upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.js +0 -1848
- package/dist/node_modules/.pnpm/@upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.mjs +0 -1830
- package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.js +0 -5308
- package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.mjs +0 -5302
- package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/nodejs.js +0 -116
- package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/nodejs.mjs +0 -113
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js +0 -248
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.mjs +0 -246
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.js +0 -485
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.mjs +0 -483
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.js +0 -906
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.mjs +0 -904
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.js +0 -818
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.mjs +0 -816
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.js +0 -146
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.mjs +0 -144
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.js +0 -158
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.mjs +0 -156
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.js +0 -159
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.mjs +0 -157
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.js +0 -146
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.mjs +0 -144
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.js +0 -77
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.mjs +0 -75
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.js +0 -153
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.mjs +0 -151
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.js +0 -62
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.mjs +0 -60
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.js +0 -86
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.mjs +0 -84
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.js +0 -278
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.mjs +0 -276
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.js +0 -91
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.mjs +0 -89
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.js +0 -127
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.mjs +0 -125
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.js +0 -69
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.mjs +0 -67
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js +0 -51
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.mjs +0 -49
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.js +0 -65
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.mjs +0 -63
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.js +0 -60
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.mjs +0 -58
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.js +0 -55
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.mjs +0 -53
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.js +0 -51
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.mjs +0 -49
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.js +0 -41
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.mjs +0 -39
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.js +0 -58
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.mjs +0 -56
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.js +0 -157
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.mjs +0 -155
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.js +0 -204
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.mjs +0 -202
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.js +0 -206
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.mjs +0 -204
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.js +0 -153
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.mjs +0 -151
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.js +0 -277
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.mjs +0 -275
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.js +0 -160
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.mjs +0 -158
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.js +0 -91
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.mjs +0 -89
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.js +0 -209
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.mjs +0 -207
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.js +0 -337
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.mjs +0 -335
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.js +0 -95
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.mjs +0 -93
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.js +0 -337
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.mjs +0 -335
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.js +0 -793
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.mjs +0 -791
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.js +0 -314
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.mjs +0 -312
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.js +0 -26
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.mjs +0 -24
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.js +0 -127
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.mjs +0 -125
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js +0 -20
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.mjs +0 -18
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.js +0 -31
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.mjs +0 -29
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.js +0 -18
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.mjs +0 -14
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.js +0 -82
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.mjs +0 -80
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.js +0 -103
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.mjs +0 -101
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.js +0 -7
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.mjs +0 -3
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.js +0 -38
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.mjs +0 -33
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.js +0 -27
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.mjs +0 -23
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.js +0 -21
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.mjs +0 -16
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.js +0 -22
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.mjs +0 -18
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.js +0 -111
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.mjs +0 -107
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.js +0 -61
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.mjs +0 -57
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.js +0 -16
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.mjs +0 -12
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.js +0 -40
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.mjs +0 -36
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.js +0 -15
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.mjs +0 -13
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js +0 -23
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.mjs +0 -19
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js +0 -30
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.mjs +0 -26
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js +0 -60
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.mjs +0 -56
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js +0 -35
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.mjs +0 -31
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js +0 -20
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.mjs +0 -16
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.js +0 -15
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.mjs +0 -10
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.js +0 -28
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.mjs +0 -5
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.js +0 -14
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.mjs +0 -10
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.js +0 -115
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.mjs +0 -111
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js +0 -42
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.mjs +0 -19
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js +0 -54
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.mjs +0 -31
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.js +0 -32
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.mjs +0 -7
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.js +0 -69
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.mjs +0 -60
- package/dist/node_modules/.pnpm/neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.js +0 -422
- package/dist/node_modules/.pnpm/neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.mjs +0 -415
- package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.web.js +0 -6
- package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.web.mjs +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var upstashConfig = require('../upstash-config.js');
|
|
5
5
|
|
|
6
6
|
const likeTargetKey = (targetId) => `like:target:${targetId}`;
|
|
@@ -8,8 +8,8 @@ const likeUserKey = (userId) => `like:user:${userId}`;
|
|
|
8
8
|
/**
|
|
9
9
|
* Like a target. Returns true if the like was added, false if it already existed, null if Redis is unavailable.
|
|
10
10
|
*/
|
|
11
|
-
const likeTarget = (targetId, userId) =>
|
|
12
|
-
return upstashConfig.withRedis((redis) =>
|
|
11
|
+
const likeTarget = (targetId, userId) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
13
|
const added = yield redis.sadd(likeTargetKey(targetId), userId);
|
|
14
14
|
if (added === 1) {
|
|
15
15
|
yield redis.sadd(likeUserKey(userId), targetId);
|
|
@@ -21,8 +21,8 @@ const likeTarget = (targetId, userId) => tslib_es6.__awaiter(void 0, void 0, voi
|
|
|
21
21
|
/**
|
|
22
22
|
* Unlike a target. Returns true if removed, false if it didn't exist, null if Redis is unavailable.
|
|
23
23
|
*/
|
|
24
|
-
const unlikeTarget = (targetId, userId) =>
|
|
25
|
-
return upstashConfig.withRedis((redis) =>
|
|
24
|
+
const unlikeTarget = (targetId, userId) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
26
26
|
const removed = yield redis.srem(likeTargetKey(targetId), userId);
|
|
27
27
|
if (removed === 1) {
|
|
28
28
|
yield redis.srem(likeUserKey(userId), targetId);
|
|
@@ -34,8 +34,8 @@ const unlikeTarget = (targetId, userId) => tslib_es6.__awaiter(void 0, void 0, v
|
|
|
34
34
|
/**
|
|
35
35
|
* Check whether a user liked a target. Returns null if Redis is unavailable.
|
|
36
36
|
*/
|
|
37
|
-
const isTargetLiked = (targetId, userId) =>
|
|
38
|
-
return upstashConfig.withRedis((redis) =>
|
|
37
|
+
const isTargetLiked = (targetId, userId) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
39
39
|
const result = yield redis.sismember(likeTargetKey(targetId), userId);
|
|
40
40
|
return result === 1;
|
|
41
41
|
}));
|
|
@@ -43,13 +43,13 @@ const isTargetLiked = (targetId, userId) => tslib_es6.__awaiter(void 0, void 0,
|
|
|
43
43
|
/**
|
|
44
44
|
* Get like count for a target (unique by user). Returns null if Redis is unavailable.
|
|
45
45
|
*/
|
|
46
|
-
const getTargetLikeCount = (targetId) =>
|
|
46
|
+
const getTargetLikeCount = (targetId) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
47
47
|
return upstashConfig.withRedis((redis) => redis.scard(likeTargetKey(targetId)));
|
|
48
48
|
});
|
|
49
49
|
/**
|
|
50
50
|
* Get target ids liked by a user. Returns null if Redis is unavailable.
|
|
51
51
|
*/
|
|
52
|
-
const getUserLikedTargets = (userId) =>
|
|
52
|
+
const getUserLikedTargets = (userId) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
53
53
|
return upstashConfig.withRedis((redis) => redis.smembers(likeUserKey(userId)));
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __awaiter } from '
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
2
|
import { withRedis } from '../upstash-config.mjs';
|
|
3
3
|
|
|
4
4
|
const likeTargetKey = (targetId) => `like:target:${targetId}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var upstashConfig = require('../upstash-config.js');
|
|
5
5
|
|
|
6
6
|
const unlockScript = `
|
|
@@ -21,8 +21,8 @@ const generateToken = () => {
|
|
|
21
21
|
/**
|
|
22
22
|
* Acquire a distributed lock. Returns the lock token or null when unavailable.
|
|
23
23
|
*/
|
|
24
|
-
const acquireLock = (key, ttlMs) =>
|
|
25
|
-
return upstashConfig.withRedis((redis) =>
|
|
24
|
+
const acquireLock = (key, ttlMs) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
26
26
|
const token = generateToken();
|
|
27
27
|
const result = yield redis.set(key, token, { nx: true, px: ttlMs });
|
|
28
28
|
return result === 'OK' ? token : null;
|
|
@@ -31,8 +31,8 @@ const acquireLock = (key, ttlMs) => tslib_es6.__awaiter(void 0, void 0, void 0,
|
|
|
31
31
|
/**
|
|
32
32
|
* Release a distributed lock. Returns false when the lock client is unavailable.
|
|
33
33
|
*/
|
|
34
|
-
const releaseLock = (key, token) =>
|
|
35
|
-
const result = yield upstashConfig.withRedis((redis) =>
|
|
34
|
+
const releaseLock = (key, token) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
36
|
const released = yield redis.eval(unlockScript, [key], [token]);
|
|
37
37
|
return Number(released) === 1;
|
|
38
38
|
}));
|
|
@@ -41,7 +41,7 @@ const releaseLock = (key, token) => tslib_es6.__awaiter(void 0, void 0, void 0,
|
|
|
41
41
|
/**
|
|
42
42
|
* Run a function under a distributed lock. Returns null when the lock is unavailable.
|
|
43
43
|
*/
|
|
44
|
-
const withLock = (key, ttlMs, fn) =>
|
|
44
|
+
const withLock = (key, ttlMs, fn) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
const token = yield acquireLock(key, ttlMs);
|
|
46
46
|
if (!token) {
|
|
47
47
|
return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __awaiter } from '
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
2
|
import { withRedis } from '../upstash-config.mjs';
|
|
3
3
|
|
|
4
4
|
const unlockScript = `
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var upstashConfig = require('../upstash-config.js');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Set a plain string value with optional TTL (seconds).
|
|
8
8
|
*/
|
|
9
|
-
const setString = (key, value, ttlSec) =>
|
|
10
|
-
return upstashConfig.withRedis((redis) =>
|
|
9
|
+
const setString = (key, value, ttlSec) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
if (ttlSec && ttlSec > 0) {
|
|
12
12
|
yield redis.set(key, value, { ex: ttlSec });
|
|
13
13
|
return true;
|
|
@@ -19,14 +19,14 @@ const setString = (key, value, ttlSec) => tslib_es6.__awaiter(void 0, void 0, vo
|
|
|
19
19
|
/**
|
|
20
20
|
* Get a plain string value. Returns null if Redis is unavailable or key missing.
|
|
21
21
|
*/
|
|
22
|
-
const getString = (key) =>
|
|
22
|
+
const getString = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
return upstashConfig.withRedis((redis) => redis.get(key));
|
|
24
24
|
});
|
|
25
25
|
/**
|
|
26
26
|
* Store an object as JSON string with optional TTL (seconds).
|
|
27
27
|
*/
|
|
28
|
-
const setJson = (key, value, ttlSec) =>
|
|
29
|
-
return upstashConfig.withRedis((redis) =>
|
|
28
|
+
const setJson = (key, value, ttlSec) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
30
30
|
const payload = JSON.stringify(value);
|
|
31
31
|
if (ttlSec && ttlSec > 0) {
|
|
32
32
|
yield redis.set(key, payload, { ex: ttlSec });
|
|
@@ -39,8 +39,8 @@ const setJson = (key, value, ttlSec) => tslib_es6.__awaiter(void 0, void 0, void
|
|
|
39
39
|
/**
|
|
40
40
|
* Get an object stored as JSON string. Returns null if missing or invalid JSON.
|
|
41
41
|
*/
|
|
42
|
-
const getJson = (key) =>
|
|
43
|
-
return upstashConfig.withRedis((redis) =>
|
|
42
|
+
const getJson = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
44
44
|
const payload = yield redis.get(key);
|
|
45
45
|
if (!payload) {
|
|
46
46
|
return null;
|
|
@@ -56,8 +56,8 @@ const getJson = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* (
|
|
|
56
56
|
/**
|
|
57
57
|
* Delete a key. Returns false if Redis is unavailable.
|
|
58
58
|
*/
|
|
59
|
-
const deleteKey = (key) =>
|
|
60
|
-
const result = yield upstashConfig.withRedis((redis) =>
|
|
59
|
+
const deleteKey = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
+
const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
61
61
|
const deleted = yield redis.del(key);
|
|
62
62
|
return deleted > 0;
|
|
63
63
|
}));
|
|
@@ -66,8 +66,8 @@ const deleteKey = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function*
|
|
|
66
66
|
/**
|
|
67
67
|
* Set a hash field value.
|
|
68
68
|
*/
|
|
69
|
-
const setHashField = (key, field, value) =>
|
|
70
|
-
const result = yield upstashConfig.withRedis((redis) =>
|
|
69
|
+
const setHashField = (key, field, value) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
71
71
|
const changed = yield redis.hset(key, { [field]: value });
|
|
72
72
|
return changed > 0;
|
|
73
73
|
}));
|
|
@@ -76,14 +76,14 @@ const setHashField = (key, field, value) => tslib_es6.__awaiter(void 0, void 0,
|
|
|
76
76
|
/**
|
|
77
77
|
* Get a hash field value.
|
|
78
78
|
*/
|
|
79
|
-
const getHashField = (key, field) =>
|
|
79
|
+
const getHashField = (key, field) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
80
80
|
return upstashConfig.withRedis((redis) => redis.hget(key, field));
|
|
81
81
|
});
|
|
82
82
|
/**
|
|
83
83
|
* Store a hash field as JSON string.
|
|
84
84
|
*/
|
|
85
|
-
const setHashJson = (key, field, value) =>
|
|
86
|
-
const result = yield upstashConfig.withRedis((redis) =>
|
|
85
|
+
const setHashJson = (key, field, value) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
87
87
|
const payload = JSON.stringify(value);
|
|
88
88
|
const changed = yield redis.hset(key, { [field]: payload });
|
|
89
89
|
return changed > 0;
|
|
@@ -93,8 +93,8 @@ const setHashJson = (key, field, value) => tslib_es6.__awaiter(void 0, void 0, v
|
|
|
93
93
|
/**
|
|
94
94
|
* Get a hash field stored as JSON string.
|
|
95
95
|
*/
|
|
96
|
-
const getHashJson = (key, field) =>
|
|
97
|
-
return upstashConfig.withRedis((redis) =>
|
|
96
|
+
const getHashJson = (key, field) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
98
98
|
const payload = yield redis.hget(key, field);
|
|
99
99
|
if (!payload) {
|
|
100
100
|
return null;
|
|
@@ -110,8 +110,8 @@ const getHashJson = (key, field) => tslib_es6.__awaiter(void 0, void 0, void 0,
|
|
|
110
110
|
/**
|
|
111
111
|
* Get all hash fields.
|
|
112
112
|
*/
|
|
113
|
-
const getHashAll = (key) =>
|
|
114
|
-
return upstashConfig.withRedis((redis) =>
|
|
113
|
+
const getHashAll = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
115
115
|
const result = yield redis.hgetall(key);
|
|
116
116
|
return result !== null && result !== void 0 ? result : {};
|
|
117
117
|
}));
|
|
@@ -119,8 +119,8 @@ const getHashAll = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function
|
|
|
119
119
|
/**
|
|
120
120
|
* Remove a hash field.
|
|
121
121
|
*/
|
|
122
|
-
const deleteHashField = (key, field) =>
|
|
123
|
-
const result = yield upstashConfig.withRedis((redis) =>
|
|
122
|
+
const deleteHashField = (key, field) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
+
const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
124
124
|
const removed = yield redis.hdel(key, field);
|
|
125
125
|
return removed > 0;
|
|
126
126
|
}));
|
|
@@ -129,7 +129,7 @@ const deleteHashField = (key, field) => tslib_es6.__awaiter(void 0, void 0, void
|
|
|
129
129
|
/**
|
|
130
130
|
* Push values to a list. Returns list length or null if Redis is unavailable.
|
|
131
131
|
*/
|
|
132
|
-
const pushList = (key_1, values_1, ...args_1) =>
|
|
132
|
+
const pushList = (key_1, values_1, ...args_1) => tslib.__awaiter(void 0, [key_1, values_1, ...args_1], void 0, function* (key, values, direction = 'right') {
|
|
133
133
|
return upstashConfig.withRedis((redis) => {
|
|
134
134
|
if (values.length === 0) {
|
|
135
135
|
return redis.llen(key);
|
|
@@ -142,19 +142,19 @@ const pushList = (key_1, values_1, ...args_1) => tslib_es6.__awaiter(void 0, [ke
|
|
|
142
142
|
/**
|
|
143
143
|
* Pop a value from a list.
|
|
144
144
|
*/
|
|
145
|
-
const popList = (key_1, ...args_1) =>
|
|
145
|
+
const popList = (key_1, ...args_1) => tslib.__awaiter(void 0, [key_1, ...args_1], void 0, function* (key, direction = 'right') {
|
|
146
146
|
return upstashConfig.withRedis((redis) => direction === 'left' ? redis.lpop(key) : redis.rpop(key));
|
|
147
147
|
});
|
|
148
148
|
/**
|
|
149
149
|
* Get a range from a list.
|
|
150
150
|
*/
|
|
151
|
-
const rangeList = (key_1, ...args_1) =>
|
|
151
|
+
const rangeList = (key_1, ...args_1) => tslib.__awaiter(void 0, [key_1, ...args_1], void 0, function* (key, start = 0, stop = -1) {
|
|
152
152
|
return upstashConfig.withRedis((redis) => redis.lrange(key, start, stop));
|
|
153
153
|
});
|
|
154
154
|
/**
|
|
155
155
|
* Get list length.
|
|
156
156
|
*/
|
|
157
|
-
const listLength = (key) =>
|
|
157
|
+
const listLength = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
158
158
|
return upstashConfig.withRedis((redis) => redis.llen(key));
|
|
159
159
|
});
|
|
160
160
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var redis = require('@upstash/redis');
|
|
5
|
+
var qstash = require('@upstash/qstash');
|
|
6
6
|
|
|
7
7
|
let cachedRedis = null;
|
|
8
8
|
let cachedQstash = null;
|
|
@@ -47,7 +47,7 @@ const scheduleRedisHealthCheck = () => {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
const delayMs = getRedisHealthIntervalMinutes() * 60000;
|
|
50
|
-
redisHealthTimer = setTimeout(() =>
|
|
50
|
+
redisHealthTimer = setTimeout(() => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
51
51
|
redisHealthTimer = null;
|
|
52
52
|
if (!cachedRedis) {
|
|
53
53
|
return;
|
|
@@ -77,7 +77,7 @@ const scheduleRedisHealthCheck = () => {
|
|
|
77
77
|
}
|
|
78
78
|
}), delayMs);
|
|
79
79
|
};
|
|
80
|
-
const checkQstashHealth = (token) =>
|
|
80
|
+
const checkQstashHealth = (token) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
81
81
|
const response = yield fetch(getQstashHealthcheckUrl(), {
|
|
82
82
|
method: 'GET',
|
|
83
83
|
headers: {
|
|
@@ -94,7 +94,7 @@ const scheduleQstashHealthCheck = (token) => {
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
const delayMs = getQstashHealthIntervalMinutes() * 60000;
|
|
97
|
-
qstashHealthTimer = setTimeout(() =>
|
|
97
|
+
qstashHealthTimer = setTimeout(() => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
98
98
|
qstashHealthTimer = null;
|
|
99
99
|
if (!cachedQstash) {
|
|
100
100
|
return;
|
|
@@ -133,14 +133,14 @@ const scheduleQstashHealthCheck = (token) => {
|
|
|
133
133
|
const getRedis = () => {
|
|
134
134
|
return cachedRedis;
|
|
135
135
|
};
|
|
136
|
-
const ensureRedis = () =>
|
|
136
|
+
const ensureRedis = () => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
137
137
|
if (cachedRedis) {
|
|
138
138
|
return cachedRedis;
|
|
139
139
|
}
|
|
140
140
|
if (redisInitPromise) {
|
|
141
141
|
return redisInitPromise;
|
|
142
142
|
}
|
|
143
|
-
redisInitPromise = (() =>
|
|
143
|
+
redisInitPromise = (() => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
144
144
|
const { UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN } = process.env;
|
|
145
145
|
if (!isNonEmpty(UPSTASH_REDIS_REST_URL) || !isNonEmpty(UPSTASH_REDIS_REST_TOKEN)) {
|
|
146
146
|
if (!redisWarnedMissingEnv) {
|
|
@@ -157,7 +157,7 @@ const ensureRedis = () => tslib_es6.__awaiter(void 0, void 0, void 0, function*
|
|
|
157
157
|
return null;
|
|
158
158
|
}
|
|
159
159
|
try {
|
|
160
|
-
const client = new
|
|
160
|
+
const client = new redis.Redis({
|
|
161
161
|
url: UPSTASH_REDIS_REST_URL,
|
|
162
162
|
token: UPSTASH_REDIS_REST_TOKEN,
|
|
163
163
|
});
|
|
@@ -189,14 +189,14 @@ const ensureRedis = () => tslib_es6.__awaiter(void 0, void 0, void 0, function*
|
|
|
189
189
|
const getQstash = () => {
|
|
190
190
|
return cachedQstash;
|
|
191
191
|
};
|
|
192
|
-
const ensureQstash = () =>
|
|
192
|
+
const ensureQstash = () => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
193
193
|
if (cachedQstash) {
|
|
194
194
|
return cachedQstash;
|
|
195
195
|
}
|
|
196
196
|
if (qstashInitPromise) {
|
|
197
197
|
return qstashInitPromise;
|
|
198
198
|
}
|
|
199
|
-
qstashInitPromise = (() =>
|
|
199
|
+
qstashInitPromise = (() => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
200
200
|
const { QSTASH_TOKEN } = process.env;
|
|
201
201
|
if (!isNonEmpty(QSTASH_TOKEN)) {
|
|
202
202
|
if (!qstashWarnedMissingEnv) {
|
|
@@ -206,7 +206,7 @@ const ensureQstash = () => tslib_es6.__awaiter(void 0, void 0, void 0, function*
|
|
|
206
206
|
return null;
|
|
207
207
|
}
|
|
208
208
|
try {
|
|
209
|
-
const client = new
|
|
209
|
+
const client = new qstash.Client({ token: QSTASH_TOKEN });
|
|
210
210
|
yield checkQstashHealth(QSTASH_TOKEN);
|
|
211
211
|
cachedQstash = client;
|
|
212
212
|
scheduleQstashHealthCheck(QSTASH_TOKEN);
|
|
@@ -226,14 +226,14 @@ const ensureQstash = () => tslib_es6.__awaiter(void 0, void 0, void 0, function*
|
|
|
226
226
|
}))();
|
|
227
227
|
return qstashInitPromise;
|
|
228
228
|
});
|
|
229
|
-
const withRedis = (fn) =>
|
|
229
|
+
const withRedis = (fn) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
230
230
|
const redis = yield ensureRedis();
|
|
231
231
|
if (!redis) {
|
|
232
232
|
return null;
|
|
233
233
|
}
|
|
234
234
|
return fn(redis);
|
|
235
235
|
});
|
|
236
|
-
const withQstash = (fn) =>
|
|
236
|
+
const withQstash = (fn) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
237
237
|
const qstash = yield ensureQstash();
|
|
238
238
|
if (!qstash) {
|
|
239
239
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __awaiter } from '
|
|
2
|
-
import { Redis
|
|
3
|
-
import { Client } from '
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import { Redis } from '@upstash/redis';
|
|
3
|
+
import { Client } from '@upstash/qstash';
|
|
4
4
|
|
|
5
5
|
let cachedRedis = null;
|
|
6
6
|
let cachedQstash = null;
|
|
@@ -155,7 +155,7 @@ const ensureRedis = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
155
155
|
return null;
|
|
156
156
|
}
|
|
157
157
|
try {
|
|
158
|
-
const client = new
|
|
158
|
+
const client = new Redis({
|
|
159
159
|
url: UPSTASH_REDIS_REST_URL,
|
|
160
160
|
token: UPSTASH_REDIS_REST_TOKEN,
|
|
161
161
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var prisma = require('./prisma.js');
|
|
5
5
|
|
|
6
6
|
// 事务工具类,回滚时打印回滚日志
|
|
7
7
|
function runInTransaction(fn, operationName) {
|
|
8
|
-
return
|
|
8
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
9
9
|
const start = Date.now();
|
|
10
10
|
try {
|
|
11
11
|
return yield prisma.prisma.$transaction(fn);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var user_service = require('../database/user.service.js');
|
|
5
5
|
var subscription_service = require('../database/subscription.service.js');
|
|
6
6
|
var credit_service = require('../database/credit.service.js');
|
|
@@ -13,7 +13,7 @@ var creditInit = require('../../lib/credit-init.js');
|
|
|
13
13
|
const ANONYMOUS_INIT_LOCK_NAMESPACE = 92831;
|
|
14
14
|
class AnonymousAggregateService {
|
|
15
15
|
lockFingerprintInit(tx, fingerprintId) {
|
|
16
|
-
return
|
|
16
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
yield tx.$executeRaw `
|
|
18
18
|
SELECT pg_advisory_xact_lock(
|
|
19
19
|
${client.Prisma.raw(String(ANONYMOUS_INIT_LOCK_NAMESPACE))},
|
|
@@ -23,7 +23,7 @@ class AnonymousAggregateService {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
findLatestUserContextByFingerprintId(fingerprintId, tx) {
|
|
26
|
-
return
|
|
26
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
const existingUsers = yield user_service.userService.findListByFingerprintId(fingerprintId, tx);
|
|
28
28
|
if (existingUsers.length === 0) {
|
|
29
29
|
return null;
|
|
@@ -44,7 +44,7 @@ class AnonymousAggregateService {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
createAnonymousUser(fingerprintId, tx, options) {
|
|
47
|
-
return
|
|
47
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
48
48
|
const newUser = yield user_service.userService.createUser({
|
|
49
49
|
fingerprintId,
|
|
50
50
|
sourceRef: options === null || options === void 0 ? void 0 : options.sourceRef,
|
|
@@ -70,8 +70,8 @@ class AnonymousAggregateService {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
getOrCreateByFingerprintId(fingerprintId, options) {
|
|
73
|
-
return
|
|
74
|
-
return prismaTransactionUtil.runInTransaction((tx) =>
|
|
73
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
75
75
|
yield this.lockFingerprintInit(tx, fingerprintId);
|
|
76
76
|
const existingContext = yield this.findLatestUserContextByFingerprintId(fingerprintId, tx);
|
|
77
77
|
if (existingContext) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __awaiter } from '
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
2
|
import { userService } from '../database/user.service.mjs';
|
|
3
3
|
import { subscriptionService } from '../database/subscription.service.mjs';
|
|
4
4
|
import { creditService } from '../database/credit.service.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var constants = require('../database/constants.js');
|
|
5
5
|
require('../../prisma/prisma.js');
|
|
6
6
|
var prismaTransactionUtil = require('../../prisma/prisma-transaction-util.js');
|
|
@@ -11,8 +11,8 @@ require('@prisma/client');
|
|
|
11
11
|
|
|
12
12
|
class BillingAggregateService {
|
|
13
13
|
recordSubscriptionInitPayment(context) {
|
|
14
|
-
return
|
|
15
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
14
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
17
17
|
const now = new Date();
|
|
18
18
|
// 订阅截止时间统一为到期日最后1s
|
|
@@ -62,8 +62,8 @@ class BillingAggregateService {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
completeOneTimeCheckout(params) {
|
|
65
|
-
return
|
|
66
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
65
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
67
67
|
var _a;
|
|
68
68
|
const now = new Date();
|
|
69
69
|
yield transaction_service.transactionService.update(params.orderId, {
|
|
@@ -91,8 +91,8 @@ class BillingAggregateService {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
recordInitialInvoiceDetails(params) {
|
|
94
|
-
return
|
|
95
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
94
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
96
96
|
var _a, _b, _c;
|
|
97
97
|
yield transaction_service.transactionService.update(params.orderId, {
|
|
98
98
|
payInvoiceId: params.invoiceId,
|
|
@@ -106,8 +106,8 @@ class BillingAggregateService {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
recordSubscriptionRenewalPayment(context) {
|
|
109
|
-
return
|
|
110
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
109
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
111
111
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
112
112
|
yield transaction_service.transactionService.createTransaction({
|
|
113
113
|
userId: context.userId,
|
|
@@ -160,8 +160,8 @@ class BillingAggregateService {
|
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
recordInitialPaymentFailure(params) {
|
|
163
|
-
return
|
|
164
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
163
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
165
165
|
var _a, _b;
|
|
166
166
|
yield transaction_service.transactionService.updateStatus(params.orderId, constants.OrderStatus.FAILED, {
|
|
167
167
|
paymentStatus: constants.PaymentStatus.UN_PAID,
|
|
@@ -175,8 +175,8 @@ class BillingAggregateService {
|
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
recordRenewalPaymentFailure(context) {
|
|
178
|
-
return
|
|
179
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
178
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
180
180
|
var _a, _b, _c, _d, _e, _f;
|
|
181
181
|
yield transaction_service.transactionService.createTransaction({
|
|
182
182
|
userId: context.userId,
|
|
@@ -216,8 +216,8 @@ class BillingAggregateService {
|
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
syncSubscriptionFromStripe(params) {
|
|
219
|
-
return
|
|
220
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
219
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
221
221
|
if (params.isUserCancel) {
|
|
222
222
|
// 记录用户取消订阅的时间信息
|
|
223
223
|
yield transaction_service.transactionService.update(params.orderId, {
|
|
@@ -234,8 +234,8 @@ class BillingAggregateService {
|
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
processSubscriptionCancel(context) {
|
|
237
|
-
return
|
|
238
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
237
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
239
239
|
var _a;
|
|
240
240
|
// 更新订单, 记录取消信息
|
|
241
241
|
yield transaction_service.transactionService.update(context.orderId, {
|
|
@@ -250,8 +250,8 @@ class BillingAggregateService {
|
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
processSubscriptionRefund(context) {
|
|
253
|
-
return
|
|
254
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
253
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
254
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
255
255
|
var _a, _b;
|
|
256
256
|
const now = new Date();
|
|
257
257
|
yield transaction_service.transactionService.update(context.transaction.orderId, {
|
|
@@ -280,8 +280,8 @@ class BillingAggregateService {
|
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
processOneTimeRefund(context) {
|
|
283
|
-
return
|
|
284
|
-
yield prismaTransactionUtil.runInTransaction((tx) =>
|
|
283
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
yield prismaTransactionUtil.runInTransaction((tx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
285
285
|
var _a, _b;
|
|
286
286
|
const now = new Date();
|
|
287
287
|
yield transaction_service.transactionService.update(context.transaction.orderId, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __awaiter } from '
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
2
|
import { SubscriptionStatus, PaymentStatus, OrderStatus, TransactionType, PaySupplier, OperationType, CreditType } from '../database/constants.mjs';
|
|
3
3
|
import '../../prisma/prisma.mjs';
|
|
4
4
|
import { runInTransaction } from '../../prisma/prisma-transaction-util.mjs';
|