@fragment-dev/cli 2026.11.13 → 2026.11.14-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.
Files changed (87) hide show
  1. package/README.md +42 -0
  2. package/dist/{chunk-6H5VEWMH.js → chunk-2EMLJCCB.js} +1 -1
  3. package/dist/{chunk-V3LLFTBC.js → chunk-2YTWJRNP.js} +1 -1
  4. package/dist/{chunk-JTGVX5GX.js → chunk-4AUNUT7Z.js} +52 -9
  5. package/dist/{chunk-D46OZVDM.js → chunk-4EBR67QU.js} +2 -2
  6. package/dist/{chunk-CTS34CX4.js → chunk-4GSTQ6O4.js} +2 -2
  7. package/dist/{chunk-F5CCJ6FF.js → chunk-4KJOZZJJ.js} +1 -1
  8. package/dist/{chunk-6SLKFJ3R.js → chunk-57YVQI74.js} +2 -2
  9. package/dist/{chunk-TGEDLZAO.js → chunk-5Q5FY4NG.js} +3 -3
  10. package/dist/{chunk-6MYCJAJL.js → chunk-67N5LE4N.js} +2 -2
  11. package/dist/{chunk-3ZBETKSW.js → chunk-6T66IJCY.js} +5 -0
  12. package/dist/{chunk-ECRNMUZY.js → chunk-AEIRSM6M.js} +1 -1
  13. package/dist/{chunk-IGBICJSY.js → chunk-B7254H5E.js} +1 -1
  14. package/dist/{chunk-R266LOJY.js → chunk-E72FRPF4.js} +15 -3
  15. package/dist/{chunk-S6EUZBEH.js → chunk-FMDJEY4R.js} +1 -1
  16. package/dist/{chunk-LMAJOZGP.js → chunk-G5CBWM5A.js} +3 -3
  17. package/dist/{chunk-WABMYMTO.js → chunk-GR3GGYJY.js} +2 -2
  18. package/dist/{chunk-VETXOSAQ.js → chunk-HGJQFG33.js} +2 -2
  19. package/dist/{chunk-RJBVOPFD.js → chunk-HHNGQYZB.js} +27 -27
  20. package/dist/{chunk-GJZISVDV.js → chunk-IWY22QAC.js} +2 -2
  21. package/dist/{chunk-4LUAFIF5.js → chunk-JVDAMJZJ.js} +2205 -2184
  22. package/dist/{chunk-Q7Z3H3GL.js → chunk-K2KHRNPV.js} +13 -4
  23. package/dist/{chunk-OFNXU6XT.js → chunk-LGWOBHUY.js} +1 -1
  24. package/dist/{chunk-ZYFQDN2K.js → chunk-MB3FR4WL.js} +28 -4
  25. package/dist/{chunk-PBOTSYWN.js → chunk-MHNH7UHD.js} +1 -1
  26. package/dist/chunk-NEW2NRYM.js +46 -0
  27. package/dist/{chunk-AY5LBONU.js → chunk-PYG6AFYU.js} +2 -2
  28. package/dist/{chunk-4FLUWOFO.js → chunk-QZ6NUJB5.js} +2 -2
  29. package/dist/{chunk-S4VUE6OA.js → chunk-RG4CN74T.js} +224 -7
  30. package/dist/{chunk-OPMMPSLX.js → chunk-RQFQK7WV.js} +2 -2
  31. package/dist/{chunk-5WAZAXOW.js → chunk-SACWMZFU.js} +2 -2
  32. package/dist/{chunk-HII7DWWZ.js → chunk-SL4IWVLO.js} +2 -2
  33. package/dist/{chunk-EO6QNP4N.js → chunk-VEM4AZAI.js} +3 -3
  34. package/dist/{chunk-3UJFEFTD.js → chunk-VN2DVYGG.js} +2 -2
  35. package/dist/{chunk-H2RK3NKQ.js → chunk-VXYOFJKR.js} +2 -2
  36. package/dist/{chunk-MZLYFF2A.js → chunk-VY7NFMES.js} +2 -2
  37. package/dist/{chunk-DYLKAHKE.js → chunk-WAU6SFQ5.js} +7 -1
  38. package/dist/{chunk-35PT2VZ6.js → chunk-WQQ3DSJH.js} +2 -2
  39. package/dist/{chunk-77TG73N3.js → chunk-XJS4FFUC.js} +2 -2
  40. package/dist/{chunk-PWOJYW62.js → chunk-XTEERZ7T.js} +2 -2
  41. package/dist/{chunk-CSUC4K6Z.js → chunk-YV6J4BRT.js} +3 -3
  42. package/dist/{chunk-G3IDF3GN.js → chunk-YWITUQIX.js} +1 -1
  43. package/dist/{chunk-SLD5GAXB.js → chunk-Z5SFM3A5.js} +1 -1
  44. package/dist/{chunk-CI336LA7.js → chunk-ZPU5TX3B.js} +1 -1
  45. package/dist/commands/add-ledger-entry.js +6 -5
  46. package/dist/commands/api-client/create.js +4 -3
  47. package/dist/commands/create-custom-link.js +6 -5
  48. package/dist/commands/create-ledger.js +6 -5
  49. package/dist/commands/delete-custom-txs.js +6 -5
  50. package/dist/commands/delete-ledger.js +6 -5
  51. package/dist/commands/delete-schema.js +6 -5
  52. package/dist/commands/gen-graphql.js +7 -6
  53. package/dist/commands/get-schema.js +7 -6
  54. package/dist/commands/init.js +4 -3
  55. package/dist/commands/login.js +5 -4
  56. package/dist/commands/migrate-ledger-entry.js +6 -5
  57. package/dist/commands/print-schema.js +8 -7
  58. package/dist/commands/query/ledgerAccounts.js +6 -5
  59. package/dist/commands/query/ledgers.js +6 -5
  60. package/dist/commands/query/schema.js +6 -5
  61. package/dist/commands/query/schemas.js +6 -5
  62. package/dist/commands/reverse-ledger-entry.js +6 -5
  63. package/dist/commands/simulate-scenario.js +8 -7
  64. package/dist/commands/start.js +4 -3
  65. package/dist/commands/store-schema.js +6 -5
  66. package/dist/commands/token.js +6 -5
  67. package/dist/commands/update-ledger-account.js +6 -5
  68. package/dist/commands/update.js +5 -4
  69. package/dist/commands/verify-schema.js +8 -7
  70. package/dist/commands/version.js +4 -3
  71. package/dist/commands/workspace.js +6 -5
  72. package/dist/commands.js +43 -42
  73. package/dist/graphql.js +2 -2
  74. package/dist/index.js +43 -42
  75. package/dist/lib/authenticatedCommand.js +5 -4
  76. package/dist/lib/baseCommand.js +3 -2
  77. package/dist/lib/curl.js +13 -0
  78. package/dist/lib/sdk.js +1 -1
  79. package/dist/lib/version.js +2 -1
  80. package/dist/utils/formatChartOfAccounts.js +3 -3
  81. package/dist/utils/formatEntries.js +3 -3
  82. package/dist/utils/formatScenarioAccountBalances.js +3 -3
  83. package/dist/utils/formatScenarioBalances.js +4 -4
  84. package/dist/utils/schemaBackCompat.js +4 -4
  85. package/dist/utils/schemaValidation.js +3 -3
  86. package/oclif.manifest.json +1 -1
  87. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateSchemaStructure
3
- } from "./chunk-OFNXU6XT.js";
3
+ } from "./chunk-LGWOBHUY.js";
4
4
  import {
5
5
  ChartOfAccounts,
6
6
  MIN_SCHEMA_LEDGER_ENTRY_DISABLED_DURATION_SECONDS,
@@ -11,14 +11,16 @@ import {
11
11
  getAccountStatus,
12
12
  isEqual_default,
13
13
  parseWithError,
14
+ sortBy_default,
14
15
  stringify,
16
+ uniqWith_default,
15
17
  z
16
- } from "./chunk-S4VUE6OA.js";
18
+ } from "./chunk-RG4CN74T.js";
17
19
  import {
18
20
  PaymentAccountingEventKey,
19
21
  VALID_LEDGER_ACCOUNT_STATUS_TRANSITIONS,
20
22
  getSchemaObjectParameters
21
- } from "./chunk-JTGVX5GX.js";
23
+ } from "./chunk-4AUNUT7Z.js";
22
24
  import {
23
25
  BadRequestError,
24
26
  InternalError,
@@ -876,7 +878,10 @@ var accountingEventChangePolicies = {
876
878
  [PaymentAccountingEventKey.initiated]: "immutable" /* immutable */,
877
879
  [PaymentAccountingEventKey.settled]: "immutable" /* immutable */,
878
880
  [PaymentAccountingEventKey.refund_initiated]: "mutable" /* mutable */,
879
- [PaymentAccountingEventKey.refund_failed]: "mutable" /* mutable */
881
+ [PaymentAccountingEventKey.refund_failed]: "mutable" /* mutable */,
882
+ [PaymentAccountingEventKey.chargeback_settled]: "mutable" /* mutable */,
883
+ [PaymentAccountingEventKey.chargeback_countered]: "mutable" /* mutable */,
884
+ [PaymentAccountingEventKey.chargeback_reversed]: "mutable" /* mutable */
880
885
  };
881
886
  var canAddAccountingEntryOnceDeployed = (event) => accountingEventChangePolicies[event] === "mutable" /* mutable */;
882
887
  var isAccountingEntryCompatible = (event, oldEntry, newEntry) => isEqual_default(oldEntry, newEntry) || oldEntry === void 0 && canAddAccountingEntryOnceDeployed(event);
@@ -915,6 +920,10 @@ var paymentTypePolicies = {
915
920
  serializer: (paymentType) => paymentType.payment.amount,
916
921
  name: "payment.amount"
917
922
  },
923
+ tags: {
924
+ serializer: ({ payment }) => sortBy_default(uniqWith_default(payment.tags ?? [], isEqual_default), ["key", "value"]),
925
+ name: "payment.tags"
926
+ },
918
927
  direction: {
919
928
  serializer: (paymentType) => paymentType.payment.direction,
920
929
  name: "payment.direction"
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  Schema,
6
6
  parseWithError
7
- } from "./chunk-S4VUE6OA.js";
7
+ } from "./chunk-RG4CN74T.js";
8
8
  import {
9
9
  BadRequestError
10
10
  } from "./chunk-IJNU7K35.js";
@@ -5,13 +5,17 @@ import {
5
5
  import {
6
6
  parseJSON
7
7
  } from "./chunk-QZNZYG2G.js";
8
- import {
9
- require_graphql
10
- } from "./chunk-QF5EN33L.js";
11
8
  import {
12
9
  detectInstallationMethodFromPath,
13
10
  getFragmentCliVersion
14
- } from "./chunk-DYLKAHKE.js";
11
+ } from "./chunk-WAU6SFQ5.js";
12
+ import {
13
+ getCurlUpdateArgs,
14
+ hasCurlInstallation
15
+ } from "./chunk-NEW2NRYM.js";
16
+ import {
17
+ require_graphql
18
+ } from "./chunk-QF5EN33L.js";
15
19
  import {
16
20
  require_color_convert,
17
21
  require_has_flag,
@@ -50033,6 +50037,8 @@ var FragmentCommand = class extends import_core.Command {
50033
50037
  }
50034
50038
  }
50035
50039
  detectInstallationMethod() {
50040
+ if (hasCurlInstallation(this.config.root))
50041
+ return "curl";
50036
50042
  if (process.env.FRAGMENT_CLI_TEST_ENV === "true") {
50037
50043
  return "npm";
50038
50044
  }
@@ -50143,6 +50149,24 @@ var FragmentCommand = class extends import_core.Command {
50143
50149
  }) {
50144
50150
  const method = installationMethod ?? this.detectInstallationMethod();
50145
50151
  switch (method) {
50152
+ case "curl": {
50153
+ const version2 = await getFragmentCliVersion(this.isBeta, method);
50154
+ const args = getCurlUpdateArgs({
50155
+ root: this.config.root,
50156
+ version: version2,
50157
+ isBeta: this.isBeta
50158
+ });
50159
+ this.log(`Updating Fragment installed with curl to ${version2}...`);
50160
+ if (!dryRun) {
50161
+ const result = (0, import_cross_spawn.sync)("sh", args, {
50162
+ stdio: "inherit",
50163
+ env: { ...process.env, FRAGMENT_NODE_EXECUTABLE: process.execPath }
50164
+ });
50165
+ if (result.status !== 0)
50166
+ this.exit(1);
50167
+ }
50168
+ break;
50169
+ }
50146
50170
  case "npm":
50147
50171
  this.log("Detected npm installation. Updating via npm...");
50148
50172
  await this.updateViaNpm({ dryRun });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-OPMMPSLX.js";
3
+ } from "./chunk-RQFQK7WV.js";
4
4
  import {
5
5
  init_cjs_shims
6
6
  } from "./chunk-7GH3YGSC.js";
@@ -0,0 +1,46 @@
1
+ import {
2
+ init_cjs_shims
3
+ } from "./chunk-7GH3YGSC.js";
4
+
5
+ // src/lib/curl.ts
6
+ init_cjs_shims();
7
+ import assert from "node:assert";
8
+ import { existsSync, readFileSync } from "node:fs";
9
+ import { isAbsolute, join } from "node:path";
10
+ var getCurlReleaseUrl = (isBeta) => `https://${isBeta ? "dev" : "prod"}-fragment-cli-bucket.s3.amazonaws.com/curl`;
11
+ var hasCurlInstallation = (root) => existsSync(join(root, ".fragment-curl"));
12
+ var getCurlUpdateArgs = (args) => {
13
+ const [installDirectory, binDirectory] = readFileSync(
14
+ join(args.root, ".fragment-curl"),
15
+ "utf8"
16
+ ).split("\n");
17
+ assert(
18
+ installDirectory && binDirectory && isAbsolute(installDirectory) && isAbsolute(binDirectory),
19
+ "Invalid curl installation marker; reinstall using https://fragment.dev/install.sh"
20
+ );
21
+ return [
22
+ join(args.root, "install.sh"),
23
+ "--version",
24
+ args.version,
25
+ "--install-dir",
26
+ installDirectory,
27
+ "--bin-dir",
28
+ binDirectory,
29
+ "--base-url",
30
+ getCurlReleaseUrl(args.isBeta)
31
+ ];
32
+ };
33
+ var getCurlCliVersion = async (isBeta) => {
34
+ const response = await fetch(`${getCurlReleaseUrl(isBeta)}/latest`);
35
+ assert(response.ok, `Curl release check failed: HTTP ${response.status}`);
36
+ const version = (await response.text()).trim();
37
+ assert(/^\d[\da-zA-Z.+-]*$/.test(version), "Invalid curl release version");
38
+ return version;
39
+ };
40
+
41
+ export {
42
+ getCurlReleaseUrl,
43
+ hasCurlInstallation,
44
+ getCurlUpdateArgs,
45
+ getCurlCliVersion
46
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-OPMMPSLX.js";
3
+ } from "./chunk-RQFQK7WV.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-ZYFQDN2K.js";
6
+ } from "./chunk-MB3FR4WL.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-QDAKBUNO.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  formatScenarioBalances
3
- } from "./chunk-4LUAFIF5.js";
3
+ } from "./chunk-JVDAMJZJ.js";
4
4
  import {
5
5
  DEFAULT_SCHEMA_PATH
6
6
  } from "./chunk-A4BSWX5D.js";
7
7
  import {
8
8
  FragmentCommand,
9
9
  require_lib
10
- } from "./chunk-ZYFQDN2K.js";
10
+ } from "./chunk-MB3FR4WL.js";
11
11
  import {
12
12
  getParsedSchemaString,
13
13
  parseJSON
@@ -2,13 +2,14 @@ import {
2
2
  AccountConsistencyConfigSchema,
3
3
  BaseChartOfAccounts,
4
4
  ConsistencyConfigSchema,
5
+ DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS,
5
6
  PaymentAccountingEventKey,
6
- PaymentAccountingEventKeySchema,
7
7
  PaymentTypeDirection,
8
8
  PaymentTypeDirectionSchema,
9
9
  PostLinesAsSchema,
10
10
  SYSTEM_LINE_AMOUNT,
11
11
  SYSTEM_PARAMETER_NAMES,
12
+ ScenePaymentAccountingEventKeySchema,
12
13
  SchemaEntryGroup,
13
14
  SchemaLedgerEntityStatusSchema,
14
15
  SchemaLinkType,
@@ -18,7 +19,7 @@ import {
18
19
  SystemLineKindSchema,
19
20
  fillParams,
20
21
  getSchemaObjectParameters
21
- } from "./chunk-JTGVX5GX.js";
22
+ } from "./chunk-4AUNUT7Z.js";
22
23
  import {
23
24
  BadRequestError,
24
25
  InternalError,
@@ -4983,6 +4984,9 @@ function copyObject(source, props, object, customizer) {
4983
4984
  }
4984
4985
  var copyObject_default = copyObject;
4985
4986
 
4987
+ // ../../node_modules/lodash-es/_baseRest.js
4988
+ init_cjs_shims();
4989
+
4986
4990
  // ../../node_modules/lodash-es/_overRest.js
4987
4991
  init_cjs_shims();
4988
4992
  var nativeMax = Math.max;
@@ -5004,6 +5008,15 @@ function overRest(func, start, transform) {
5004
5008
  }
5005
5009
  var overRest_default = overRest;
5006
5010
 
5011
+ // ../../node_modules/lodash-es/_baseRest.js
5012
+ function baseRest(func, start) {
5013
+ return setToString_default(overRest_default(func, start, identity_default), func + "");
5014
+ }
5015
+ var baseRest_default = baseRest;
5016
+
5017
+ // ../../node_modules/lodash-es/_isIterateeCall.js
5018
+ init_cjs_shims();
5019
+
5007
5020
  // ../../node_modules/lodash-es/isArrayLike.js
5008
5021
  init_cjs_shims();
5009
5022
 
@@ -5021,6 +5034,19 @@ function isArrayLike(value) {
5021
5034
  }
5022
5035
  var isArrayLike_default = isArrayLike;
5023
5036
 
5037
+ // ../../node_modules/lodash-es/_isIterateeCall.js
5038
+ function isIterateeCall(value, index, object) {
5039
+ if (!isObject_default(object)) {
5040
+ return false;
5041
+ }
5042
+ var type = typeof index;
5043
+ if (type == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type == "string" && index in object) {
5044
+ return eq_default(object[index], value);
5045
+ }
5046
+ return false;
5047
+ }
5048
+ var isIterateeCall_default = isIterateeCall;
5049
+
5024
5050
  // ../../node_modules/lodash-es/_isPrototype.js
5025
5051
  init_cjs_shims();
5026
5052
  var objectProto5 = Object.prototype;
@@ -6865,6 +6891,17 @@ function last(array) {
6865
6891
  }
6866
6892
  var last_default = last;
6867
6893
 
6894
+ // ../../node_modules/lodash-es/_baseMap.js
6895
+ init_cjs_shims();
6896
+ function baseMap(collection, iteratee) {
6897
+ var index = -1, result = isArrayLike_default(collection) ? Array(collection.length) : [];
6898
+ baseEach_default(collection, function(value, key, collection2) {
6899
+ result[++index] = iteratee(value, key, collection2);
6900
+ });
6901
+ return result;
6902
+ }
6903
+ var baseMap_default = baseMap;
6904
+
6868
6905
  // ../../node_modules/lodash-es/_parent.js
6869
6906
  init_cjs_shims();
6870
6907
  function parent(object, path) {
@@ -6959,6 +6996,102 @@ var omit = flatRest_default(function(object, paths) {
6959
6996
  });
6960
6997
  var omit_default = omit;
6961
6998
 
6999
+ // ../../node_modules/lodash-es/_baseOrderBy.js
7000
+ init_cjs_shims();
7001
+
7002
+ // ../../node_modules/lodash-es/_baseSortBy.js
7003
+ init_cjs_shims();
7004
+ function baseSortBy(array, comparer) {
7005
+ var length = array.length;
7006
+ array.sort(comparer);
7007
+ while (length--) {
7008
+ array[length] = array[length].value;
7009
+ }
7010
+ return array;
7011
+ }
7012
+ var baseSortBy_default = baseSortBy;
7013
+
7014
+ // ../../node_modules/lodash-es/_compareMultiple.js
7015
+ init_cjs_shims();
7016
+
7017
+ // ../../node_modules/lodash-es/_compareAscending.js
7018
+ init_cjs_shims();
7019
+ function compareAscending(value, other) {
7020
+ if (value !== other) {
7021
+ var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol_default(value);
7022
+ var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol_default(other);
7023
+ if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
7024
+ return 1;
7025
+ }
7026
+ if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
7027
+ return -1;
7028
+ }
7029
+ }
7030
+ return 0;
7031
+ }
7032
+ var compareAscending_default = compareAscending;
7033
+
7034
+ // ../../node_modules/lodash-es/_compareMultiple.js
7035
+ function compareMultiple(object, other, orders) {
7036
+ var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
7037
+ while (++index < length) {
7038
+ var result = compareAscending_default(objCriteria[index], othCriteria[index]);
7039
+ if (result) {
7040
+ if (index >= ordersLength) {
7041
+ return result;
7042
+ }
7043
+ var order = orders[index];
7044
+ return result * (order == "desc" ? -1 : 1);
7045
+ }
7046
+ }
7047
+ return object.index - other.index;
7048
+ }
7049
+ var compareMultiple_default = compareMultiple;
7050
+
7051
+ // ../../node_modules/lodash-es/_baseOrderBy.js
7052
+ function baseOrderBy(collection, iteratees, orders) {
7053
+ if (iteratees.length) {
7054
+ iteratees = arrayMap_default(iteratees, function(iteratee) {
7055
+ if (isArray_default(iteratee)) {
7056
+ return function(value) {
7057
+ return baseGet_default(value, iteratee.length === 1 ? iteratee[0] : iteratee);
7058
+ };
7059
+ }
7060
+ return iteratee;
7061
+ });
7062
+ } else {
7063
+ iteratees = [identity_default];
7064
+ }
7065
+ var index = -1;
7066
+ iteratees = arrayMap_default(iteratees, baseUnary_default(baseIteratee_default));
7067
+ var result = baseMap_default(collection, function(value, key, collection2) {
7068
+ var criteria = arrayMap_default(iteratees, function(iteratee) {
7069
+ return iteratee(value);
7070
+ });
7071
+ return { "criteria": criteria, "index": ++index, "value": value };
7072
+ });
7073
+ return baseSortBy_default(result, function(object, other) {
7074
+ return compareMultiple_default(object, other, orders);
7075
+ });
7076
+ }
7077
+ var baseOrderBy_default = baseOrderBy;
7078
+
7079
+ // ../../node_modules/lodash-es/sortBy.js
7080
+ init_cjs_shims();
7081
+ var sortBy = baseRest_default(function(collection, iteratees) {
7082
+ if (collection == null) {
7083
+ return [];
7084
+ }
7085
+ var length = iteratees.length;
7086
+ if (length > 1 && isIterateeCall_default(collection, iteratees[0], iteratees[1])) {
7087
+ iteratees = [];
7088
+ } else if (length > 2 && isIterateeCall_default(iteratees[0], iteratees[1], iteratees[2])) {
7089
+ iteratees = [iteratees[0]];
7090
+ }
7091
+ return baseOrderBy_default(collection, baseFlatten_default(iteratees, 1), []);
7092
+ });
7093
+ var sortBy_default = sortBy;
7094
+
6962
7095
  // ../../node_modules/lodash-es/_baseUniq.js
6963
7096
  init_cjs_shims();
6964
7097
 
@@ -7021,6 +7154,14 @@ function uniqBy(array, iteratee) {
7021
7154
  }
7022
7155
  var uniqBy_default = uniqBy;
7023
7156
 
7157
+ // ../../node_modules/lodash-es/uniqWith.js
7158
+ init_cjs_shims();
7159
+ function uniqWith(array, comparator) {
7160
+ comparator = typeof comparator == "function" ? comparator : void 0;
7161
+ return array && array.length ? baseUniq_default(array, void 0, comparator) : [];
7162
+ }
7163
+ var uniqWith_default = uniqWith;
7164
+
7024
7165
  // ../../libs/schema-validation/utils/transformers/coa.ts
7025
7166
  init_cjs_shims();
7026
7167
 
@@ -10030,6 +10171,10 @@ var makePaymentEntryTypePrefix = (paymentType) => (
10030
10171
  // concatenation is a SafeString without a runtime re-parse.
10031
10172
  `${PAYMENT_ENTRY_TYPE_PREFIX}_${paymentType}_`
10032
10173
  );
10174
+ var makePaymentEntryType = ({
10175
+ paymentType,
10176
+ event
10177
+ }) => `${makePaymentEntryTypePrefix(paymentType)}${event}`;
10033
10178
 
10034
10179
  // ../../libs/schema-validation/utils/transformers/payments.ts
10035
10180
  var amountMatchesSystemLine = (amount, system) => amount === SYSTEM_LINE_AMOUNT[system];
@@ -10068,6 +10213,17 @@ var systemLinesByPaymentAccountingEvent = {
10068
10213
  ],
10069
10214
  [PaymentAccountingEventKey.refund_failed]: [
10070
10215
  SystemLineKind.payment_refund_reversal_line
10216
+ ],
10217
+ [PaymentAccountingEventKey.chargeback_settled]: [
10218
+ SystemLineKind.payment_chargeback_line,
10219
+ SystemLineKind.payment_chargeback_fee_line
10220
+ ],
10221
+ [PaymentAccountingEventKey.chargeback_countered]: [
10222
+ SystemLineKind.payment_chargeback_countered_fee_line
10223
+ ],
10224
+ [PaymentAccountingEventKey.chargeback_reversed]: [
10225
+ SystemLineKind.payment_chargeback_reversal_line,
10226
+ SystemLineKind.payment_chargeback_countered_fee_reversal_line
10071
10227
  ]
10072
10228
  };
10073
10229
  var hasSystemLines = (event) => systemLinesByPaymentAccountingEvent[event].length > 0;
@@ -10229,6 +10385,22 @@ var validatePaymentEntry = ({
10229
10385
  errors.push(...validateSystemParameterUsage({ entry, lines, entryIdentity }));
10230
10386
  return errors;
10231
10387
  };
10388
+ var validateDisputeEntries = (paymentType) => {
10389
+ const definedEvents = DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS.filter(
10390
+ (event) => paymentType.accounting[event] !== void 0
10391
+ );
10392
+ if (definedEvents.length === 0)
10393
+ return [];
10394
+ return DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS.filter(
10395
+ (event) => paymentType.accounting[event] === void 0
10396
+ ).map((event) => ({
10397
+ path: ["accounting", event],
10398
+ message: `Payment Type (${paymentType.type}) must define a '${event}' entry, because it defines '${definedEvents.join(
10399
+ "', '"
10400
+ )}'. Define every dispute entry or none.`
10401
+ }));
10402
+ };
10403
+ var getSystemParameters = (parameters) => parameters.filter((parameter) => SYSTEM_PARAMETER_NAMES.has(parameter));
10232
10404
  var validatePaymentType = ({
10233
10405
  paymentType,
10234
10406
  accountPathToAccount,
@@ -10264,13 +10436,28 @@ var validatePaymentType = ({
10264
10436
  "amount"
10265
10437
  ])
10266
10438
  );
10267
- getSchemaObjectParameters(paymentType.payment.amount).filter((param) => SYSTEM_PARAMETER_NAMES.has(param)).forEach((param) => {
10439
+ getSystemParameters(
10440
+ getSchemaObjectParameters(paymentType.payment.amount)
10441
+ ).forEach((param) => {
10268
10442
  errors.push({
10269
10443
  path: ["payment", "amount"],
10270
10444
  message: `Payment Type (${paymentType.type}) payment amount cannot use the system parameter '${param}'.`
10271
10445
  });
10272
10446
  });
10273
10447
  }
10448
+ const tags = paymentType.payment.tags ?? [];
10449
+ errors.push(
10450
+ ...validateTags(tags, "Payment Types").map((error) => ({
10451
+ ...error,
10452
+ path: ["payment", ...error.path]
10453
+ })),
10454
+ ...tags.flatMap(
10455
+ ({ value }, i2) => getSystemParameters(getStringParameters(value)).map((parameter) => ({
10456
+ path: ["payment", "tags", i2, "value"],
10457
+ message: `Payment Type (${paymentType.type}) tag value cannot use the system parameter '${parameter}'.`
10458
+ }))
10459
+ )
10460
+ );
10274
10461
  Object.keys(paymentType.accounting).filter((event) => !(event in PaymentAccountingEventKey)).forEach((event) => {
10275
10462
  errors.push({
10276
10463
  path: ["accounting", event],
@@ -10285,6 +10472,7 @@ var validatePaymentType = ({
10285
10472
  message: `Payment Type (${paymentType.type}) must define a '${PaymentAccountingEventKey.settled}' entry.`
10286
10473
  });
10287
10474
  }
10475
+ errors.push(...validateDisputeEntries(paymentType));
10288
10476
  errors.push(
10289
10477
  ...Object.values(PaymentAccountingEventKey).flatMap((event) => {
10290
10478
  const entry = paymentType.accounting[event];
@@ -10319,6 +10507,28 @@ var validateUniquePaymentTypes = ({
10319
10507
  path: [...pathPrefix, idx, "type"]
10320
10508
  }))
10321
10509
  );
10510
+ var validateUniquePaymentEntryTypes = (types) => Array.from(
10511
+ groupByMap(
10512
+ types.flatMap(
10513
+ ({ type }, idx) => Object.values(PaymentAccountingEventKey).map((event) => ({
10514
+ type,
10515
+ idx,
10516
+ event
10517
+ }))
10518
+ ),
10519
+ ({ type, event }) => (
10520
+ // Only equality matters here; an unsafe type string is reported on its own.
10521
+ makePaymentEntryType({ paymentType: type, event })
10522
+ )
10523
+ ).values()
10524
+ ).flatMap(
10525
+ (group) => group.flatMap(
10526
+ (member) => group.filter((other) => other.type !== member.type).map((other) => ({
10527
+ message: `Payment Type '${member.type}' conflicts with Payment Type '${other.type}': the '${member.event}' entry of '${member.type}' and the '${other.event}' entry of '${other.type}' post the same Ledger Entry type. Rename one.`,
10528
+ path: ["types", member.idx, "type"]
10529
+ }))
10530
+ )
10531
+ );
10322
10532
  var validateReservedPaymentEntryTypes = ({
10323
10533
  ledgerEntryTypes,
10324
10534
  paymentTypes
@@ -10356,7 +10566,8 @@ var transformAndValidatePayments = ({
10356
10566
  ...validateUniquePaymentTypes({
10357
10567
  types: payments.types,
10358
10568
  pathPrefix: ["types"]
10359
- })
10569
+ }),
10570
+ ...validateUniquePaymentEntryTypes(payments.types)
10360
10571
  );
10361
10572
  errors.push(
10362
10573
  ...payments.types.flatMap(
@@ -10682,13 +10893,17 @@ var SchemaPaymentTypeInput = z.object({
10682
10893
  status: SchemaPaymentTypeStatusSchema,
10683
10894
  payment: z.object({
10684
10895
  amount: ParameterizedAmount(),
10685
- direction: PaymentTypeDirectionSchema
10896
+ direction: PaymentTypeDirectionSchema,
10897
+ tags: SchemaLedgerEntryTagsInput
10686
10898
  }),
10687
10899
  accounting: z.object({
10688
10900
  initiated: SchemaPaymentEntryInput.optional(),
10689
10901
  settled: SchemaPaymentEntryInput,
10690
10902
  refund_initiated: SchemaPaymentEntryInput.optional(),
10691
- refund_failed: SchemaPaymentEntryInput.optional()
10903
+ refund_failed: SchemaPaymentEntryInput.optional(),
10904
+ chargeback_settled: SchemaPaymentEntryInput.optional(),
10905
+ chargeback_countered: SchemaPaymentEntryInput.optional(),
10906
+ chargeback_reversed: SchemaPaymentEntryInput.optional()
10692
10907
  })
10693
10908
  });
10694
10909
  var enrichPaymentEntry = ({
@@ -10743,7 +10958,7 @@ var ScenePayment = z.object({
10743
10958
  });
10744
10959
  var ScenePaymentEvent = z.object({
10745
10960
  ik: SafeStringSchema,
10746
- event: PaymentAccountingEventKeySchema
10961
+ event: ScenePaymentAccountingEventKeySchema
10747
10962
  });
10748
10963
  var SceneEvent = z.object({
10749
10964
  eventType: z.enum(["entry", "payment"]),
@@ -10878,7 +11093,9 @@ export {
10878
11093
  isEqual_default,
10879
11094
  keyBy_default,
10880
11095
  omit_default,
11096
+ sortBy_default,
10881
11097
  uniqBy_default,
11098
+ uniqWith_default,
10882
11099
  isTotalBalanceSchema,
10883
11100
  validateLedgerConsistencySettings,
10884
11101
  getAccountStatus,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getSdk
3
- } from "./chunk-3ZBETKSW.js";
3
+ } from "./chunk-6T66IJCY.js";
4
4
  import {
5
5
  FragmentCommand,
6
6
  GraphQLClient,
7
7
  require_lib
8
- } from "./chunk-ZYFQDN2K.js";
8
+ } from "./chunk-MB3FR4WL.js";
9
9
  import {
10
10
  colorizeJson
11
11
  } from "./chunk-QZNZYG2G.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-OPMMPSLX.js";
3
+ } from "./chunk-RQFQK7WV.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-ZYFQDN2K.js";
6
+ } from "./chunk-MB3FR4WL.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-QDAKBUNO.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-OPMMPSLX.js";
3
+ } from "./chunk-RQFQK7WV.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-ZYFQDN2K.js";
6
+ } from "./chunk-MB3FR4WL.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-QDAKBUNO.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  inquirer_default
3
- } from "./chunk-6H5VEWMH.js";
3
+ } from "./chunk-2EMLJCCB.js";
4
4
  import {
5
5
  AuthenticatedCommand
6
- } from "./chunk-OPMMPSLX.js";
6
+ } from "./chunk-RQFQK7WV.js";
7
7
  import {
8
8
  require_lib
9
- } from "./chunk-ZYFQDN2K.js";
9
+ } from "./chunk-MB3FR4WL.js";
10
10
  import {
11
11
  require_source
12
12
  } from "./chunk-QDAKBUNO.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-OPMMPSLX.js";
3
+ } from "./chunk-RQFQK7WV.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-ZYFQDN2K.js";
6
+ } from "./chunk-MB3FR4WL.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-QDAKBUNO.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  inquirer_default
3
- } from "./chunk-6H5VEWMH.js";
3
+ } from "./chunk-2EMLJCCB.js";
4
4
  import {
5
5
  provisionApiClientFromDashboard,
6
6
  startWorkspaceSelectionServer
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  FragmentCommand,
13
13
  require_lib
14
- } from "./chunk-ZYFQDN2K.js";
14
+ } from "./chunk-MB3FR4WL.js";
15
15
  import {
16
16
  require_source
17
17
  } from "./chunk-QDAKBUNO.js";
@@ -7,10 +7,10 @@ import {
7
7
  } from "./chunk-4E5LH6UM.js";
8
8
  import {
9
9
  ChartOfAccounts
10
- } from "./chunk-S4VUE6OA.js";
10
+ } from "./chunk-RG4CN74T.js";
11
11
  import {
12
12
  BaseSchema
13
- } from "./chunk-JTGVX5GX.js";
13
+ } from "./chunk-4AUNUT7Z.js";
14
14
  import {
15
15
  getStructuralPath
16
16
  } from "./chunk-2QGAXOCF.js";