@runeditrun/rer 0.2.40 → 0.2.42

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/cli/contract.mjs CHANGED
@@ -12,7 +12,7 @@ const definitions = {
12
12
  verify: [[], 'Run the complete internal verification target.'],
13
13
  reset: [['--yes'], 'Confirmed removal of the declared local inventory only.'],
14
14
  deploy: [['--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret', '--rotate-secret'], 'Owner-account deployment and health; dry run performs local validation/build only. Builds and deploy hooks run with the checkout\'s local settings files moved aside, and a build output holding one (.dev.vars, .env) is refused. Declared secrets come from the environment or --env-file (an owned 0600 KEY=VALUE file); a new Worker gets the local setup owner and fresh generated secrets when they are not given. rer keeps the secrets it generates in .rer/deploy/ENVIRONMENT.secrets.env (0600) and reuses them on every redeploy; it refuses to generate a replacement for one a live Worker holds, and --rotate-secret NAME[,NAME] replaces them on purpose. After a healthy deploy rer claims the setup owner on the hosted app with the one-time setup token, then removes the token. --set-secret NAME (value from the environment or --env-file) and --unset-secret NAME change one secret of the deployed Worker without a build and record its new version. --remove --yes deletes what this environment\'s deploy record says rer created (Worker, D1, R2, KV, queues), reads back that each is gone, and touches nothing else. --site deploys the run site instead: an assets-only Worker on its custom domain with www redirected; with --dry-run it builds the site and prints the plan with no provider request. --demo deploys the hosted demo instead (deploy-demo.json): a front Worker on demo.<domain> giving each visitor their own signed-in, throwaway native Worker isolate of this seed with real public reads/checks and simulated external writes; --dry-run writes it to .rer/demo-host with no provider request; --demo --remove --yes deletes that demo (its Worker, demo.<domain> Custom Domain, each only while the record its deploy left proves it the demo\'s), reads back that each is gone, and is a no-op once it is.'],
15
- export: [['--target', '--output', '--origin', '--session-file'], 'Complete supported installation archive with integrity and exclusions.'],
15
+ export: [['--target', '--output', '--origin', '--session-file'], 'Complete supported archive of the local copy on this computer, with integrity and exclusions, written to --output. The hosted install cannot be exported yet: --origin or --target remote refuses (exit 2) before any effect and names the command that saves the hosted database.'],
16
16
  import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--output'], 'Confirmed atomic restore into an empty destination; --journal LATER_ARCHIVE also fences rows that installation erased since. Backup-only local v1 recovery requires --legacy-v1 --acknowledge-unverified-metadata and a new --output v2 archive; --journal requires normal v2 import.'],
17
17
  doctor: [[], 'Read-only installed tool, configuration and state diagnostics.'],
18
18
  describe: [[], 'Read-only description of actual command capabilities.'],
@@ -16,7 +16,7 @@ export async function deploymentRecord(root, options) {
16
16
  try { await access(path); }
17
17
  catch (error) {
18
18
  if (error.code !== 'ENOENT') throw error;
19
- const availableDeployments = (await environments(root)).map(environment => ({ environment, command: commandFor(options, environment) }));
19
+ const availableDeployments = (await heldDeployments(root)).map(({ environment }) => ({ environment, command: commandFor(options, environment) }));
20
20
  const held = availableDeployments.length
21
21
  ? `It holds:\n${availableDeployments.map(item => ` ${item.environment}: ${item.command}`).join('\n')}`
22
22
  : 'This checkout holds no deployment environments. Run it from the checkout that deployed it.';
@@ -26,7 +26,8 @@ export async function deploymentRecord(root, options) {
26
26
  return state;
27
27
  }
28
28
 
29
- async function environments(root) {
29
+ // The deployments this checkout holds: each environment with its owner-state record.
30
+ export async function heldDeployments(root) {
30
31
  let entries;
31
32
  try { entries = await readdir(await contained(root, '.rer/deploy', { optional: true })); }
32
33
  catch (error) { if (error.code === 'ENOENT') return []; throw error; }
@@ -36,10 +37,10 @@ async function environments(root) {
36
37
  const state = await hookState(root, environment);
37
38
  const path = await contained(root, state ?? recordPath(environment));
38
39
  const record = JSON.parse(await readFile(path, 'utf8'));
39
- return record?.kind === 'rer-deploy-owner-state' && record.environment === environment ? environment : undefined;
40
+ return record?.kind === 'rer-deploy-owner-state' && record.environment === environment ? { environment, record } : undefined;
40
41
  } catch { return undefined; } // An unrelated or broken file is not a held deployment.
41
42
  }));
42
- return held.filter(Boolean).sort();
43
+ return held.filter(Boolean).sort((a, b) => a.environment.localeCompare(b.environment));
43
44
  }
44
45
 
45
46
  function commandFor(options, environment) {
@@ -62,8 +62,12 @@ export async function resolvePersona(url, key, as, signal) {
62
62
  const response = await appFetch(url + '/__dev/personas', { headers: { [DEV_KEY_HEADER]: key }, signal: AbortSignal.any([signal, AbortSignal.timeout(10000)].filter(Boolean)) });
63
63
  if (!response.ok) { await response.body?.cancel(); throw refuse(`The application did not serve dev identity (HTTP ${response.status}). Check its local-only entry.`); }
64
64
  const personas = await response.json(), persona = personas.find(entry => entry.as === as);
65
- if (!persona) throw invalid(`Unknown dev persona ${as}. This app declares: ${personas.map(entry => entry.as).join(', ')}.`);
66
- return persona;
65
+ if (persona) return persona;
66
+ // The people rer can sign in as: each persona with its email, then every
67
+ // invited or active person in this checkout's local database by email.
68
+ const valid = personas.map(entry => entry.as === entry.email || !entry.email ? entry.as : `${entry.as} (${entry.email})`).join(', ');
69
+ if (!as.includes('@')) throw invalid(`Unknown dev persona ${as}. rer dev --as takes one of: ${valid}.`);
70
+ throw invalid(`No one with the email ${as} can sign in to this app locally. rer dev --as takes one of: ${valid}. Someone added only to the app's own records can sign in once the app invites them (its Invite action, which sends no mail locally); then run rer dev --as ${as} again.`);
67
71
  }
68
72
 
69
73
  // rer build refuses output that bundles the dev layer, naming the file.
@@ -1,8 +1,10 @@
1
- // The one line a finished export ends with: the archive, its size and what it holds.
2
- export function exportSummary({ output, bytes, tables } = {}) {
1
+ // The one line a finished export ends with: which copy it exported, the
2
+ // archive, its size and what it holds.
3
+ export function exportSummary({ target = 'local', origin, output, bytes, tables } = {}) {
3
4
  if (typeof output !== 'string' || !Number.isSafeInteger(bytes) || !Array.isArray(tables)) return undefined;
4
5
  const rows = tables.reduce((sum, table) => sum + (Number.isSafeInteger(table?.count) ? table.count : 0), 0);
5
- return `Exported ${output} (${size(bytes)}): ${counted(tables.length, 'table')}, ${counted(rows, 'row')}`;
6
+ const copy = target === 'remote' ? `the hosted install${origin ? ` at ${origin}` : ''}` : 'the local copy';
7
+ return `Exported ${copy} to ${output} (${size(bytes)}): ${counted(tables.length, 'table')}, ${counted(rows, 'row')}`;
6
8
  }
7
9
 
8
10
  const counted = (value, noun) => `${value.toLocaleString('en-US')} ${noun}${value === 1 ? '' : 's'}`;
@@ -0,0 +1,26 @@
1
+ import { heldDeployments } from './deployment-record.mjs';
2
+ import { invalid } from './errors.mjs';
3
+
4
+ // rer export reads only this computer's copy. A hosted address (--origin, or
5
+ // --target remote) names the hosted install, which rer cannot export yet: the
6
+ // portability export writes snapshot tables into the database it reads, so it
7
+ // never runs against a live hosted one. Refuse before any effect rather than
8
+ // save the local copy under the hosted install's name.
9
+ export async function refuseHostedExport(project, options) {
10
+ if (options.origin === undefined && options.target !== 'remote') return;
11
+ if (project.adapter?.portability?.remote === true) return;
12
+ const origin = options.origin === undefined ? undefined : new URL(options.origin).origin;
13
+ const held = await heldDeployments(project.root);
14
+ const matched = held.filter(({ record }) => origin !== undefined && record.receipt?.origin === origin);
15
+ const named = (matched.length ? matched : held).map(({ record }) => ({ databases: Object.keys(record.owned?.d1 ?? {}), buckets: Object.keys(record.owned?.r2 ?? {}) }));
16
+ const databases = named.flatMap(item => item.databases), buckets = named.flatMap(item => item.buckets);
17
+ const exports = (databases.length ? databases : ['DATABASE']).map(name => ` npx wrangler d1 export ${name} --remote --output exports/${name === 'DATABASE' ? 'hosted' : name}.sql`);
18
+ throw invalid([
19
+ `This exports the local copy. rer cannot export the hosted install${origin ? ` at ${origin}` : ''} yet, so nothing was exported. Keep the hosted install until you have saved its data.`,
20
+ `To export the hosted install's database, run this from this checkout with the Cloudflare credentials that deployed it (CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in the environment, or add --env-file FILE):`,
21
+ ...exports,
22
+ ...(databases.length ? [] : [' (npx wrangler d1 list names the hosted databases.)']),
23
+ ...(buckets.length ? [`Files the hosted install keeps in R2 (${buckets.join(', ')}) are not in that export.`] : []),
24
+ 'To export the local copy, run: rer export --output exports/local.rer',
25
+ ].join('\n'));
26
+ }
package/cli/main.mjs CHANGED
@@ -49,6 +49,8 @@ export async function main(argv = process.argv.slice(2)) {
49
49
  warnPlaceholderMarks(out, options, await checkoutPlaceholderMarks(project.root, project.descriptor.project));
50
50
  (await import('./site.mjs')).declaredSite(project);
51
51
  }
52
+ // A hosted address never exports this computer's copy under its name.
53
+ if (options.verb === 'export' && project.profile === 'first-party') await (await import('./hosted-export.mjs')).refuseHostedExport(project, options);
52
54
  if (options.verb === 'deploy' && !options.site && !options.demo && !options.remove && !options.setSecret && !options.unsetSecret) {
53
55
  const { deliveryDeclarationClauses } = await import('./delivery-declarations.mjs');
54
56
  const failures = (await deliveryDeclarationClauses(project.root)).filter(clause => !clause.ok);
@@ -1,13 +1,16 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { contained } from './project.mjs';
3
3
  import { refuse } from './errors.mjs';
4
- import { mailbox } from './parse.mjs';
4
+ import { parseAddress } from '../modules/mail/src/core/validation.mjs';
5
5
  import { deliveryDeclarationSources } from './delivery-declarations.mjs';
6
6
  import { validateRerConfig } from '../modules/mail/src/adapters/rer/contract.mjs';
7
7
 
8
8
  const providers = ['resend', 'sendgrid', 'cloudflare', 'rer'];
9
9
  const nativeCredential = { sendgrid: 'SENDGRID_API_KEY', resend: 'RESEND_API_KEY' };
10
10
  const present = value => typeof value === 'string' && Boolean(value.trim());
11
+ // The sender forms the mail runtime sends from: a bare address or "Display Name <address>".
12
+ const sender = value => { try { parseAddress(value); return true; } catch { return false; } };
13
+ const SENDER = 'MAIL_FROM (billing@example.com or Your Business <billing@example.com>)';
11
14
 
12
15
  // Packaging can declare inputs that a product's deploy adapter adds to the
13
16
  // root declaration later. Read that source contract, never arbitrary ambient
@@ -52,7 +55,7 @@ export async function productionMail(root, declaration, env) {
52
55
  if (provider === 'rer') try { validateRerConfig({ relayUrl: bindings.MAIL_RELAY_URL }); } catch { relaySelected = false; }
53
56
  const has = key => present(bindings[key]) || secrets.has(key) && live.includes(key);
54
57
  return [
55
- ...(!mailbox(bindings.MAIL_FROM) ? ['MAIL_FROM'] : []),
58
+ ...(!sender(bindings.MAIL_FROM) ? [SENDER] : []),
56
59
  ...(!credentialKeys.some(has) ? [declaredCredentials.join(' or ') || credentialKeys.join(' or ')] : []),
57
60
  ...(provider === 'cloudflare' && !has('MAIL_ACCOUNT_ID') ? ['MAIL_ACCOUNT_ID'] : []),
58
61
  ...(!relaySelected ? ['MAIL_RELAY_URL (assigned HTTPS relay URL)'] : []),
@@ -62,10 +65,10 @@ export async function productionMail(root, declaration, env) {
62
65
  return {
63
66
  declared: 'MAIL_PROVIDER' in bindings || publicInputs.has('MAIL_PROVIDER') || secrets.has('MAIL_API_KEY') || selected.length > 0,
64
67
  configured: (live = []) => routes.some(missing => missing(live).length === 0),
65
- canInspect: mailbox(bindings.MAIL_FROM) && routes.length > 0,
68
+ canInspect: sender(bindings.MAIL_FROM) && routes.length > 0,
66
69
  missing: routes.length ? routes.map(missing => missing([]).join(', ')).join(' or ') : [
67
70
  'MAIL_PROVIDER (resend, sendgrid, cloudflare or rer)',
68
- ...(!mailbox(bindings.MAIL_FROM) ? ['MAIL_FROM'] : []),
71
+ ...(!sender(bindings.MAIL_FROM) ? [SENDER] : []),
69
72
  'MAIL_API_KEY',
70
73
  ].join(', '),
71
74
  };
package/cli/transfers.mjs CHANGED
@@ -29,7 +29,7 @@ export async function transfer(project, options, signal, custody) {
29
29
  await located.unserved(); await legacyOutput?.unserved();
30
30
  const result=await api[direction]({ root: project.root, target, path, journal, origin: options.origin, sessionFile, signal, platform:options.platform, legacyRecovery, ...custody });
31
31
  // The archive's size, for the line a finished export ends with.
32
- if(direction==='export')return {...result,output:result.output??relative(project.root,path),bytes:(await stat(path)).size};
32
+ if(direction==='export')return {...result,target,...(target==='remote'&&options.origin?{origin:new URL(options.origin).origin}:{}),output:result.output??relative(project.root,path),bytes:(await stat(path)).size};
33
33
  if(direction==='import' && target==='local' && (await localDependencyLinks(project.root)).some(link=>link.needs_relink)) {
34
34
  custody.store.report('Imported provider links need fresh approval. Run rer setup with RER_LINK_TOKEN_FILE to re-link this installation.');
35
35
  return {...result,needsRelink:true,nextCommand:'rer setup'};
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.42
4
+
5
+ - **`rer export` never exports the local copy under a hosted address.** `rer export --origin <hosted address>` used to ignore the address and export this computer's books, so an owner who believed the hosted books were saved could take them down and lose them. Now `--origin` or `--target remote` stops before anything runs (exit 2) and saves nothing. The message says this exports only the local copy and to keep the hosted install until its data is saved. It also names the command that exports each hosted database the checkout deployed, run with the Cloudflare credentials that deployed it: `npx wrangler d1 export <database> --remote --output exports/<database>.sql`. It lists the R2 buckets that command does not cover. A finished export's last line names the copy: "Exported the local copy to exports/x.rer (…)". RUN-LOCALLY.md now says to save the hosted data this way before `rer deploy --remove --yes` (#194).
6
+ - **`MAIL_FROM` takes a display name.** `rer deploy` accepts `MAIL_FROM=Your Business <billing@example.com>`, quoted or not, as well as a bare address. These are the forms the mail runtime sends from. An invalid sender names both accepted forms instead of only "missing or invalid: MAIL_FROM" (#194).
7
+ - **`rer dev --as <email>` names the people it takes.** An email that is no one in the local database no longer gets "Unknown dev persona". The message lists every persona with its email, and every invited or active person. It also says that someone added only to the app's own records can sign in once the app invites them, which sends no mail locally (#194).
8
+
9
+ ## 0.2.41
10
+
11
+ - **A run site's custom-domain readback waits for the domains to go live.** After `rer deploy --site` attaches its custom domains, it now polls the zone's Custom Domain list inside the deploy's readiness window until every hostname is listed on the site's Worker. The wait starts at 2 seconds and doubles up to 10 seconds. A hostname already on another Worker is still refused at once. A hostname still missing when the window ends fails as `domain-readback-mismatch` and names it. Before, the deploy read the list once, so a new zone's normal lag failed a deploy that would have gone live (#183).
12
+ - **A native demo's start passes the visitor's address to the seed.** When a native hosted demo starts, its seeding request to the seed's `/health` now carries `cf-connecting-ip` with the visitor's client address, as every later request does. Seeds that admit requests by client address, as Dial does, now start without workarounds in the seed (#188).
13
+ - **Base's docs lead with the one-line start.** The foundation template's README, ONBOARDING and OPERATIONS, and RUN-LOCALLY.md in the default seed and the export, now open with `npx -y @runeditrun/rer dev just-every/<repo>`. They give `rer setup` for setting up without starting, and the installer form `curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev just-every/<repo>` for a machine without Node 22. Composed editions name their own `run-<edition>` repository (#185).
14
+ - **The publication scan accepts rer-project.json alone.** A seed's destination is valid with rer-project.json alone, edition.json alone, or both. Each manifest that is present binds its id, and rer-project.json also binds `sourceRepository`. Before, the 13 seeds whose edition.json was removed in the rer-project.json rollout failed `publish-check` with `destination.invalid` (#187).
15
+
3
16
  ## 0.2.40
4
17
 
5
18
  - **The /contract clause table keeps clause IDs whole.** A clause ID or kind never breaks across lines. The ID column is sized from the longest clause ID in the contract, so a long ID like `DEPENDENCY-001` fits on one line. Titles wrap only between words, and only evidence paths and gap text may break inside a word. The kind now sits under the clause ID instead of in a column of its own.
@@ -53,7 +53,7 @@ export class NativeDemo extends DurableObject {
53
53
  if (claimed.status !== 303) throw new Error(`owner-claim-${claimed.status}: ${(await claimed.text()).slice(0, 500)}`);
54
54
  await claimed.body?.cancel();
55
55
  const cookies = claimed.headers.getSetCookie();
56
- const seeded = await app.fetch(new Request(origin + '/health', { headers: { cookie: cookies.map(cookie => cookie.split(';')[0]).join('; ') } }));
56
+ const seeded = await app.fetch(new Request(origin + '/health', { headers: { 'cf-connecting-ip': clientIp, cookie: cookies.map(cookie => cookie.split(';')[0]).join('; ') } }));
57
57
  await seeded.arrayBuffer();
58
58
  if (!seeded.ok) throw new Error(`demo-seed-${seeded.status}`);
59
59
  if (this.state?.phase !== 'starting') throw new Error('demo-ended-during-start');
@@ -56,6 +56,29 @@ export async function waitForSiteUpload({ api, worker, versionId, fingerprint, p
56
56
  throw timeout();
57
57
  }
58
58
 
59
+ /** A new zone's Custom Domain list lags the attach. Poll it inside the deploy's
60
+ * readiness window until every hostname is listed on the kit's Worker. A hostname
61
+ * on another Worker is refused at once; one still unlisted at the deadline fails
62
+ * naming it. */
63
+ export async function waitForSiteDomains({ api, zoneId, worker, hostnames, window }) {
64
+ const bounded = readinessAPI(api, window, 'domain-readback-mismatch');
65
+ const mismatch = hostname => Object.assign(new Error('domain-readback-mismatch'), { resource: `domain:${hostname}` });
66
+ let delay = 2000, missing = hostnames[0];
67
+ while (window.remaining() > 0) {
68
+ let domains;
69
+ try { domains = await bounded.request(`/workers/domains?zone_id=${zoneId}`); }
70
+ catch (error) { if (window.remaining() <= 0 || error.name === 'TimeoutError') throw mismatch(missing); throw error; }
71
+ assert(Array.isArray(domains), 'invalid-domain-list');
72
+ const foreign = hostnames.find(hostname => domains.some(row => row?.hostname === hostname && row.service !== worker));
73
+ if (foreign) throw mismatch(foreign);
74
+ missing = hostnames.find(hostname => !domains.some(row => row?.hostname === hostname));
75
+ if (!missing) return domains;
76
+ await window.sleep(Math.min(delay, window.remaining()));
77
+ delay = Math.min(delay * 2, 10000);
78
+ }
79
+ throw mismatch(missing);
80
+ }
81
+
59
82
  /** Only provider UUIDs and kit fingerprints are safe to include in CLI output. */
60
83
  export function siteReadbackSummary(error) {
61
84
  if (error.message !== 'site-upload-timeout') return '';
@@ -5,7 +5,7 @@ import { ownerWorkerName } from './owner.mjs';
5
5
  import { uploadAssets, workerOrigin } from './worker.mjs';
6
6
  import { readinessWindow, readinessAPI } from './readiness-window.mjs';
7
7
  import { uploadVersionId } from './uploaded-worker.mjs';
8
- import { ownedSiteVersion, waitForSiteUpload } from './site-readback.mjs';
8
+ import { ownedSiteVersion, waitForSiteDomains, waitForSiteUpload } from './site-readback.mjs';
9
9
  export { servedVersion, siteReadbackSummary } from './site-readback.mjs';
10
10
 
11
11
  /* A seed's run site (run-<seed>.com): the folder `rer build --site` writes,
@@ -113,8 +113,7 @@ export async function siteDeploy({ api, plan, files, receiptPath, readiness = {}
113
113
  }
114
114
  // Readback: the kit's Worker live and both domains on it.
115
115
  await readback();
116
- const domains = await api.request(`/workers/domains?zone_id=${zone.id}`);
117
- for (const hostname of plan.hostnames) assert(domains.some(row => row.hostname === hostname && row.service === plan.worker), 'domain-readback-mismatch');
116
+ await waitForSiteDomains({ api, zoneId: zone.id, worker: plan.worker, hostnames: plan.hostnames, window });
118
117
  const receipt = { worker: plan.worker, domain: plan.domain, zoneId: zone.id, fingerprint, files: files.length, hostnames: plan.hostnames, redirect: plan.redirects[0] };
119
118
  await writeReceipt(receiptPath, receipt);
120
119
  return { origin: `https://${plan.domain}`, receipt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.40",
3
+ "version": "0.2.42",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -63,17 +63,21 @@ def destination(history, project=None, repository=None):
63
63
  if not present:
64
64
  identity(project)
65
65
  return None # Legacy sources retain strict reference inspection.
66
- documents = []
66
+ # Either manifest alone, or both, declares the destination; each present one binds.
67
+ documents = {}
67
68
  for name in MANIFESTS:
68
- entry = named.get(name)
69
+ if name not in named:
70
+ continue
71
+ entry = named[name]
69
72
  if not ordinary_document(entry):
70
73
  raise ValueError('destination manifest must be an ordinary committed file')
71
74
  document = json.loads(history.blob(entry['oid']), object_pairs_hook=unique_object,
72
75
  parse_constant=reject_constant)
73
76
  if not isinstance(document, dict):
74
77
  raise ValueError('destination manifest must be an object')
75
- documents.append(document)
76
- edition, project_document = documents
78
+ documents[name] = document
79
+ edition = documents.get('edition.json', {})
80
+ project_document = documents.get('rer-project.json')
77
81
  if 'identityKind' in edition:
78
82
  logical, invalid = tree_identity(history, named.values())
79
83
  if invalid or logical is None or project != logical:
@@ -84,9 +88,10 @@ def destination(history, project=None, repository=None):
84
88
  repository_value = repository_identity
85
89
  else:
86
90
  project_value = identity(project)
87
- project_values = [identity(edition.get('id')), identity(project_document.get('projectId'))]
91
+ project_values = [identity(document.get(FIELDS[name])) for name, document in documents.items()]
88
92
  repository_value = lambda value: identity(value, url=True)
89
- repository_values = [repository_value(project_document.get('sourceRepository'))]
93
+ repository_values = ([] if project_document is None else
94
+ [repository_value(project_document.get('sourceRepository'))])
90
95
  if 'custody' in edition:
91
96
  custody = edition['custody']
92
97
  if not isinstance(custody, dict):