@dench.com/cli 3.11.18-staging.567 → 3.11.19-staging.578

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.
Files changed (2) hide show
  1. package/crm.ts +19 -2
  2. package/package.json +1 -1
package/crm.ts CHANGED
@@ -3966,12 +3966,20 @@ async function runExportCommand(ctx: CrmCliContext): Promise<void> {
3966
3966
  `crm export: duplicate entry ids detected (${all.length} rows, ${uniqueIds} unique). Export aborted.`,
3967
3967
  );
3968
3968
  }
3969
+ // When each row was added and last changed, so "added this week" can be
3970
+ // answered from the export alone.
3971
+ const isoTime = (value: unknown) =>
3972
+ typeof value === "number" && Number.isFinite(value)
3973
+ ? new Date(value).toISOString()
3974
+ : "";
3969
3975
  if (format === "csv") {
3970
3976
  const fields = Object.keys(all[0]?.fields ?? {});
3971
- const header = ["_id", ...fields].join(",");
3977
+ const header = ["_id", "_createdAt", "_updatedAt", ...fields].join(",");
3972
3978
  const lines = all.map((entry) => {
3973
3979
  const cells = [
3974
3980
  entry.id,
3981
+ isoTime(entry.createdAt),
3982
+ isoTime(entry.updatedAt),
3975
3983
  ...fields.map((f) => csvEscape(entry.fields[f])),
3976
3984
  ];
3977
3985
  return cells.join(",");
@@ -3980,7 +3988,16 @@ async function runExportCommand(ctx: CrmCliContext): Promise<void> {
3980
3988
  } else {
3981
3989
  for (const entry of all) {
3982
3990
  process.stdout.write(
3983
- `${JSON.stringify({ _id: entry.id, ...entry.fields })}\n`,
3991
+ `${JSON.stringify({
3992
+ _id: entry.id,
3993
+ ...(isoTime(entry.createdAt)
3994
+ ? { _createdAt: isoTime(entry.createdAt) }
3995
+ : {}),
3996
+ ...(isoTime(entry.updatedAt)
3997
+ ? { _updatedAt: isoTime(entry.updatedAt) }
3998
+ : {}),
3999
+ ...entry.fields,
4000
+ })}\n`,
3984
4001
  );
3985
4002
  }
3986
4003
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.11.18-staging.567",
3
+ "version": "3.11.19-staging.578",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {