tempest.games 0.2.68 → 0.2.70

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/app/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>TEMPEST</title>
8
- <script type="module" crossorigin src="/assets/index-t5Kphr7m.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BQfBw87O.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DZ_4vJcE.css">
10
10
  </head>
11
11
  <body>
@@ -37418,14 +37418,14 @@ function get(obj, path3) {
37418
37418
  return obj;
37419
37419
  }
37420
37420
  function numberToLetterSequence(num, baseChar = "a", base = 26) {
37421
- const digits = [];
37421
+ const digits2 = [];
37422
37422
  do {
37423
37423
  num -= 1;
37424
- digits.push(num % base);
37424
+ digits2.push(num % base);
37425
37425
  num = num / base >> 0;
37426
37426
  } while (num > 0);
37427
37427
  const baseCode = baseChar.charCodeAt(0);
37428
- return digits.reverse().map((n3) => String.fromCharCode(baseCode + n3)).join("");
37428
+ return digits2.reverse().map((n3) => String.fromCharCode(baseCode + n3)).join("");
37429
37429
  }
37430
37430
  function numberToRoman(num) {
37431
37431
  return [...num + ""].map((n3) => +n3).reverse().map((v4, i2) => v4 % 5 < 4 ? (v4 < 5 ? "" : V4[i2]) + I3[i2].repeat(v4 % 5) : I3[i2] + (v4 < 5 ? V4[i2] : I3[i2 + 1])).reverse().join("");
@@ -50206,7 +50206,9 @@ var markDone = (store, key) => {
50206
50206
  }
50207
50207
  store.operation.done.add(key);
50208
50208
  };
50209
- function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, stateIsNewlyCreated, family) {
50209
+ function dispatchOrDeferStateUpdate(target, state, proto, stateIsNewlyCreated, family) {
50210
+ const { oldValue, newValue } = proto;
50211
+ const hasOldValue = `oldValue` in proto;
50210
50212
  const token = deposit(state);
50211
50213
  if (stateIsNewlyCreated && family) {
50212
50214
  state.subject.next({ newValue });
@@ -50239,10 +50241,14 @@ function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, state
50239
50241
  return;
50240
50242
  }
50241
50243
  const { key, subject, type } = state;
50242
- const update = {
50243
- oldValue: isTransceiver(oldValue) ? oldValue.READONLY_VIEW : oldValue,
50244
- newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue
50245
- };
50244
+ let update;
50245
+ if (hasOldValue)
50246
+ update = {
50247
+ oldValue: isTransceiver(oldValue) ? oldValue.READONLY_VIEW : oldValue,
50248
+ newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue
50249
+ };
50250
+ else
50251
+ update = { newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue };
50246
50252
  if (isRootStore(target)) {
50247
50253
  switch (type) {
50248
50254
  case `mutable_atom`:
@@ -50278,13 +50284,29 @@ function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, state
50278
50284
  }
50279
50285
  }
50280
50286
  }
50287
+ var UNSET = Symbol(`UNSET`);
50281
50288
  var setAtom = (target, atom, next) => {
50282
- const oldValue = readOrComputeValue(target, atom, `mut`);
50283
- let newValue = become(next, oldValue);
50289
+ let oldValue;
50290
+ let newValue;
50291
+ if (isFn(next)) {
50292
+ const prev = readOrComputeValue(target, atom, `mut`);
50293
+ oldValue = prev;
50294
+ newValue = next(prev);
50295
+ } else {
50296
+ if (target.valueMap.has(atom.key))
50297
+ oldValue = readFromCache(target, atom, `mut`);
50298
+ else if (atom.type === `atom` && !isFn(atom.default))
50299
+ oldValue = atom.default;
50300
+ else
50301
+ oldValue = UNSET;
50302
+ newValue = next;
50303
+ }
50284
50304
  target.logger.info(`\u2B50`, `atom`, atom.key, `setting value`, newValue);
50285
50305
  newValue = writeToCache(target, atom, newValue);
50286
50306
  markDone(target, atom.key);
50287
50307
  evictDownstreamFromAtom(target, atom);
50308
+ if (oldValue === UNSET)
50309
+ return { newValue };
50288
50310
  return {
50289
50311
  oldValue,
50290
50312
  newValue
@@ -68040,36 +68062,38 @@ function customAlphabet(alphabet, size2 = 21) {
68040
68062
  return customRandom(alphabet, size2, random);
68041
68063
  }
68042
68064
 
68043
- // src/library/alpha-rand.ts
68065
+ // src/library/rand.ts
68044
68066
  var alphabet = `abcdefghijklmnopqrstuvwxyz`;
68045
68067
  var alphaRand = customAlphabet(alphabet, 6);
68068
+ var digits = `0123456789`;
68069
+ var digitRand = customAlphabet(digits, 6);
68046
68070
 
68047
68071
  // src/backend/account-actions.ts
68048
68072
  function genAccountActionCode() {
68049
- return alphaRand(4) + `_` + alphaRand(4);
68073
+ return digitRand(6);
68050
68074
  }
68051
68075
  function summarizeAccountAction({
68052
68076
  action,
68053
68077
  username,
68054
68078
  oneTimeCode
68055
68079
  }) {
68080
+ let subjectInternal;
68081
+ let summary;
68056
68082
  switch (action) {
68057
68083
  case `confirmEmail`:
68058
- return {
68059
- subject: `Welcome`,
68060
- summary: `${oneTimeCode} is your one-time code to set up your account.`
68061
- };
68084
+ subjectInternal = `Welcome to Tempest!`;
68085
+ summary = `Your one-time code to set up your account.`;
68086
+ break;
68062
68087
  case `resetPassword`:
68063
- return {
68064
- subject: `Approve password reset?`,
68065
- summary: `${oneTimeCode} is your one-time code to make a new password.`
68066
- };
68088
+ subjectInternal = `Approve password reset?`;
68089
+ summary = `Your one-time code to make a new password.`;
68090
+ break;
68067
68091
  case `signIn`:
68068
- return {
68069
- subject: `Welcome back, ${username}`,
68070
- summary: `${oneTimeCode} is your one-time code to get signed in.`
68071
- };
68092
+ subjectInternal = `Welcome back, ${username}!`;
68093
+ summary = `Your one-time code to get signed in.`;
68072
68094
  }
68095
+ const subjectExternal = `${oneTimeCode} \u2190 ${subjectInternal}`;
68096
+ return { subjectExternal, subjectInternal, summary };
68073
68097
  }
68074
68098
 
68075
68099
  // ../../node_modules/.pnpm/resend@6.4.1_@react-email+render@1.4.0_react-dom@19.2.0_react@19.2.0__react@19.2.0_/node_modules/resend/dist/index.mjs
@@ -82289,7 +82313,7 @@ function tempest(props) {
82289
82313
  import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
82290
82314
  var FRONTEND_ORIGIN = JSON.parse(process.env[`FRONTEND_ORIGINS`])[0] ?? ``;
82291
82315
  function ConfirmAccountAction({
82292
- subject,
82316
+ subjectInternal: subject,
82293
82317
  summary,
82294
82318
  oneTimeCode,
82295
82319
  baseUrl: baseUrl2 = FRONTEND_ORIGIN
@@ -82373,14 +82397,14 @@ function ConfirmAccountAction({
82373
82397
  }, undefined, false, undefined, this),
82374
82398
  /* @__PURE__ */ jsxDEV2(Text3, {
82375
82399
  style: text2,
82376
- children: "If you didn't request this email, there's nothing to worry about, you can safely ignore it."
82400
+ children: "If you didn't request this email, you can safely ignore it."
82377
82401
  }, undefined, false, undefined, this),
82378
82402
  /* @__PURE__ */ jsxDEV2(Section, {
82379
82403
  style: footerLogos,
82380
82404
  children: /* @__PURE__ */ jsxDEV2(Text3, {
82381
82405
  style: footerText,
82382
82406
  children: [
82383
- "@2022 Tempest Games, LLC",
82407
+ "@2025 Tempest Games, LLC",
82384
82408
  /* @__PURE__ */ jsxDEV2("br", {}, undefined, false, undefined, this),
82385
82409
  /* @__PURE__ */ jsxDEV2("br", {}, undefined, false, undefined, this),
82386
82410
  "ISC License"
@@ -82394,10 +82418,14 @@ function ConfirmAccountAction({
82394
82418
  ]
82395
82419
  }, undefined, true, undefined, this);
82396
82420
  }
82421
+ var PREVIEW_CODE_ONLY = genAccountActionCode();
82397
82422
  ConfirmAccountAction.PreviewProps = {
82398
- subject: `Welcome`,
82399
- summary: `Your one-time code is: 1234567890`,
82400
- oneTimeCode: genAccountActionCode(),
82423
+ ...summarizeAccountAction({
82424
+ username: `tiny_dog`,
82425
+ oneTimeCode: PREVIEW_CODE_ONLY,
82426
+ action: `confirmEmail`
82427
+ }),
82428
+ oneTimeCode: PREVIEW_CODE_ONLY,
82401
82429
  baseUrl: `https://tempest.games`
82402
82430
  };
82403
82431
  var ConfirmAccountAction_default = ConfirmAccountAction;
@@ -82473,7 +82501,7 @@ async function sendEmailToConfirmAccountAction({
82473
82501
  oneTimeCode,
82474
82502
  baseUrl: baseUrl2
82475
82503
  }) {
82476
- const { subject, summary } = summarizeAccountAction({
82504
+ const { subjectExternal, subjectInternal, summary } = summarizeAccountAction({
82477
82505
  username,
82478
82506
  action,
82479
82507
  oneTimeCode
@@ -82482,9 +82510,9 @@ async function sendEmailToConfirmAccountAction({
82482
82510
  await resend.emails.send({
82483
82511
  from: `Tempest Games <noreply@tempest.games>`,
82484
82512
  to: to4,
82485
- subject,
82513
+ subject: subjectExternal,
82486
82514
  react: /* @__PURE__ */ jsxDEV3(ConfirmAccountAction_default, {
82487
- subject,
82515
+ subjectInternal,
82488
82516
  summary,
82489
82517
  oneTimeCode,
82490
82518
  baseUrl: baseUrl2
@@ -2056,7 +2056,9 @@ var markDone = (store, key) => {
2056
2056
  }
2057
2057
  store.operation.done.add(key);
2058
2058
  };
2059
- function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, stateIsNewlyCreated, family) {
2059
+ function dispatchOrDeferStateUpdate(target, state, proto, stateIsNewlyCreated, family) {
2060
+ const { oldValue, newValue } = proto;
2061
+ const hasOldValue = `oldValue` in proto;
2060
2062
  const token = deposit(state);
2061
2063
  if (stateIsNewlyCreated && family) {
2062
2064
  state.subject.next({ newValue });
@@ -2089,10 +2091,14 @@ function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, state
2089
2091
  return;
2090
2092
  }
2091
2093
  const { key, subject, type } = state;
2092
- const update = {
2093
- oldValue: isTransceiver(oldValue) ? oldValue.READONLY_VIEW : oldValue,
2094
- newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue
2095
- };
2094
+ let update;
2095
+ if (hasOldValue)
2096
+ update = {
2097
+ oldValue: isTransceiver(oldValue) ? oldValue.READONLY_VIEW : oldValue,
2098
+ newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue
2099
+ };
2100
+ else
2101
+ update = { newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue };
2096
2102
  if (isRootStore(target)) {
2097
2103
  switch (type) {
2098
2104
  case `mutable_atom`:
@@ -2128,13 +2134,29 @@ function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, state
2128
2134
  }
2129
2135
  }
2130
2136
  }
2137
+ var UNSET = Symbol(`UNSET`);
2131
2138
  var setAtom = (target, atom, next) => {
2132
- const oldValue = readOrComputeValue(target, atom, `mut`);
2133
- let newValue = become(next, oldValue);
2139
+ let oldValue;
2140
+ let newValue;
2141
+ if (isFn(next)) {
2142
+ const prev = readOrComputeValue(target, atom, `mut`);
2143
+ oldValue = prev;
2144
+ newValue = next(prev);
2145
+ } else {
2146
+ if (target.valueMap.has(atom.key))
2147
+ oldValue = readFromCache(target, atom, `mut`);
2148
+ else if (atom.type === `atom` && !isFn(atom.default))
2149
+ oldValue = atom.default;
2150
+ else
2151
+ oldValue = UNSET;
2152
+ newValue = next;
2153
+ }
2134
2154
  target.logger.info(`\u2B50`, `atom`, atom.key, `setting value`, newValue);
2135
2155
  newValue = writeToCache(target, atom, newValue);
2136
2156
  markDone(target, atom.key);
2137
2157
  evictDownstreamFromAtom(target, atom);
2158
+ if (oldValue === UNSET)
2159
+ return { newValue };
2138
2160
  return {
2139
2161
  oldValue,
2140
2162
  newValue