@teamkeel/functions-runtime 0.443.0 → 0.445.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 +32 -8
- 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 +32 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -272,18 +272,21 @@ declare class Task$1 {
|
|
|
272
272
|
deferredUntil: Date | null | undefined;
|
|
273
273
|
createdAt: Date | undefined;
|
|
274
274
|
updatedAt: Date | undefined;
|
|
275
|
-
|
|
275
|
+
assignedToUserId: any;
|
|
276
|
+
assignedToTeam: any;
|
|
276
277
|
assignedAt: Date | null | undefined;
|
|
277
278
|
resolvedAt: Date | null | undefined;
|
|
278
279
|
flowRunId: any;
|
|
279
280
|
/**
|
|
280
|
-
* Assigns the task to
|
|
281
|
-
* @param {Object} options Options containing
|
|
282
|
-
* @param {string} options.
|
|
281
|
+
* Assigns the task to a user or team.
|
|
282
|
+
* @param {Object} options Options containing userId or teamName (exactly one required)
|
|
283
|
+
* @param {string} [options.userId] The ID of the user to assign the task to
|
|
284
|
+
* @param {string} [options.teamName] The name of the team to assign the task to
|
|
283
285
|
* @returns {Promise<void>}
|
|
284
286
|
*/
|
|
285
|
-
assign({
|
|
286
|
-
|
|
287
|
+
assign({ userId, teamName }: {
|
|
288
|
+
userId?: string | undefined;
|
|
289
|
+
teamName?: string | undefined;
|
|
287
290
|
}): Promise<void>;
|
|
288
291
|
/**
|
|
289
292
|
* Starts the task, creating and running the associated flow.
|
|
@@ -1564,7 +1567,8 @@ type Task = {
|
|
|
1564
1567
|
deferredUntil?: Date;
|
|
1565
1568
|
createdAt: Date;
|
|
1566
1569
|
updatedAt: Date;
|
|
1567
|
-
|
|
1570
|
+
assignedToUserId?: string;
|
|
1571
|
+
assignedToTeam?: string;
|
|
1568
1572
|
assignedAt?: Date;
|
|
1569
1573
|
resolvedAt?: Date;
|
|
1570
1574
|
flowRunId?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -272,18 +272,21 @@ declare class Task$1 {
|
|
|
272
272
|
deferredUntil: Date | null | undefined;
|
|
273
273
|
createdAt: Date | undefined;
|
|
274
274
|
updatedAt: Date | undefined;
|
|
275
|
-
|
|
275
|
+
assignedToUserId: any;
|
|
276
|
+
assignedToTeam: any;
|
|
276
277
|
assignedAt: Date | null | undefined;
|
|
277
278
|
resolvedAt: Date | null | undefined;
|
|
278
279
|
flowRunId: any;
|
|
279
280
|
/**
|
|
280
|
-
* Assigns the task to
|
|
281
|
-
* @param {Object} options Options containing
|
|
282
|
-
* @param {string} options.
|
|
281
|
+
* Assigns the task to a user or team.
|
|
282
|
+
* @param {Object} options Options containing userId or teamName (exactly one required)
|
|
283
|
+
* @param {string} [options.userId] The ID of the user to assign the task to
|
|
284
|
+
* @param {string} [options.teamName] The name of the team to assign the task to
|
|
283
285
|
* @returns {Promise<void>}
|
|
284
286
|
*/
|
|
285
|
-
assign({
|
|
286
|
-
|
|
287
|
+
assign({ userId, teamName }: {
|
|
288
|
+
userId?: string | undefined;
|
|
289
|
+
teamName?: string | undefined;
|
|
287
290
|
}): Promise<void>;
|
|
288
291
|
/**
|
|
289
292
|
* Starts the task, creating and running the associated flow.
|
|
@@ -1564,7 +1567,8 @@ type Task = {
|
|
|
1564
1567
|
deferredUntil?: Date;
|
|
1565
1568
|
createdAt: Date;
|
|
1566
1569
|
updatedAt: Date;
|
|
1567
|
-
|
|
1570
|
+
assignedToUserId?: string;
|
|
1571
|
+
assignedToTeam?: string;
|
|
1568
1572
|
assignedAt?: Date;
|
|
1569
1573
|
resolvedAt?: Date;
|
|
1570
1574
|
flowRunId?: string;
|
package/dist/index.js
CHANGED
|
@@ -600,6 +600,21 @@ var s3Client = (() => {
|
|
|
600
600
|
credentials: fromEnv()
|
|
601
601
|
});
|
|
602
602
|
})();
|
|
603
|
+
function rewriteFilesDomain(url) {
|
|
604
|
+
const domain = process.env.KEEL_FILES_DOMAIN;
|
|
605
|
+
if (domain) {
|
|
606
|
+
const override = new URL(domain);
|
|
607
|
+
url.protocol = override.protocol;
|
|
608
|
+
url.hostname = override.hostname;
|
|
609
|
+
url.port = override.port;
|
|
610
|
+
const overridePath = override.pathname.replace(/\/+$/, "");
|
|
611
|
+
if (overridePath && overridePath !== "/") {
|
|
612
|
+
url.pathname = overridePath + url.pathname;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return url;
|
|
616
|
+
}
|
|
617
|
+
__name(rewriteFilesDomain, "rewriteFilesDomain");
|
|
603
618
|
var InlineFile = class _InlineFile {
|
|
604
619
|
static {
|
|
605
620
|
__name(this, "InlineFile");
|
|
@@ -739,7 +754,7 @@ var File = class _File extends InlineFile {
|
|
|
739
754
|
ResponseContentDisposition: "inline"
|
|
740
755
|
});
|
|
741
756
|
const url = await getSignedUrl(s3Client, command, { expiresIn: 60 * 60 });
|
|
742
|
-
return new URL(url);
|
|
757
|
+
return rewriteFilesDomain(new URL(url));
|
|
743
758
|
}
|
|
744
759
|
// Generates a presigned upload URL. If the file doesn't have a key, a new one will be generated
|
|
745
760
|
async getPresignedUploadUrl() {
|
|
@@ -754,7 +769,7 @@ var File = class _File extends InlineFile {
|
|
|
754
769
|
Key: "files/" + this.key
|
|
755
770
|
});
|
|
756
771
|
const url = await getSignedUrl(s3Client, command, { expiresIn: 60 * 60 });
|
|
757
|
-
return new URL(url);
|
|
772
|
+
return rewriteFilesDomain(new URL(url));
|
|
758
773
|
}
|
|
759
774
|
// Persists the file
|
|
760
775
|
toDbRecord() {
|
|
@@ -2051,26 +2066,35 @@ var Task = class {
|
|
|
2051
2066
|
this.deferredUntil = data.deferredUntil ? new Date(data.deferredUntil) : null;
|
|
2052
2067
|
this.createdAt = new Date(data.createdAt);
|
|
2053
2068
|
this.updatedAt = new Date(data.updatedAt);
|
|
2054
|
-
this.
|
|
2069
|
+
this.assignedToUserId = data.assignedToUser ?? null;
|
|
2070
|
+
this.assignedToTeam = data.assignedToTeam ?? null;
|
|
2055
2071
|
this.assignedAt = data.assignedAt ? new Date(data.assignedAt) : null;
|
|
2056
2072
|
this.resolvedAt = data.resolvedAt ? new Date(data.resolvedAt) : null;
|
|
2057
2073
|
this.flowRunId = data.flowRunId ?? null;
|
|
2058
2074
|
}
|
|
2059
2075
|
/**
|
|
2060
|
-
* Assigns the task to
|
|
2061
|
-
* @param {Object} options Options containing
|
|
2062
|
-
* @param {string} options.
|
|
2076
|
+
* Assigns the task to a user or team.
|
|
2077
|
+
* @param {Object} options Options containing userId or teamName (exactly one required)
|
|
2078
|
+
* @param {string} [options.userId] The ID of the user to assign the task to
|
|
2079
|
+
* @param {string} [options.teamName] The name of the team to assign the task to
|
|
2063
2080
|
* @returns {Promise<void>}
|
|
2064
2081
|
*/
|
|
2065
|
-
async assign({
|
|
2082
|
+
async assign({ userId, teamName }) {
|
|
2066
2083
|
const name = spanNameForModelAPI(this._taskName, "assign");
|
|
2067
2084
|
return withSpan(name, async () => {
|
|
2068
2085
|
const apiUrl = getApiUrl();
|
|
2069
2086
|
const url = `${apiUrl}/topics/json/${this._taskName}/tasks/${this.id}/assign`;
|
|
2087
|
+
const body = {};
|
|
2088
|
+
if (userId !== void 0) {
|
|
2089
|
+
body.assigned_to_user = userId;
|
|
2090
|
+
}
|
|
2091
|
+
if (teamName !== void 0) {
|
|
2092
|
+
body.assigned_to_team = teamName;
|
|
2093
|
+
}
|
|
2070
2094
|
const response = await fetch(url, {
|
|
2071
2095
|
method: "PUT",
|
|
2072
2096
|
headers: buildHeaders(this._identity, this._authToken),
|
|
2073
|
-
body: JSON.stringify(
|
|
2097
|
+
body: JSON.stringify(body)
|
|
2074
2098
|
});
|
|
2075
2099
|
if (!response.ok) {
|
|
2076
2100
|
const errorBody = await response.json().catch(() => ({}));
|