recess-cli 3.2.0 → 3.3.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.
- package/dist/args.js +1 -0
- package/dist/cli.js +89 -1
- package/dist/command-schema.js +1 -0
- package/dist/help.js +6 -1
- package/package.json +1 -1
package/dist/args.js
CHANGED
package/dist/cli.js
CHANGED
|
@@ -255,7 +255,8 @@ async function localWriteCommand(parsed, preview, execute) {
|
|
|
255
255
|
fingerprint,
|
|
256
256
|
target: preview.target,
|
|
257
257
|
...(preview.action.startsWith("mastery.") ||
|
|
258
|
-
preview.request.attendanceTakenAt
|
|
258
|
+
preview.request.attendanceTakenAt ||
|
|
259
|
+
preview.request.zeroBalance === "true"
|
|
259
260
|
? { preview }
|
|
260
261
|
: {}),
|
|
261
262
|
});
|
|
@@ -3022,6 +3023,9 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3022
3023
|
...(userId ? { userId } : {}),
|
|
3023
3024
|
...(id ? { id } : {}),
|
|
3024
3025
|
limit,
|
|
3026
|
+
...(hasFlag(parsed, "include-archived")
|
|
3027
|
+
? { includeArchived: "true" }
|
|
3028
|
+
: {}),
|
|
3025
3029
|
...(flagString(parsed, "cursor")
|
|
3026
3030
|
? { cursor: flagString(parsed, "cursor") }
|
|
3027
3031
|
: {}),
|
|
@@ -3029,6 +3033,90 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3029
3033
|
},
|
|
3030
3034
|
}));
|
|
3031
3035
|
}
|
|
3036
|
+
if ((area === "recipients" &&
|
|
3037
|
+
["archive", "unarchive", "remove-schedule", "add-schedule"].includes(action)) ||
|
|
3038
|
+
(area === "payruns" && action === "remove-account")) {
|
|
3039
|
+
const accountId = area === "payruns"
|
|
3040
|
+
? flagString(parsed, "recipient", { required: true })
|
|
3041
|
+
: positional(parsed, 3, "account ID");
|
|
3042
|
+
const payRunId = area === "payruns" ? positional(parsed, 3, "payrun ID") : undefined;
|
|
3043
|
+
const scheduleId = action.endsWith("schedule")
|
|
3044
|
+
? flagString(parsed, "schedule", { required: true })
|
|
3045
|
+
: undefined;
|
|
3046
|
+
const account = unwrap(await api.client.GET("/admin/payout/recipient/", {
|
|
3047
|
+
params: { query: { id: accountId, includeArchived: "true" } },
|
|
3048
|
+
})).recipients[0];
|
|
3049
|
+
const zeroBalance = hasFlag(parsed, "zero-balance");
|
|
3050
|
+
// Keep the approved before-balance on retries, so the server can replay
|
|
3051
|
+
// a completed operation after the account has already been zeroed.
|
|
3052
|
+
const operationKey = flagString(parsed, "operation-key");
|
|
3053
|
+
const stored = zeroBalance && hasFlag(parsed, "confirm") && operationKey
|
|
3054
|
+
? await getJob(operationKey)
|
|
3055
|
+
: undefined;
|
|
3056
|
+
const approvedBalance = stored?.history.find((event) => event.preview?.request.zeroBalance === "true")?.preview?.request.expectedBalanceCents;
|
|
3057
|
+
const expectedBalanceCents = typeof approvedBalance === "number"
|
|
3058
|
+
? approvedBalance
|
|
3059
|
+
: account.accountBalance;
|
|
3060
|
+
const removalQuery = zeroBalance
|
|
3061
|
+
? {
|
|
3062
|
+
zeroBalance: "true",
|
|
3063
|
+
reason: flagString(parsed, "reason", { required: true }),
|
|
3064
|
+
expectedBalanceCents,
|
|
3065
|
+
}
|
|
3066
|
+
: {};
|
|
3067
|
+
const effects = action === "archive"
|
|
3068
|
+
? "Archive payout account, end all schedules and cancel all draft/review invoices. Stops new Recess accruals; preserves payment history and the guide login."
|
|
3069
|
+
: action === "unarchive"
|
|
3070
|
+
? "Unarchive payout account. Does not restore schedules or canceled invoices; add a schedule separately to resume payroll."
|
|
3071
|
+
: action === "remove-schedule"
|
|
3072
|
+
? "Remove account from recurring schedule and cancel its draft/review invoices for that schedule. Other schedules and payment history are preserved."
|
|
3073
|
+
: action === "add-schedule"
|
|
3074
|
+
? "Add active payout account to recurring schedule. Future payroll cycles will accrue compensation in Recess."
|
|
3075
|
+
: "Remove account from this payroll cycle and cancel its draft/review invoices. Future cycles are unchanged; regeneration will not re-add this account.";
|
|
3076
|
+
return writeCommand(parsed, {
|
|
3077
|
+
action: effects +
|
|
3078
|
+
(zeroBalance
|
|
3079
|
+
? " OVERRIDE: cancel unpaid OPEN invoices in this scope and set the entire account balance to zero. Invoice amounts and payment history are preserved; no money is sent. Pending payments and obligations outside this scope must be resolved first."
|
|
3080
|
+
: ""),
|
|
3081
|
+
target: {
|
|
3082
|
+
accountId,
|
|
3083
|
+
...(payRunId ? { payRunId } : {}),
|
|
3084
|
+
...(scheduleId ? { scheduleId } : {}),
|
|
3085
|
+
},
|
|
3086
|
+
request: { action, ...removalQuery },
|
|
3087
|
+
details: {
|
|
3088
|
+
accountName: account.name,
|
|
3089
|
+
user: account.user,
|
|
3090
|
+
...(zeroBalance
|
|
3091
|
+
? { previousBalanceCents: expectedBalanceCents, balanceCents: 0 }
|
|
3092
|
+
: {}),
|
|
3093
|
+
},
|
|
3094
|
+
}, async () => {
|
|
3095
|
+
if (action === "archive")
|
|
3096
|
+
return unwrap(await api.client.DELETE("/admin/payout/recipient/{accountId}", {
|
|
3097
|
+
params: { path: { accountId }, query: removalQuery },
|
|
3098
|
+
}));
|
|
3099
|
+
if (action === "unarchive")
|
|
3100
|
+
return unwrap(await api.client.POST("/admin/payout/recipient/{accountId}/unarchive", { params: { path: { accountId } } }));
|
|
3101
|
+
if (action === "add-schedule")
|
|
3102
|
+
return unwrap(await api.client.POST("/admin/payout/payrun/add-account/", {
|
|
3103
|
+
body: { accountId, scheduleId: scheduleId },
|
|
3104
|
+
}));
|
|
3105
|
+
if (action === "remove-schedule")
|
|
3106
|
+
return unwrap(await api.client.DELETE("/admin/payout/schedule/{targetId}/recipient/{accountId}", {
|
|
3107
|
+
params: {
|
|
3108
|
+
path: { accountId, targetId: scheduleId },
|
|
3109
|
+
query: removalQuery,
|
|
3110
|
+
},
|
|
3111
|
+
}));
|
|
3112
|
+
return unwrap(await api.client.DELETE("/admin/payout/cycle/{targetId}/recipient/{accountId}", {
|
|
3113
|
+
params: {
|
|
3114
|
+
path: { accountId, targetId: payRunId },
|
|
3115
|
+
query: removalQuery,
|
|
3116
|
+
},
|
|
3117
|
+
}));
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3032
3120
|
if (area === "invoices" && action === "list") {
|
|
3033
3121
|
const payRunId = flagString(parsed, "payrun");
|
|
3034
3122
|
const accountId = flagString(parsed, "recipient");
|
package/dist/command-schema.js
CHANGED
package/dist/help.js
CHANGED
|
@@ -130,10 +130,15 @@ Usage:
|
|
|
130
130
|
recess [--json] billing cancel-subscription --subscription <id>
|
|
131
131
|
[--immediate] [--reason TEXT] [--restore] [--confirm]
|
|
132
132
|
recess [--json] payout payruns list [--status A,B] [--schedule <id>]
|
|
133
|
-
recess [--json] payout recipients list [--search <name>] [--user <id>] [--id <id>]
|
|
133
|
+
recess [--json] payout recipients list [--search <name>] [--user <id>] [--id <id>] [--include-archived]
|
|
134
134
|
[--limit 20] [--cursor <id>]
|
|
135
135
|
recess [--json] payout invoices list [--payrun <id>] [--recipient <account-id>]
|
|
136
136
|
[--user <id>] [--status A,B] (at least one filter)
|
|
137
|
+
recess [--json] payout recipients archive <account-id> [--zero-balance] [--confirm]
|
|
138
|
+
recess [--json] payout recipients unarchive <account-id> [--confirm]
|
|
139
|
+
recess [--json] payout recipients remove-schedule <account-id> --schedule <id> [--zero-balance] [--confirm]
|
|
140
|
+
recess [--json] payout recipients add-schedule <account-id> --schedule <id> [--confirm]
|
|
141
|
+
recess [--json] payout payruns remove-account <payrun-id> --recipient <account-id> [--zero-balance] [--confirm]
|
|
137
142
|
recess [--json] payout invoices get <invoice-id>
|
|
138
143
|
recess [--json] payout invoices set-status <invoice-id>
|
|
139
144
|
--status IN_REVIEW|OPEN|PAID|CANCELED [--send-email] [--confirm]
|