@teamkeel/functions-runtime 0.443.0 → 0.444.0
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/index.cjs +15 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2103,26 +2103,35 @@ var Task = class {
|
|
|
2103
2103
|
this.deferredUntil = data.deferredUntil ? new Date(data.deferredUntil) : null;
|
|
2104
2104
|
this.createdAt = new Date(data.createdAt);
|
|
2105
2105
|
this.updatedAt = new Date(data.updatedAt);
|
|
2106
|
-
this.
|
|
2106
|
+
this.assignedToUserId = data.assignedToUser ?? null;
|
|
2107
|
+
this.assignedToTeam = data.assignedToTeam ?? null;
|
|
2107
2108
|
this.assignedAt = data.assignedAt ? new Date(data.assignedAt) : null;
|
|
2108
2109
|
this.resolvedAt = data.resolvedAt ? new Date(data.resolvedAt) : null;
|
|
2109
2110
|
this.flowRunId = data.flowRunId ?? null;
|
|
2110
2111
|
}
|
|
2111
2112
|
/**
|
|
2112
|
-
* Assigns the task to
|
|
2113
|
-
* @param {Object} options Options containing
|
|
2114
|
-
* @param {string} options.
|
|
2113
|
+
* Assigns the task to a user or team.
|
|
2114
|
+
* @param {Object} options Options containing userId or teamName (exactly one required)
|
|
2115
|
+
* @param {string} [options.userId] The ID of the user to assign the task to
|
|
2116
|
+
* @param {string} [options.teamName] The name of the team to assign the task to
|
|
2115
2117
|
* @returns {Promise<void>}
|
|
2116
2118
|
*/
|
|
2117
|
-
async assign({
|
|
2119
|
+
async assign({ userId, teamName }) {
|
|
2118
2120
|
const name = spanNameForModelAPI(this._taskName, "assign");
|
|
2119
2121
|
return withSpan(name, async () => {
|
|
2120
2122
|
const apiUrl = getApiUrl();
|
|
2121
2123
|
const url = `${apiUrl}/topics/json/${this._taskName}/tasks/${this.id}/assign`;
|
|
2124
|
+
const body = {};
|
|
2125
|
+
if (userId !== void 0) {
|
|
2126
|
+
body.assigned_to_user = userId;
|
|
2127
|
+
}
|
|
2128
|
+
if (teamName !== void 0) {
|
|
2129
|
+
body.assigned_to_team = teamName;
|
|
2130
|
+
}
|
|
2122
2131
|
const response = await fetch(url, {
|
|
2123
2132
|
method: "PUT",
|
|
2124
2133
|
headers: buildHeaders(this._identity, this._authToken),
|
|
2125
|
-
body: JSON.stringify(
|
|
2134
|
+
body: JSON.stringify(body)
|
|
2126
2135
|
});
|
|
2127
2136
|
if (!response.ok) {
|
|
2128
2137
|
const errorBody = await response.json().catch(() => ({}));
|