microboard-temp 0.5.109 → 0.5.111

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.
@@ -676,6 +676,7 @@ __export(exports_browser, {
676
676
  getRandomNumber: () => getRandomNumber,
677
677
  getQuickAddButtons: () => getQuickAddButtons,
678
678
  getPlaceholderImage: () => getPlaceholderImage,
679
+ getMediaSignedUrl: () => getMediaSignedUrl,
679
680
  getHotkeyLabel: () => getHotkeyLabel,
680
681
  getControlPointData: () => getControlPointData,
681
682
  getBlobFromDataURL: () => getBlobFromDataURL,
@@ -41357,6 +41358,47 @@ var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
41357
41358
  throw error;
41358
41359
  }
41359
41360
  };
41361
+ function getAccessTypeFromUrl(url) {
41362
+ try {
41363
+ const urlObject = new URL(url);
41364
+ const pathname = urlObject.pathname;
41365
+ const parts = pathname.split("/").filter((part) => part.length > 0);
41366
+ if (parts.length > 2) {
41367
+ return parts[2];
41368
+ }
41369
+ } catch (error) {
41370
+ const parts = url.split("/");
41371
+ if (parts.length > 2 && parts[0] === "v1") {
41372
+ return parts[2];
41373
+ }
41374
+ }
41375
+ return null;
41376
+ }
41377
+ var getMediaSignedUrl = async (url, accessToken) => {
41378
+ const accessType = getAccessTypeFromUrl(url);
41379
+ if (!accessType) {
41380
+ return null;
41381
+ }
41382
+ if (accessType === "anonymous") {
41383
+ return url;
41384
+ }
41385
+ try {
41386
+ const response = await fetch(url, {
41387
+ method: "HEAD",
41388
+ headers: {
41389
+ Authorization: `Bearer ${accessToken}`
41390
+ }
41391
+ });
41392
+ if (!response.ok) {
41393
+ console.error("Failed to get media signed url:", response.status, response.statusText);
41394
+ return null;
41395
+ }
41396
+ return response.url;
41397
+ } catch (error) {
41398
+ console.error("Error resolving redirect URL:", error);
41399
+ return null;
41400
+ }
41401
+ };
41360
41402
 
41361
41403
  // src/Items/Image/ImageHelpers.ts
41362
41404
  var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
package/dist/cjs/index.js CHANGED
@@ -676,6 +676,7 @@ __export(exports_src, {
676
676
  getRandomNumber: () => getRandomNumber,
677
677
  getQuickAddButtons: () => getQuickAddButtons,
678
678
  getPlaceholderImage: () => getPlaceholderImage,
679
+ getMediaSignedUrl: () => getMediaSignedUrl,
679
680
  getHotkeyLabel: () => getHotkeyLabel,
680
681
  getControlPointData: () => getControlPointData,
681
682
  getBlobFromDataURL: () => getBlobFromDataURL,
@@ -41357,6 +41358,47 @@ var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
41357
41358
  throw error;
41358
41359
  }
41359
41360
  };
41361
+ function getAccessTypeFromUrl(url) {
41362
+ try {
41363
+ const urlObject = new URL(url);
41364
+ const pathname = urlObject.pathname;
41365
+ const parts = pathname.split("/").filter((part) => part.length > 0);
41366
+ if (parts.length > 2) {
41367
+ return parts[2];
41368
+ }
41369
+ } catch (error) {
41370
+ const parts = url.split("/");
41371
+ if (parts.length > 2 && parts[0] === "v1") {
41372
+ return parts[2];
41373
+ }
41374
+ }
41375
+ return null;
41376
+ }
41377
+ var getMediaSignedUrl = async (url, accessToken) => {
41378
+ const accessType = getAccessTypeFromUrl(url);
41379
+ if (!accessType) {
41380
+ return null;
41381
+ }
41382
+ if (accessType === "anonymous") {
41383
+ return url;
41384
+ }
41385
+ try {
41386
+ const response = await fetch(url, {
41387
+ method: "HEAD",
41388
+ headers: {
41389
+ Authorization: `Bearer ${accessToken}`
41390
+ }
41391
+ });
41392
+ if (!response.ok) {
41393
+ console.error("Failed to get media signed url:", response.status, response.statusText);
41394
+ return null;
41395
+ }
41396
+ return response.url;
41397
+ } catch (error) {
41398
+ console.error("Error resolving redirect URL:", error);
41399
+ return null;
41400
+ }
41401
+ };
41360
41402
 
41361
41403
  // src/Items/Image/ImageHelpers.ts
41362
41404
  var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
package/dist/cjs/node.js CHANGED
@@ -1713,6 +1713,7 @@ __export(exports_node, {
1713
1713
  getRandomNumber: () => getRandomNumber,
1714
1714
  getQuickAddButtons: () => getQuickAddButtons,
1715
1715
  getPlaceholderImage: () => getPlaceholderImage,
1716
+ getMediaSignedUrl: () => getMediaSignedUrl,
1716
1717
  getHotkeyLabel: () => getHotkeyLabel,
1717
1718
  getControlPointData: () => getControlPointData,
1718
1719
  getBlobFromDataURL: () => getBlobFromDataURL,
@@ -43830,6 +43831,47 @@ var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
43830
43831
  throw error;
43831
43832
  }
43832
43833
  };
43834
+ function getAccessTypeFromUrl(url) {
43835
+ try {
43836
+ const urlObject = new URL(url);
43837
+ const pathname = urlObject.pathname;
43838
+ const parts = pathname.split("/").filter((part) => part.length > 0);
43839
+ if (parts.length > 2) {
43840
+ return parts[2];
43841
+ }
43842
+ } catch (error) {
43843
+ const parts = url.split("/");
43844
+ if (parts.length > 2 && parts[0] === "v1") {
43845
+ return parts[2];
43846
+ }
43847
+ }
43848
+ return null;
43849
+ }
43850
+ var getMediaSignedUrl = async (url, accessToken) => {
43851
+ const accessType = getAccessTypeFromUrl(url);
43852
+ if (!accessType) {
43853
+ return null;
43854
+ }
43855
+ if (accessType === "anonymous") {
43856
+ return url;
43857
+ }
43858
+ try {
43859
+ const response = await fetch(url, {
43860
+ method: "HEAD",
43861
+ headers: {
43862
+ Authorization: `Bearer ${accessToken}`
43863
+ }
43864
+ });
43865
+ if (!response.ok) {
43866
+ console.error("Failed to get media signed url:", response.status, response.statusText);
43867
+ return null;
43868
+ }
43869
+ return response.url;
43870
+ } catch (error) {
43871
+ console.error("Error resolving redirect URL:", error);
43872
+ return null;
43873
+ }
43874
+ };
43833
43875
 
43834
43876
  // src/Items/Image/ImageHelpers.ts
43835
43877
  var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
@@ -41202,6 +41202,47 @@ var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
41202
41202
  throw error;
41203
41203
  }
41204
41204
  };
41205
+ function getAccessTypeFromUrl(url) {
41206
+ try {
41207
+ const urlObject = new URL(url);
41208
+ const pathname = urlObject.pathname;
41209
+ const parts = pathname.split("/").filter((part) => part.length > 0);
41210
+ if (parts.length > 2) {
41211
+ return parts[2];
41212
+ }
41213
+ } catch (error) {
41214
+ const parts = url.split("/");
41215
+ if (parts.length > 2 && parts[0] === "v1") {
41216
+ return parts[2];
41217
+ }
41218
+ }
41219
+ return null;
41220
+ }
41221
+ var getMediaSignedUrl = async (url, accessToken) => {
41222
+ const accessType = getAccessTypeFromUrl(url);
41223
+ if (!accessType) {
41224
+ return null;
41225
+ }
41226
+ if (accessType === "anonymous") {
41227
+ return url;
41228
+ }
41229
+ try {
41230
+ const response = await fetch(url, {
41231
+ method: "HEAD",
41232
+ headers: {
41233
+ Authorization: `Bearer ${accessToken}`
41234
+ }
41235
+ });
41236
+ if (!response.ok) {
41237
+ console.error("Failed to get media signed url:", response.status, response.statusText);
41238
+ return null;
41239
+ }
41240
+ return response.url;
41241
+ } catch (error) {
41242
+ console.error("Error resolving redirect URL:", error);
41243
+ return null;
41244
+ }
41245
+ };
41205
41246
 
41206
41247
  // src/Items/Image/ImageHelpers.ts
41207
41248
  var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
@@ -57111,6 +57152,7 @@ export {
57111
57152
  getRandomNumber,
57112
57153
  getQuickAddButtons,
57113
57154
  getPlaceholderImage,
57155
+ getMediaSignedUrl,
57114
57156
  getHotkeyLabel,
57115
57157
  getControlPointData,
57116
57158
  getBlobFromDataURL,
package/dist/esm/index.js CHANGED
@@ -41195,6 +41195,47 @@ var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
41195
41195
  throw error;
41196
41196
  }
41197
41197
  };
41198
+ function getAccessTypeFromUrl(url) {
41199
+ try {
41200
+ const urlObject = new URL(url);
41201
+ const pathname = urlObject.pathname;
41202
+ const parts = pathname.split("/").filter((part) => part.length > 0);
41203
+ if (parts.length > 2) {
41204
+ return parts[2];
41205
+ }
41206
+ } catch (error) {
41207
+ const parts = url.split("/");
41208
+ if (parts.length > 2 && parts[0] === "v1") {
41209
+ return parts[2];
41210
+ }
41211
+ }
41212
+ return null;
41213
+ }
41214
+ var getMediaSignedUrl = async (url, accessToken) => {
41215
+ const accessType = getAccessTypeFromUrl(url);
41216
+ if (!accessType) {
41217
+ return null;
41218
+ }
41219
+ if (accessType === "anonymous") {
41220
+ return url;
41221
+ }
41222
+ try {
41223
+ const response = await fetch(url, {
41224
+ method: "HEAD",
41225
+ headers: {
41226
+ Authorization: `Bearer ${accessToken}`
41227
+ }
41228
+ });
41229
+ if (!response.ok) {
41230
+ console.error("Failed to get media signed url:", response.status, response.statusText);
41231
+ return null;
41232
+ }
41233
+ return response.url;
41234
+ } catch (error) {
41235
+ console.error("Error resolving redirect URL:", error);
41236
+ return null;
41237
+ }
41238
+ };
41198
41239
 
41199
41240
  // src/Items/Image/ImageHelpers.ts
41200
41241
  var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
@@ -57009,6 +57050,7 @@ export {
57009
57050
  getRandomNumber,
57010
57051
  getQuickAddButtons,
57011
57052
  getPlaceholderImage,
57053
+ getMediaSignedUrl,
57012
57054
  getHotkeyLabel,
57013
57055
  getControlPointData,
57014
57056
  getBlobFromDataURL,
package/dist/esm/node.js CHANGED
@@ -43663,6 +43663,47 @@ var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
43663
43663
  throw error;
43664
43664
  }
43665
43665
  };
43666
+ function getAccessTypeFromUrl(url) {
43667
+ try {
43668
+ const urlObject = new URL(url);
43669
+ const pathname = urlObject.pathname;
43670
+ const parts = pathname.split("/").filter((part) => part.length > 0);
43671
+ if (parts.length > 2) {
43672
+ return parts[2];
43673
+ }
43674
+ } catch (error) {
43675
+ const parts = url.split("/");
43676
+ if (parts.length > 2 && parts[0] === "v1") {
43677
+ return parts[2];
43678
+ }
43679
+ }
43680
+ return null;
43681
+ }
43682
+ var getMediaSignedUrl = async (url, accessToken) => {
43683
+ const accessType = getAccessTypeFromUrl(url);
43684
+ if (!accessType) {
43685
+ return null;
43686
+ }
43687
+ if (accessType === "anonymous") {
43688
+ return url;
43689
+ }
43690
+ try {
43691
+ const response = await fetch(url, {
43692
+ method: "HEAD",
43693
+ headers: {
43694
+ Authorization: `Bearer ${accessToken}`
43695
+ }
43696
+ });
43697
+ if (!response.ok) {
43698
+ console.error("Failed to get media signed url:", response.status, response.statusText);
43699
+ return null;
43700
+ }
43701
+ return response.url;
43702
+ } catch (error) {
43703
+ console.error("Error resolving redirect URL:", error);
43704
+ return null;
43705
+ }
43706
+ };
43666
43707
 
43667
43708
  // src/Items/Image/ImageHelpers.ts
43668
43709
  var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
@@ -59644,6 +59685,7 @@ export {
59644
59685
  getRandomNumber,
59645
59686
  getQuickAddButtons,
59646
59687
  getPlaceholderImage,
59688
+ getMediaSignedUrl,
59647
59689
  getHotkeyLabel,
59648
59690
  getControlPointData,
59649
59691
  getBlobFromDataURL,
@@ -1 +1,2 @@
1
1
  export declare const uploadMediaToStorage: (blob: Blob, accessToken: string | null, boardId: string, type: "video" | "audio" | "image") => Promise<string>;
2
+ export declare const getMediaSignedUrl: (url: string, accessToken: string) => Promise<string | null>;
@@ -23,3 +23,4 @@ export * from "./parserHTML";
23
23
  export * from "./sha256";
24
24
  export * from "./lib";
25
25
  export { initI18N } from "./api/initI18N";
26
+ export { getMediaSignedUrl } from "./api/MediaHelpers";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.109",
3
+ "version": "0.5.111",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",