angles-javascript-client 3.1.1 → 3.1.2
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.
|
@@ -22,6 +22,17 @@ export declare class AttachmentRequests extends BaseRequests {
|
|
|
22
22
|
uploadAttachment(file: Blob, owner: AttachmentOwner, fileName?: string): Promise<Attachment>;
|
|
23
23
|
getAttachments(owner: AttachmentOwner): Promise<AttachmentsResponse>;
|
|
24
24
|
getAttachment(attachmentId: string): Promise<Attachment>;
|
|
25
|
+
/**
|
|
26
|
+
* Joins the configured baseURL to a path, tolerating either spelling of the boundary.
|
|
27
|
+
*
|
|
28
|
+
* `baseURL` is configured by the consuming application and both spellings are in the
|
|
29
|
+
* wild - angles-ui sets ".../rest/api/v1.0" with no trailing slash, while other callers
|
|
30
|
+
* include one. Concatenating blindly produces ".../v1.0attachment/<id>/thumbnail",
|
|
31
|
+
* which the router cannot match and returns as a 404. Relative request URLs never hit
|
|
32
|
+
* this because axios resolves those itself; only the URLs built here, for use as an
|
|
33
|
+
* <img src>, have to do the joining.
|
|
34
|
+
*/
|
|
35
|
+
private absoluteUrl;
|
|
25
36
|
/**
|
|
26
37
|
* The URL of the full-size image. Returned rather than fetched so it can be used
|
|
27
38
|
* directly as an <img src>, which is how the markdown `attachment:<id>` references in a
|
|
@@ -41,17 +41,33 @@ class AttachmentRequests extends BaseRequests_1.BaseRequests {
|
|
|
41
41
|
getAttachment(attachmentId) {
|
|
42
42
|
return this.get(`attachment/${attachmentId}`);
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Joins the configured baseURL to a path, tolerating either spelling of the boundary.
|
|
46
|
+
*
|
|
47
|
+
* `baseURL` is configured by the consuming application and both spellings are in the
|
|
48
|
+
* wild - angles-ui sets ".../rest/api/v1.0" with no trailing slash, while other callers
|
|
49
|
+
* include one. Concatenating blindly produces ".../v1.0attachment/<id>/thumbnail",
|
|
50
|
+
* which the router cannot match and returns as a 404. Relative request URLs never hit
|
|
51
|
+
* this because axios resolves those itself; only the URLs built here, for use as an
|
|
52
|
+
* <img src>, have to do the joining.
|
|
53
|
+
*/
|
|
54
|
+
absoluteUrl(path) {
|
|
55
|
+
const base = this.axios.defaults.baseURL || '';
|
|
56
|
+
if (!base)
|
|
57
|
+
return path;
|
|
58
|
+
return `${base.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
|
|
59
|
+
}
|
|
44
60
|
/**
|
|
45
61
|
* The URL of the full-size image. Returned rather than fetched so it can be used
|
|
46
62
|
* directly as an <img src>, which is how the markdown `attachment:<id>` references in a
|
|
47
63
|
* step's expected result are resolved.
|
|
48
64
|
*/
|
|
49
65
|
getAttachmentUrl(attachmentId) {
|
|
50
|
-
return
|
|
66
|
+
return this.absoluteUrl(`attachment/${attachmentId}/file`);
|
|
51
67
|
}
|
|
52
68
|
/** The thumbnail URL. Falls back to the original server-side, so it never 404s. */
|
|
53
69
|
getThumbnailUrl(attachmentId) {
|
|
54
|
-
return
|
|
70
|
+
return this.absoluteUrl(`attachment/${attachmentId}/thumbnail`);
|
|
55
71
|
}
|
|
56
72
|
/**
|
|
57
73
|
* Deletes an attachment. Rejected with 409 while any frozen test case version still
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentRequests.js","sourceRoot":"","sources":["../../../src/lib/requests/AttachmentRequests.ts"],"names":[],"mappings":";;;AACA,iDAA8C;AAY9C,MAAa,kBAAmB,SAAQ,2BAAY;IAElD,YAAmB,aAA4B;QAC7C,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACI,gBAAgB,CAAC,IAAU,EAAE,KAAsB,EAAE,QAAiB;QAC3E,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC,UAAU;YAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QACtE,IAAI,KAAK,CAAC,YAAY;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