@temboplus/afloat 0.2.1-beta.8 → 0.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.
Files changed (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -207
  3. package/dist/index.cjs.js +1 -1
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.d.ts +5 -4
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.esm.js +1 -1
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/lib/api/base-repository.d.ts +2 -2
  10. package/dist/lib/api/base-repository.d.ts.map +1 -0
  11. package/dist/lib/api/index.d.ts +1 -0
  12. package/dist/lib/api/index.d.ts.map +1 -0
  13. package/dist/lib/error/error.api.d.ts +3 -2
  14. package/dist/lib/error/error.api.d.ts.map +1 -0
  15. package/dist/lib/error/error.permission.d.ts +2 -1
  16. package/dist/lib/error/error.permission.d.ts.map +1 -0
  17. package/dist/lib/error/error.utils.d.ts +1 -0
  18. package/dist/lib/error/error.utils.d.ts.map +1 -0
  19. package/dist/lib/error/index.d.ts +1 -0
  20. package/dist/lib/error/index.d.ts.map +1 -0
  21. package/dist/lib/query/index.d.ts +3 -2
  22. package/dist/lib/query/index.d.ts.map +1 -0
  23. package/dist/lib/query/pagination/pagination.d.ts +1 -0
  24. package/dist/lib/query/pagination/pagination.d.ts.map +1 -0
  25. package/dist/lib/query/pagination/pagination.schemas.d.ts +8 -61
  26. package/dist/lib/query/pagination/pagination.schemas.d.ts.map +1 -0
  27. package/dist/lib/query/query.builder.d.ts +10 -3
  28. package/dist/lib/query/query.builder.d.ts.map +1 -0
  29. package/dist/lib/query/query.types.d.ts +1 -0
  30. package/dist/lib/query/query.types.d.ts.map +1 -0
  31. package/dist/modules/auth/auth.contract.d.ts +10 -69
  32. package/dist/modules/auth/auth.contract.d.ts.map +1 -0
  33. package/dist/modules/auth/auth.dtos.d.ts +8 -67
  34. package/dist/modules/auth/auth.dtos.d.ts.map +1 -0
  35. package/dist/modules/auth/auth.repository.d.ts +1 -0
  36. package/dist/modules/auth/auth.repository.d.ts.map +1 -0
  37. package/dist/modules/auth/company-membership.model.d.ts +7 -86
  38. package/dist/modules/auth/company-membership.model.d.ts.map +1 -0
  39. package/dist/modules/auth/index.d.ts +3 -2
  40. package/dist/modules/auth/index.d.ts.map +1 -0
  41. package/dist/modules/auth/user.model.d.ts +26 -163
  42. package/dist/modules/auth/user.model.d.ts.map +1 -0
  43. package/dist/modules/beneficiary/beneficiary-info.model.d.ts +30 -67
  44. package/dist/modules/beneficiary/beneficiary-info.model.d.ts.map +1 -0
  45. package/dist/modules/beneficiary/beneficiary-input-handler.d.ts +3 -2
  46. package/dist/modules/beneficiary/beneficiary-input-handler.d.ts.map +1 -0
  47. package/dist/modules/beneficiary/beneficiary.api-contract.d.ts +16 -115
  48. package/dist/modules/beneficiary/beneficiary.api-contract.d.ts.map +1 -0
  49. package/dist/modules/beneficiary/beneficiary.dtos.d.ts +6 -34
  50. package/dist/modules/beneficiary/beneficiary.dtos.d.ts.map +1 -0
  51. package/dist/modules/beneficiary/beneficiary.model.d.ts +5 -27
  52. package/dist/modules/beneficiary/beneficiary.model.d.ts.map +1 -0
  53. package/dist/modules/beneficiary/beneficiary.repository.d.ts +2 -1
  54. package/dist/modules/beneficiary/beneficiary.repository.d.ts.map +1 -0
  55. package/dist/modules/beneficiary/index.d.ts +5 -4
  56. package/dist/modules/beneficiary/index.d.ts.map +1 -0
  57. package/dist/modules/login/index.d.ts +1 -0
  58. package/dist/modules/login/index.d.ts.map +1 -0
  59. package/dist/modules/login/login.api-contract.d.ts +3 -28
  60. package/dist/modules/login/login.api-contract.d.ts.map +1 -0
  61. package/dist/modules/login/login.dtos.d.ts +5 -56
  62. package/dist/modules/login/login.dtos.d.ts.map +1 -0
  63. package/dist/modules/login/login.model.d.ts +7 -34
  64. package/dist/modules/login/login.model.d.ts.map +1 -0
  65. package/dist/modules/login/login.repository.d.ts +2 -1
  66. package/dist/modules/login/login.repository.d.ts.map +1 -0
  67. package/dist/modules/login/permission.type.d.ts +1 -0
  68. package/dist/modules/login/permission.type.d.ts.map +1 -0
  69. package/dist/modules/payout/index.d.ts +3 -2
  70. package/dist/modules/payout/index.d.ts.map +1 -0
  71. package/dist/modules/payout/payout-channel-handler.d.ts +5 -4
  72. package/dist/modules/payout/payout-channel-handler.d.ts.map +1 -0
  73. package/dist/modules/payout/payout.api-contract.d.ts +78 -666
  74. package/dist/modules/payout/payout.api-contract.d.ts.map +1 -0
  75. package/dist/modules/payout/payout.dtos.d.ts +99 -506
  76. package/dist/modules/payout/payout.dtos.d.ts.map +1 -0
  77. package/dist/modules/payout/payout.model.d.ts +8 -85
  78. package/dist/modules/payout/payout.model.d.ts.map +1 -0
  79. package/dist/modules/payout/payout.query.d.ts +3 -2
  80. package/dist/modules/payout/payout.query.d.ts.map +1 -0
  81. package/dist/modules/payout/payout.repository.d.ts +7 -6
  82. package/dist/modules/payout/payout.repository.d.ts.map +1 -0
  83. package/dist/modules/profile/index.d.ts +1 -0
  84. package/dist/modules/profile/index.d.ts.map +1 -0
  85. package/dist/modules/profile/profile.api-contract.d.ts +2 -19
  86. package/dist/modules/profile/profile.api-contract.d.ts.map +1 -0
  87. package/dist/modules/profile/profile.dtos.d.ts +3 -38
  88. package/dist/modules/profile/profile.dtos.d.ts.map +1 -0
  89. package/dist/modules/profile/profile.model.d.ts +5 -42
  90. package/dist/modules/profile/profile.model.d.ts.map +1 -0
  91. package/dist/modules/profile/profile.repository.d.ts +1 -0
  92. package/dist/modules/profile/profile.repository.d.ts.map +1 -0
  93. package/dist/modules/team-member/index.d.ts +3 -2
  94. package/dist/modules/team-member/index.d.ts.map +1 -0
  95. package/dist/modules/team-member/role.model.d.ts +6 -21
  96. package/dist/modules/team-member/role.model.d.ts.map +1 -0
  97. package/dist/modules/team-member/team-member.contract.d.ts +74 -615
  98. package/dist/modules/team-member/team-member.contract.d.ts.map +1 -0
  99. package/dist/modules/team-member/team-member.dtos.d.ts +15 -162
  100. package/dist/modules/team-member/team-member.dtos.d.ts.map +1 -0
  101. package/dist/modules/team-member/team-member.model.d.ts +7 -66
  102. package/dist/modules/team-member/team-member.model.d.ts.map +1 -0
  103. package/dist/modules/team-member/team-member.repository.d.ts +3 -2
  104. package/dist/modules/team-member/team-member.repository.d.ts.map +1 -0
  105. package/dist/modules/wallet/index.d.ts +4 -2
  106. package/dist/modules/wallet/index.d.ts.map +1 -0
  107. package/dist/modules/wallet/narration.model.d.ts +3 -8
  108. package/dist/modules/wallet/narration.model.d.ts.map +1 -0
  109. package/dist/modules/wallet/statement-entry.model.d.ts +14 -131
  110. package/dist/modules/wallet/statement-entry.model.d.ts.map +1 -0
  111. package/dist/modules/wallet/wallet.contract.d.ts +17 -90
  112. package/dist/modules/wallet/wallet.contract.d.ts.map +1 -0
  113. package/dist/modules/wallet/wallet.dtos.d.ts +33 -138
  114. package/dist/modules/wallet/wallet.dtos.d.ts.map +1 -0
  115. package/dist/modules/wallet/wallet.model.d.ts +5 -26
  116. package/dist/modules/wallet/wallet.model.d.ts.map +1 -0
  117. package/dist/modules/wallet/wallet.query.d.ts +2 -1
  118. package/dist/modules/wallet/wallet.query.d.ts.map +1 -0
  119. package/dist/modules/wallet/wallet.repository.d.ts +49 -25
  120. package/dist/modules/wallet/wallet.repository.d.ts.map +1 -0
  121. package/dist/modules/wallet/wallet.timezone.d.ts +87 -0
  122. package/dist/modules/wallet/wallet.timezone.d.ts.map +1 -0
  123. package/dist/modules/wallet/wallet.utils.d.ts +3 -2
  124. package/dist/modules/wallet/wallet.utils.d.ts.map +1 -0
  125. package/package.json +40 -29
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Timezone helpers for the wallet statement flow.
3
+ *
4
+ * The statement endpoint accepts `YYYY-MM-DD` bounds and evaluates them
5
+ * against the EAT-anchored (UTC+3) database. To support a caller who
6
+ * wants "transactions whose `valueDate` falls on these calendar days in
7
+ * timezone `tz`", we:
8
+ *
9
+ * 1. Widen the EAT request by ±1 day, so the upstream window
10
+ * definitely contains every instant the caller cares about. ±1 is
11
+ * mathematically sufficient because the maximum delta from EAT
12
+ * (UTC+3) to any timezone on earth is 15 hours, comfortably under
13
+ * 24h.
14
+ * 2. After the response comes back, filter entries by `valueDate`
15
+ * rendered in the caller's zone, comparing as plain `YYYY-MM-DD`
16
+ * strings (which is correct because string-comparing two ISO
17
+ * calendar dates is equivalent to comparing the dates).
18
+ *
19
+ * The server's filter is on `valueDate` (verified empirically), so the
20
+ * client-side filter uses the same field — no risk of dropping records
21
+ * that were padded in.
22
+ */
23
+ import type { PlainDate } from "./wallet.dtos.js";
24
+ /** IANA id for EAT. The SDK short-circuits all timezone work for this. */
25
+ export declare const EAT_TIMEZONE = "Africa/Nairobi";
26
+ /**
27
+ * Add or subtract whole calendar days from a `YYYY-MM-DD` string.
28
+ * Pure string-in/string-out, no dependency on the JS runtime's local
29
+ * timezone — we pin to UTC noon so DST cliffs and ±1s rounding can't
30
+ * tip the result onto an adjacent day.
31
+ *
32
+ * @example
33
+ * shiftPlainDate("2026-05-15", 1); // → "2026-05-16"
34
+ * shiftPlainDate("2026-05-15", -1); // → "2026-05-14"
35
+ * shiftPlainDate("2026-05-31", 1); // → "2026-06-01" (month wrap)
36
+ * shiftPlainDate("2026-01-01", -1); // → "2025-12-31" (year wrap)
37
+ * shiftPlainDate("2026-03-08", 1); // → "2026-03-09" (DST-safe; US "spring forward" day)
38
+ */
39
+ export declare function shiftPlainDate(date: PlainDate, days: number): PlainDate;
40
+ /**
41
+ * Pad an EAT date range by ±1 day on each side. Used to ensure that an
42
+ * upstream EAT-anchored query returns every transaction that falls on
43
+ * the caller's local-zone window, regardless of timezone offset.
44
+ *
45
+ * @example
46
+ * padEatRange({ startDate: "2026-05-15", endDate: "2026-05-16" });
47
+ * // → { startDate: "2026-05-14", endDate: "2026-05-17" }
48
+ *
49
+ * padEatRange({ startDate: "2026-01-01", endDate: "2026-12-31" });
50
+ * // → { startDate: "2025-12-31", endDate: "2027-01-01" } (year wraps on both ends)
51
+ */
52
+ export declare function padEatRange(range: {
53
+ startDate: PlainDate;
54
+ endDate: PlainDate;
55
+ }): {
56
+ startDate: PlainDate;
57
+ endDate: PlainDate;
58
+ };
59
+ /**
60
+ * Format an absolute instant as a `YYYY-MM-DD` string in the given
61
+ * IANA timezone. Uses `en-CA` locale because that's the one major
62
+ * locale whose default date format is already ISO-like — no need to
63
+ * stitch parts back together by hand.
64
+ *
65
+ * @example
66
+ * // A transaction's valueDate from the API ("+03:00" is EAT)
67
+ * const instant = new Date("2026-05-15T01:30:00+03:00");
68
+ *
69
+ * localDateInZone(instant, "Africa/Nairobi"); // → "2026-05-15"
70
+ * localDateInZone(instant, "UTC"); // → "2026-05-14" (22:30 prev day in UTC)
71
+ * localDateInZone(instant, "America/New_York"); // → "2026-05-14" (18:30 prev day in NY)
72
+ * localDateInZone(instant, "Pacific/Auckland"); // → "2026-05-15" (10:30 same day in NZ)
73
+ */
74
+ export declare function localDateInZone(instant: Date, timezone: string): PlainDate;
75
+ /**
76
+ * True when the caller's selected timezone is effectively EAT. Used to
77
+ * short-circuit padding + post-filtering so existing EAT callers see
78
+ * byte-identical behavior.
79
+ *
80
+ * @example
81
+ * isEatTimezone(undefined); // → true (no zone = legacy EAT behavior)
82
+ * isEatTimezone("Africa/Nairobi"); // → true (canonical EAT id)
83
+ * isEatTimezone("UTC"); // → false
84
+ * isEatTimezone("America/New_York"); // → false
85
+ */
86
+ export declare function isEatTimezone(timezone: string | undefined): boolean;
87
+ //# sourceMappingURL=wallet.timezone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.timezone.d.ts","sourceRoot":"","sources":["../../../src/modules/wallet/wallet.timezone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,0EAA0E;AAC1E,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAUvE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,CAAA;CAAE,GAAG;IAChF,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,SAAS,CAAC;CACpB,CAKA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAQ1E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEnE"}
@@ -1,5 +1,5 @@
1
- import { CountryCode } from "@temboplus/frontend-core";
2
- import { Wallet } from "./wallet.model.js";
1
+ import type { CountryCode } from "@temboplus/frontend-core";
2
+ import type { Wallet } from "./wallet.model.js";
3
3
  export declare const WalletUtils: {
4
4
  /**
5
5
  * Gets unique countries from a list of wallets
@@ -15,3 +15,4 @@ export declare const WalletUtils: {
15
15
  */
16
16
  getWalletsByCountry(wallets: Wallet[], countryCode: CountryCode): Wallet[];
17
17
  };
18
+ //# sourceMappingURL=wallet.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.utils.d.ts","sourceRoot":"","sources":["../../../src/modules/wallet/wallet.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,eAAO,MAAM,WAAW;IACtB;;;;OAIG;gCACyB,MAAM,EAAE,GAAG,WAAW,EAAE;IAUpD;;;;;OAKG;iCAC0B,MAAM,EAAE,eAAe,WAAW,GAAG,MAAM,EAAE;CAG3E,CAAC"}
package/package.json CHANGED
@@ -1,62 +1,73 @@
1
1
  {
2
2
  "name": "@temboplus/afloat",
3
- "version": "0.2.1-beta.8",
3
+ "version": "0.2.1",
4
4
  "description": "A foundational library for Temboplus-Afloat projects.",
5
+ "author": "Okello Gerald",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "temboplus",
9
+ "afloat"
10
+ ],
11
+ "type": "module",
12
+ "sideEffects": false,
5
13
  "main": "./dist/index.cjs.js",
6
14
  "module": "./dist/index.esm.js",
7
15
  "types": "./dist/index.d.ts",
8
- "type": "module",
9
16
  "exports": {
10
17
  ".": {
18
+ "types": "./dist/index.d.ts",
11
19
  "import": "./dist/index.esm.js",
12
- "require": "./dist/index.cjs.js",
13
- "types": "./dist/index.d.ts"
20
+ "require": "./dist/index.cjs.js"
14
21
  }
15
22
  },
16
23
  "files": [
17
24
  "dist"
18
25
  ],
26
+ "engines": {
27
+ "node": ">=20",
28
+ "bun": ">=1.1"
29
+ },
19
30
  "scripts": {
20
- "build": "rollup -c rollup.config.js",
21
- "prepare": "npm run build",
22
- "dev": "npm run build -- --watch",
23
- "test": "echo \"Error: no test specified\" && exit 1"
31
+ "dev": "bun x rollup -c rollup.config.js --watch",
32
+ "build": "bun x rollup -c rollup.config.js",
33
+ "test": "bun test --pass-with-no-tests",
34
+ "lint": "bun x @biomejs/biome check src",
35
+ "format": "bun x @biomejs/biome check --write src",
36
+ "typecheck": "bun x tsc --noEmit",
37
+ "release": "echo 'Releases are tag-driven. Update CHANGELOG.md, bump version in package.json, then: git tag vX.Y.Z && git push origin main --tags'",
38
+ "prepublishOnly": "bun run typecheck && bun run test && bun run build"
24
39
  },
25
40
  "repository": {
26
41
  "type": "git",
27
- "url": "git+https://github.com/TemboPlus-Frontend/afloat-js.git"
42
+ "url": "git+https://github.com/TemboPlus-Frontend/temboplus-afloat.git"
28
43
  },
29
- "keywords": [
30
- "temboplus",
31
- "afloat"
32
- ],
33
- "author": "Okello Gerald",
34
- "license": "MIT",
35
44
  "bugs": {
36
- "url": "https://github.com/TemboPlus-Frontend/afloat-js/issues"
45
+ "url": "https://github.com/TemboPlus-Frontend/temboplus-afloat/issues"
46
+ },
47
+ "homepage": "https://github.com/TemboPlus-Frontend/temboplus-afloat#readme",
48
+ "publishConfig": {
49
+ "access": "public",
50
+ "registry": "https://registry.npmjs.org"
51
+ },
52
+ "dependencies": {
53
+ "@temboplus/frontend-core": "^1.0.3"
37
54
  },
38
- "homepage": "https://github.com/TemboPlus-Frontend/afloat-js#readme",
39
55
  "peerDependencies": {
40
- "@ts-rest/core": "^3.52.1",
56
+ "@ts-rest/core": "^3.53.0-rc.1",
41
57
  "tslib": "^2.8.1",
42
- "uuid": "^11.1.0",
43
- "zod": "^3.24.2"
58
+ "uuid": "^14.0.0",
59
+ "zod": "^4.4.3"
44
60
  },
45
61
  "devDependencies": {
62
+ "@biomejs/biome": "^2.4.16",
46
63
  "@rollup/plugin-alias": "^6.0.0",
47
64
  "@rollup/plugin-commonjs": "^29.0.0",
48
65
  "@rollup/plugin-json": "^6.1.0",
49
66
  "@rollup/plugin-node-resolve": "^16.0.3",
50
- "@rollup/plugin-terser": "^0.4.4",
67
+ "@rollup/plugin-terser": "^1.0.0",
51
68
  "@rollup/plugin-typescript": "^12.3.0",
52
- "@types/jest": "^30.0.0",
53
- "jest": "^30.2.0",
69
+ "@types/bun": "^1.3.14",
54
70
  "rollup": "^4.53.3",
55
- "ts-jest": "^29.4.6",
56
- "ts-node": "^10.9.2",
57
- "typescript": "^5.9.3"
58
- },
59
- "dependencies": {
60
- "@temboplus/frontend-core": "^1.0.2"
71
+ "typescript": "^6.0.3"
61
72
  }
62
73
  }