@wrenautomation/aerie 0.4.1 → 0.4.3

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.
@@ -8786,83 +8786,6 @@ var init_area = __esm({
8786
8786
  }
8787
8787
  });
8788
8788
 
8789
- // src/core/edit.ts
8790
- function checks(cs, e, what) {
8791
- if (!e) return cs;
8792
- let out = cs.map((c) => ({ ...c }));
8793
- const at3 = (n) => {
8794
- const c = out[n - 1];
8795
- if (!c) throw new Error(`${what} #${n} does not exist (has ${out.length})`);
8796
- return c;
8797
- };
8798
- if (e.clear) out = [];
8799
- if (e.replace) {
8800
- const was = new Map(out.map((c) => [c.text.trim(), c.done]));
8801
- out = e.replace.map((text2) => ({ text: text2.trim(), done: was.get(text2.trim()) ?? false }));
8802
- }
8803
- for (const n of e.check ?? []) at3(n).done = true;
8804
- for (const n of e.uncheck ?? []) at3(n).done = false;
8805
- if (e.remove?.length) {
8806
- for (const n of e.remove) at3(n);
8807
- const drop = new Set(e.remove);
8808
- out = out.filter((_, i) => !drop.has(i + 1));
8809
- }
8810
- for (const text2 of e.add ?? []) out.push({ text: text2.trim(), done: false });
8811
- return out;
8812
- }
8813
- function applyEdit(t, e, now) {
8814
- const n = { ...t, extra: { ...t.extra } };
8815
- const set = (k, v) => {
8816
- if (v === void 0) return;
8817
- if (v === null || v === "") delete n[k];
8818
- else n[k] = v;
8819
- };
8820
- if (e.title !== void 0) {
8821
- if (!e.title.trim()) throw new Error("title is empty");
8822
- n.title = e.title.trim();
8823
- }
8824
- set("description", e.description);
8825
- if (e.status !== void 0) {
8826
- if (e.status !== t.status && e.status === "Done") n.closedAt = now;
8827
- if (e.status !== "Done") delete n.closedAt;
8828
- n.status = e.status;
8829
- }
8830
- set("priority", e.priority);
8831
- set("type", e.type);
8832
- set("milestone", e.milestone);
8833
- set("ordinal", e.ordinal);
8834
- set("parentId", e.parentId);
8835
- if (e.assignees) n.assignees = uniq(e.assignees.map((a) => a.trim()).filter(Boolean));
8836
- if (e.labels) n.labels = uniq(e.labels);
8837
- if (e.removeLabels) n.labels = n.labels.filter((l) => !e.removeLabels?.includes(l));
8838
- if (e.addLabels) n.labels = uniq([...n.labels, ...e.addLabels]);
8839
- if (e.clearDeps) n.dependencies = [];
8840
- if (e.addDeps) n.dependencies = uniq([...n.dependencies, ...e.addDeps]);
8841
- if (e.references) n.references = uniq(e.references);
8842
- n.ac = checks(n.ac, e.ac, "AC");
8843
- n.dod = checks(n.dod, e.dod, "DoD");
8844
- set("plan", e.plan);
8845
- set("plan", append(n.plan, e.appendPlan));
8846
- set("notes", e.notes);
8847
- set("notes", append(n.notes, e.appendNotes));
8848
- if (e.clearFinalSummary) delete n.finalSummary;
8849
- set("finalSummary", e.finalSummary);
8850
- set("finalSummary", append(n.finalSummary, e.appendFinalSummary));
8851
- if (e.comments?.length)
8852
- n.comments = [...n.comments, ...e.comments.map((c) => ({ ...c, created: now }))];
8853
- n.updatedAt = now;
8854
- return n;
8855
- }
8856
- var PARA, append, uniq;
8857
- var init_edit = __esm({
8858
- "src/core/edit.ts"() {
8859
- "use strict";
8860
- PARA = "\n\n";
8861
- append = (base, more) => more?.length ? [base, ...more].filter((x) => x?.trim()).join(PARA) : base;
8862
- uniq = (xs) => [...new Set(xs)];
8863
- }
8864
- });
8865
-
8866
8789
  // src/core/filter.ts
8867
8790
  function matches(t, f, ctx = {}) {
8868
8791
  const any = (want, v) => !want?.length || v !== void 0 && want.includes(v);
@@ -8968,7 +8891,7 @@ var init_task = __esm({
8968
8891
  });
8969
8892
 
8970
8893
  // src/core/fields.ts
8971
- var one, checks2, FIELDS, GROUP_KEYS;
8894
+ var one, checks, FIELDS, GROUP_KEYS;
8972
8895
  var init_fields = __esm({
8973
8896
  "src/core/fields.ts"() {
8974
8897
  "use strict";
@@ -8976,7 +8899,7 @@ var init_fields = __esm({
8976
8899
  init_filter();
8977
8900
  init_task();
8978
8901
  one = (v) => v ? [v] : [];
8979
- checks2 = (t) => {
8902
+ checks = (t) => {
8980
8903
  const all = [...t.ac, ...t.dod];
8981
8904
  return all.length ? [`${all.filter((c) => c.done).length}/${all.length}`] : [];
8982
8905
  };
@@ -9020,7 +8943,7 @@ var init_fields = __esm({
9020
8943
  },
9021
8944
  { key: "parent", label: "Parent", kind: "id", values: (t) => one(t.parentId), group: true },
9022
8945
  { key: "type", label: "Type", kind: "text", values: (t) => one(t.type), group: true },
9023
- { key: "checks", label: "Checks", kind: "progress", values: checks2 },
8946
+ { key: "checks", label: "Checks", kind: "progress", values: checks },
9024
8947
  {
9025
8948
  key: "createdAt",
9026
8949
  label: "Created",
@@ -9047,10 +8970,97 @@ var init_fields = __esm({
9047
8970
  }
9048
8971
  });
9049
8972
 
8973
+ // src/core/address.ts
8974
+ var init_address = __esm({
8975
+ "src/core/address.ts"() {
8976
+ "use strict";
8977
+ init_fields();
8978
+ init_filter();
8979
+ }
8980
+ });
8981
+
8982
+ // src/core/edit.ts
8983
+ function checks2(cs, e, what) {
8984
+ if (!e) return cs;
8985
+ let out = cs.map((c) => ({ ...c }));
8986
+ const at3 = (n) => {
8987
+ const c = out[n - 1];
8988
+ if (!c) throw new Error(`${what} #${n} does not exist (has ${out.length})`);
8989
+ return c;
8990
+ };
8991
+ if (e.clear) out = [];
8992
+ if (e.replace) {
8993
+ const was = new Map(out.map((c) => [c.text.trim(), c.done]));
8994
+ out = e.replace.map((text2) => ({ text: text2.trim(), done: was.get(text2.trim()) ?? false }));
8995
+ }
8996
+ for (const n of e.check ?? []) at3(n).done = true;
8997
+ for (const n of e.uncheck ?? []) at3(n).done = false;
8998
+ if (e.remove?.length) {
8999
+ for (const n of e.remove) at3(n);
9000
+ const drop = new Set(e.remove);
9001
+ out = out.filter((_, i) => !drop.has(i + 1));
9002
+ }
9003
+ for (const text2 of e.add ?? []) out.push({ text: text2.trim(), done: false });
9004
+ return out;
9005
+ }
9006
+ function applyEdit(t, e, now) {
9007
+ const n = { ...t, extra: { ...t.extra } };
9008
+ const set = (k, v) => {
9009
+ if (v === void 0) return;
9010
+ if (v === null || v === "") delete n[k];
9011
+ else n[k] = v;
9012
+ };
9013
+ if (e.title !== void 0) {
9014
+ if (!e.title.trim()) throw new Error("title is empty");
9015
+ n.title = e.title.trim();
9016
+ }
9017
+ set("description", e.description);
9018
+ if (e.status !== void 0) {
9019
+ if (e.status !== t.status && e.status === "Done") n.closedAt = now;
9020
+ if (e.status !== "Done") delete n.closedAt;
9021
+ n.status = e.status;
9022
+ }
9023
+ set("priority", e.priority);
9024
+ set("type", e.type);
9025
+ set("milestone", e.milestone);
9026
+ set("ordinal", e.ordinal);
9027
+ set("parentId", e.parentId);
9028
+ if (e.assignees) n.assignees = uniq(e.assignees.map((a) => a.trim()).filter(Boolean));
9029
+ if (e.labels) n.labels = uniq(e.labels);
9030
+ if (e.removeLabels) n.labels = n.labels.filter((l) => !e.removeLabels?.includes(l));
9031
+ if (e.addLabels) n.labels = uniq([...n.labels, ...e.addLabels]);
9032
+ if (e.clearDeps) n.dependencies = [];
9033
+ if (e.addDeps) n.dependencies = uniq([...n.dependencies, ...e.addDeps]);
9034
+ if (e.references) n.references = uniq(e.references);
9035
+ n.ac = checks2(n.ac, e.ac, "AC");
9036
+ n.dod = checks2(n.dod, e.dod, "DoD");
9037
+ set("plan", e.plan);
9038
+ set("plan", append(n.plan, e.appendPlan));
9039
+ set("notes", e.notes);
9040
+ set("notes", append(n.notes, e.appendNotes));
9041
+ if (e.clearFinalSummary) delete n.finalSummary;
9042
+ set("finalSummary", e.finalSummary);
9043
+ set("finalSummary", append(n.finalSummary, e.appendFinalSummary));
9044
+ if (e.comments?.length)
9045
+ n.comments = [...n.comments, ...e.comments.map((c) => ({ ...c, created: now }))];
9046
+ n.updatedAt = now;
9047
+ return n;
9048
+ }
9049
+ var PARA, append, uniq;
9050
+ var init_edit = __esm({
9051
+ "src/core/edit.ts"() {
9052
+ "use strict";
9053
+ PARA = "\n\n";
9054
+ append = (base, more) => more?.length ? [base, ...more].filter((x) => x?.trim()).join(PARA) : base;
9055
+ uniq = (xs) => [...new Set(xs)];
9056
+ }
9057
+ });
9058
+
9050
9059
  // src/core/index.ts
9051
9060
  var init_core2 = __esm({
9052
9061
  "src/core/index.ts"() {
9053
9062
  "use strict";
9063
+ init_address();
9054
9064
  init_area();
9055
9065
  init_edit();
9056
9066
  init_fields();