next-tinacms-azure 0.0.0-db8aa8e-20250228034006 → 0.0.0-dced6ab-20250611061422

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/README.md CHANGED
@@ -61,7 +61,7 @@ Call `createMediaHandler` to set up routes and connect your instance of the Medi
61
61
 
62
62
  Import `isAuthorized` from `next-tinacms-azure`.
63
63
 
64
- The `authorized` key will make it so only authorized users within Tina Cloud can upload and make media edits.
64
+ The `authorized` key will make it so only authorized users within TinaCloud can upload and make media edits.
65
65
 
66
66
  ```ts
67
67
  // route.ts
package/dist/auth.js CHANGED
@@ -697,7 +697,7 @@ var require_headers = __commonJS({
697
697
  }
698
698
  const lowercased = prop.toLowerCase();
699
699
  const original = Object.keys(headers2).find((o) => o.toLowerCase() === lowercased);
700
- return _reflect.ReflectAdapter.set(target, original != null ? original : prop, value, receiver);
700
+ return _reflect.ReflectAdapter.set(target, original ?? prop, value, receiver);
701
701
  },
702
702
  has(target, prop) {
703
703
  if (typeof prop === "symbol") return _reflect.ReflectAdapter.has(target, prop);
@@ -412,14 +412,13 @@ var require_next_url = __commonJS({
412
412
  options = opts || baseOrOpts || {};
413
413
  }
414
414
  this[Internal] = {
415
- url: parseURL(input, base != null ? base : options.base),
415
+ url: parseURL(input, base ?? options.base),
416
416
  options,
417
417
  basePath: ""
418
418
  };
419
419
  this.analyze();
420
420
  }
421
421
  analyze() {
422
- var _a, _b;
423
422
  var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig, _this_Internal_domainLocale, _this_Internal_options_nextConfig_i18n1, _this_Internal_options_nextConfig1;
424
423
  const info = (0, _getnextpathnameinfo.getNextPathnameInfo)(this[Internal].url.pathname, {
425
424
  nextConfig: this[Internal].options.nextConfig,
@@ -431,9 +430,9 @@ var require_next_url = __commonJS({
431
430
  const defaultLocale = ((_this_Internal_domainLocale = this[Internal].domainLocale) == null ? void 0 : _this_Internal_domainLocale.defaultLocale) || ((_this_Internal_options_nextConfig1 = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n1 = _this_Internal_options_nextConfig1.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n1.defaultLocale);
432
431
  this[Internal].url.pathname = info.pathname;
433
432
  this[Internal].defaultLocale = defaultLocale;
434
- this[Internal].basePath = (_a = info.basePath) != null ? _a : "";
433
+ this[Internal].basePath = info.basePath ?? "";
435
434
  this[Internal].buildId = info.buildId;
436
- this[Internal].locale = (_b = info.locale) != null ? _b : defaultLocale;
435
+ this[Internal].locale = info.locale ?? defaultLocale;
437
436
  this[Internal].trailingSlash = info.trailingSlash;
438
437
  }
439
438
  formatPathname() {
@@ -456,8 +455,7 @@ var require_next_url = __commonJS({
456
455
  this[Internal].buildId = buildId;
457
456
  }
458
457
  get locale() {
459
- var _a;
460
- return (_a = this[Internal].locale) != null ? _a : "";
458
+ return this[Internal].locale ?? "";
461
459
  }
462
460
  set locale(locale) {
463
461
  var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig;
@@ -1332,8 +1330,7 @@ var require_response = __commonJS({
1332
1330
  return new _NextResponse(response.body, response);
1333
1331
  }
1334
1332
  static redirect(url, init) {
1335
- var _a;
1336
- const status = typeof init === "number" ? init : (_a = init == null ? void 0 : init.status) != null ? _a : 307;
1333
+ const status = typeof init === "number" ? init : (init == null ? void 0 : init.status) ?? 307;
1337
1334
  if (!REDIRECTS.has(status)) {
1338
1335
  throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
1339
1336
  }
@@ -1717,7 +1714,6 @@ var SUPPORTED_IMAGE_TYPES = [
1717
1714
  var createMediaDeliveryHandlers = (config) => {
1718
1715
  return {
1719
1716
  async GET(req, context) {
1720
- var _a, _b;
1721
1717
  try {
1722
1718
  const accountNameMatch = /AccountName=([^;]+)/.exec(
1723
1719
  config.connectionString
@@ -1806,10 +1802,10 @@ var createMediaDeliveryHandlers = (config) => {
1806
1802
  }
1807
1803
  let outputFormat = "jpeg";
1808
1804
  let outputContentType = "image/jpeg";
1809
- if (format === "webp" || format === "auto" && ((_a = req.headers.get("accept")) == null ? void 0 : _a.includes("image/webp"))) {
1805
+ if (format === "webp" || format === "auto" && req.headers.get("accept")?.includes("image/webp")) {
1810
1806
  outputFormat = "webp";
1811
1807
  outputContentType = "image/webp";
1812
- } else if (format === "avif" || format === "auto" && ((_b = req.headers.get("accept")) == null ? void 0 : _b.includes("image/avif"))) {
1808
+ } else if (format === "avif" || format === "auto" && req.headers.get("accept")?.includes("image/avif")) {
1813
1809
  outputFormat = "avif";
1814
1810
  outputContentType = "image/avif";
1815
1811
  }
@@ -1830,7 +1826,10 @@ var createMediaDeliveryHandlers = (config) => {
1830
1826
  console.warn("Falling back to original image");
1831
1827
  const originalBuffer = Buffer.from(buffer);
1832
1828
  const headers = new Headers(response.headers);
1833
- headers.set("content-type", contentType || "application/octet-stream");
1829
+ headers.set(
1830
+ "content-type",
1831
+ contentType || "application/octet-stream"
1832
+ );
1834
1833
  headers.set("content-length", originalBuffer.length.toString());
1835
1834
  headers.set("cache-control", "public, max-age=3600");
1836
1835
  return new import_server.NextResponse(originalBuffer, {
package/dist/handlers.js CHANGED
@@ -412,14 +412,13 @@ var require_next_url = __commonJS({
412
412
  options = opts || baseOrOpts || {};
413
413
  }
414
414
  this[Internal] = {
415
- url: parseURL(input, base != null ? base : options.base),
415
+ url: parseURL(input, base ?? options.base),
416
416
  options,
417
417
  basePath: ""
418
418
  };
419
419
  this.analyze();
420
420
  }
421
421
  analyze() {
422
- var _a, _b;
423
422
  var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig, _this_Internal_domainLocale, _this_Internal_options_nextConfig_i18n1, _this_Internal_options_nextConfig1;
424
423
  const info = (0, _getnextpathnameinfo.getNextPathnameInfo)(this[Internal].url.pathname, {
425
424
  nextConfig: this[Internal].options.nextConfig,
@@ -431,9 +430,9 @@ var require_next_url = __commonJS({
431
430
  const defaultLocale = ((_this_Internal_domainLocale = this[Internal].domainLocale) == null ? void 0 : _this_Internal_domainLocale.defaultLocale) || ((_this_Internal_options_nextConfig1 = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n1 = _this_Internal_options_nextConfig1.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n1.defaultLocale);
432
431
  this[Internal].url.pathname = info.pathname;
433
432
  this[Internal].defaultLocale = defaultLocale;
434
- this[Internal].basePath = (_a = info.basePath) != null ? _a : "";
433
+ this[Internal].basePath = info.basePath ?? "";
435
434
  this[Internal].buildId = info.buildId;
436
- this[Internal].locale = (_b = info.locale) != null ? _b : defaultLocale;
435
+ this[Internal].locale = info.locale ?? defaultLocale;
437
436
  this[Internal].trailingSlash = info.trailingSlash;
438
437
  }
439
438
  formatPathname() {
@@ -456,8 +455,7 @@ var require_next_url = __commonJS({
456
455
  this[Internal].buildId = buildId;
457
456
  }
458
457
  get locale() {
459
- var _a;
460
- return (_a = this[Internal].locale) != null ? _a : "";
458
+ return this[Internal].locale ?? "";
461
459
  }
462
460
  set locale(locale) {
463
461
  var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig;
@@ -1332,8 +1330,7 @@ var require_response = __commonJS({
1332
1330
  return new _NextResponse(response.body, response);
1333
1331
  }
1334
1332
  static redirect(url, init) {
1335
- var _a;
1336
- const status = typeof init === "number" ? init : (_a = init == null ? void 0 : init.status) != null ? _a : 307;
1333
+ const status = typeof init === "number" ? init : (init == null ? void 0 : init.status) ?? 307;
1337
1334
  if (!REDIRECTS.has(status)) {
1338
1335
  throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
1339
1336
  }
@@ -1705,7 +1702,7 @@ __export(handlers_exports, {
1705
1702
  });
1706
1703
  module.exports = __toCommonJS(handlers_exports);
1707
1704
  var import_storage_blob = require("@azure/storage-blob");
1708
- var import_node_path = __toESM(require("path"));
1705
+ var import_node_path = __toESM(require("node:path"));
1709
1706
  var import_server = __toESM(require_server());
1710
1707
  var createMediaHandlers = (config) => {
1711
1708
  function withAuth(handler) {
@@ -1732,7 +1729,9 @@ var createMediaHandlers = (config) => {
1732
1729
  };
1733
1730
  };
1734
1731
  async function uploadMedia(req, config) {
1735
- const client = import_storage_blob.BlobServiceClient.fromConnectionString(config.connectionString);
1732
+ const client = import_storage_blob.BlobServiceClient.fromConnectionString(
1733
+ config.connectionString
1734
+ );
1736
1735
  const containerClient = client.getContainerClient(config.containerName);
1737
1736
  const formData = await req.formData();
1738
1737
  const directory = formData.get("directory");
@@ -1760,7 +1759,9 @@ async function deleteAsset(_, context, config) {
1760
1759
  const options = {
1761
1760
  deleteSnapshots: "include"
1762
1761
  };
1763
- const client = import_storage_blob.BlobServiceClient.fromConnectionString(config.connectionString);
1762
+ const client = import_storage_blob.BlobServiceClient.fromConnectionString(
1763
+ config.connectionString
1764
+ );
1764
1765
  const containerClient = client.getContainerClient(config.containerName);
1765
1766
  const blockBlobClient = containerClient.getBlockBlobClient(blobName);
1766
1767
  await blockBlobClient.deleteIfExists(options);
@@ -1769,7 +1770,6 @@ async function deleteAsset(_, context, config) {
1769
1770
  });
1770
1771
  }
1771
1772
  async function listMedia(req, config) {
1772
- var _a;
1773
1773
  try {
1774
1774
  const client = import_storage_blob.BlobServiceClient.fromConnectionString(
1775
1775
  config.connectionString
@@ -1782,7 +1782,7 @@ async function listMedia(req, config) {
1782
1782
  filesOnly: req.nextUrl.searchParams.get("filesOnly") === "true" || false
1783
1783
  };
1784
1784
  const useRootDirectory = !mediaListOptions.directory || mediaListOptions.directory === "/" || mediaListOptions.directory === '""';
1785
- const prefix = useRootDirectory ? "" : ((_a = mediaListOptions.directory) == null ? void 0 : _a.endsWith("/")) ? mediaListOptions.directory : `${mediaListOptions.directory}/`;
1785
+ const prefix = useRootDirectory ? "" : mediaListOptions.directory?.endsWith("/") ? mediaListOptions.directory : `${mediaListOptions.directory}/`;
1786
1786
  const files = [];
1787
1787
  const folders = [];
1788
1788
  for await (const blob of containerClient.listBlobsByHierarchy("/", {
package/dist/index.js CHANGED
@@ -118,9 +118,9 @@
118
118
  };
119
119
  }
120
120
  buildQuery(options) {
121
- const params = Object.keys(options).filter(
122
- (key) => options[key] !== "" && options[key] !== void 0
123
- ).map((key) => `${key}=${options[key]}`).join("&");
121
+ const params = Object.entries(options).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => {
122
+ return typeof value === "object" ? `${key}=${encodeURIComponent(JSON.stringify(value))}` : `${key}=${encodeURIComponent(String(value))}`;
123
+ }).join("&");
124
124
  return `?${params}`;
125
125
  }
126
126
  }
package/dist/index.mjs CHANGED
@@ -115,9 +115,9 @@ class AzureMediaStore {
115
115
  };
116
116
  }
117
117
  buildQuery(options) {
118
- const params = Object.keys(options).filter(
119
- (key) => options[key] !== "" && options[key] !== void 0
120
- ).map((key) => `${key}=${options[key]}`).join("&");
118
+ const params = Object.entries(options).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => {
119
+ return typeof value === "object" ? `${key}=${encodeURIComponent(JSON.stringify(value))}` : `${key}=${encodeURIComponent(String(value))}`;
120
+ }).join("&");
121
121
  return `?${params}`;
122
122
  }
123
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-tinacms-azure",
3
- "version": "0.0.0-db8aa8e-20250228034006",
3
+ "version": "0.0.0-dced6ab-20250611061422",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -38,12 +38,12 @@
38
38
  "react": "^18.3.1",
39
39
  "react-dom": "^18.3.1",
40
40
  "typescript": "^5.7.3",
41
- "@tinacms/scripts": "0.0.0-db8aa8e-20250228034006",
42
- "tinacms": "0.0.0-db8aa8e-20250228034006"
41
+ "@tinacms/scripts": "0.0.0-dced6ab-20250611061422",
42
+ "tinacms": "0.0.0-dced6ab-20250611061422"
43
43
  },
44
44
  "peerDependencies": {
45
- "tinacms": "0.0.0-db8aa8e-20250228034006",
46
- "@tinacms/auth": "1.0.11"
45
+ "@tinacms/auth": "0.0.0-dced6ab-20250611061422",
46
+ "tinacms": "0.0.0-dced6ab-20250611061422"
47
47
  },
48
48
  "publishConfig": {
49
49
  "registry": "https://registry.npmjs.org"