@dooer/dooer-test-env 1.1.0 → 1.2.1

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/lib/account.js CHANGED
@@ -7,6 +7,7 @@
7
7
  // - service_accounts.companies2users the given user linked as role 'Owner'
8
8
  // - service_accounts.subscriptions the same active set Ghost Inspector has on staging
9
9
  // - service_accounts."partnerOrganization" the org placed under partner `dooer` by default
10
+ // - service_accounts."tosAcceptance" the current Terms of Service pre-accepted (so sumify doesn't block)
10
11
  // It does NOT add customer data (ledger, documents, tasks, …) — the account starts empty.
11
12
 
12
13
  const crypto = require('crypto')
@@ -117,6 +118,19 @@ async function createAccount({ local, name, ownerUserId, execute = false } = {})
117
118
  VALUES ($1,$2,$3,now(),now())`,
118
119
  [uuid(), partner.rows[0].id, orgId]
119
120
  )
121
+ // Pre-accept the current Terms of Service so the account is ready to use (sumify otherwise prompts and
122
+ // blocks). Accept every active tos (usedFrom passed, not yet ended), acceptedBy the owner.
123
+ const activeTos = await client.query(
124
+ 'SELECT id FROM service_accounts.tos WHERE "usedFrom" <= now() AND ("usedTo" IS NULL OR "usedTo" > now())'
125
+ )
126
+ for (const row of activeTos.rows) {
127
+ await client.query(
128
+ `INSERT INTO service_accounts."tosAcceptance" (id, "tosId", "organizationId", "acceptedBy", "createdAt", "updatedAt")
129
+ VALUES ($1,$2,$3,$4,now(),now())`,
130
+ [uuid(), row.id, orgId, ownerUserId]
131
+ )
132
+ }
133
+ plan.tosAccepted = activeTos.rowCount
120
134
  await client.query('COMMIT')
121
135
  return plan
122
136
  } catch (e) {
@@ -99,6 +99,7 @@ module.exports = {
99
99
  console.log(` owner: ${argv.owner} (${res.owner}) — role Owner, user_type '${res.ownerType}'`)
100
100
  console.log(` partner: ${res.partner}`)
101
101
  console.log(` subscriptions: ${SUBSCRIPTION_TYPES.join(', ')} (active)`)
102
+ console.log(` TOS: ${res.tosAccepted} version(s) pre-accepted`)
102
103
  }
103
104
  if (res.warning) console.log(chalk.yellow(`\n⚠ ${res.warning}`))
104
105
  },
@@ -309,6 +309,13 @@ function rewriteBrowserUrls(env, portMap) {
309
309
  return env
310
310
  }
311
311
 
312
+ // Legacy service-name aliases the real stack still honours (a service registers/answers under an old name
313
+ // too). We reproduce them as Docker network aliases on the real service's container, so a caller resolving
314
+ // the old name (e.g. via @dooer/service discovery) reaches the right container instead of ENOTFOUND.
315
+ const SERVICE_ALIASES = {
316
+ 'service-closing': ['service-periods'], // service-periods is a legacy alias for service-closing (Jimmy 2026-09-03)
317
+ }
318
+
312
319
  // Turn the parsed manifests into the compose object.
313
320
  function buildCompose(services, frontends, { profile } = {}) {
314
321
  const wantedSvc = profile ? services.filter((s) => profilesFor(s.name).includes(profile)) : services
@@ -327,6 +334,9 @@ function buildCompose(services, frontends, { profile } = {}) {
327
334
  environment: rewriteBrowserUrls({ ...buildServiceEnv(svc), ...(SERVICE_ENV_OVERRIDES[svc.name] || {}) }, portMap),
328
335
  // publish the GraphQL gateway on the host so the frontends' browsers can reach it at localhost
329
336
  ...(svc.name === 'service-graphql' ? { ports: [`${GATEWAY_HOST_PORT}:3000`] } : {}),
337
+ // legacy-name DNS aliases (e.g. service-periods → service-closing), so callers resolving the old name
338
+ // reach this container on the compose network.
339
+ ...(SERVICE_ALIASES[svc.name] ? { networks: { default: { aliases: SERVICE_ALIASES[svc.name] } } } : {}),
330
340
  depends_on: ['postgres', 'redis', 'discovery-router'],
331
341
  profiles: profilesFor(svc.name),
332
342
  restart: 'unless-stopped',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dooer/dooer-test-env",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Run the whole Dooer backend locally (staging DB minus customers), copy/purge customers between environments, and shred — one CLI.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": "Dooer/cli-dooer-test-env",