autoblogger 0.2.27 → 0.2.29

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.mjs CHANGED
@@ -286,7 +286,7 @@ var init_package = __esm({
286
286
  "node_modules/@prismicio/client/dist/package.js"() {
287
287
  "use strict";
288
288
  name = "@prismicio/client";
289
- version = "7.21.3";
289
+ version = "7.21.6";
290
290
  }
291
291
  });
292
292
 
@@ -390,7 +390,7 @@ var init_getRepositoryName = __esm({
390
390
  getRepositoryName = (repositoryEndpoint) => {
391
391
  try {
392
392
  const hostname = new URL(repositoryEndpoint).hostname;
393
- if (hostname.endsWith("prismic.io") || hostname.endsWith("wroom.io") || hostname.endsWith("wroom.test")) return hostname.split(".")[0];
393
+ if (hostname.endsWith("prismic.io") || hostname.endsWith("wroom.io") || hostname.endsWith("dev-tools-wroom.com") || hostname.endsWith("marketing-tools-wroom.com") || hostname.endsWith("platform-wroom.com") || hostname.endsWith("wroom.test")) return hostname.split(".")[0];
394
394
  } catch {
395
395
  }
396
396
  throw new PrismicError(`An invalid Prismic Document API endpoint was provided: ${repositoryEndpoint}`, void 0, void 0);
@@ -488,6 +488,20 @@ var init_pLimit = __esm({
488
488
  });
489
489
 
490
490
  // node_modules/@prismicio/client/dist/lib/request.js
491
+ async function memoizeResponse(response) {
492
+ const blob = await response.blob();
493
+ const memoized = {
494
+ ok: response.ok,
495
+ status: response.status,
496
+ headers: response.headers,
497
+ url: response.url,
498
+ text: async () => blob.text(),
499
+ json: async () => JSON.parse(await blob.text()),
500
+ blob: async () => blob,
501
+ clone: () => memoized
502
+ };
503
+ return memoized;
504
+ }
491
505
  async function request(url, init, fetchFn) {
492
506
  const stringURL = url.toString();
493
507
  let job;
@@ -499,7 +513,7 @@ async function request(url, init, fetchFn) {
499
513
  const existingJob = (_DEDUPLICATED_JOBS$st = DEDUPLICATED_JOBS[stringURL]) === null || _DEDUPLICATED_JOBS$st === void 0 ? void 0 : _DEDUPLICATED_JOBS$st.get(init === null || init === void 0 ? void 0 : init.signal);
500
514
  if (existingJob) job = existingJob;
501
515
  else {
502
- job = fetchFn(stringURL, init).finally(() => {
516
+ job = fetchFn(stringURL, init).then(memoizeResponse).finally(() => {
503
517
  var _DEDUPLICATED_JOBS$st2, _DEDUPLICATED_JOBS$st3;
504
518
  (_DEDUPLICATED_JOBS$st2 = DEDUPLICATED_JOBS[stringURL]) === null || _DEDUPLICATED_JOBS$st2 === void 0 || _DEDUPLICATED_JOBS$st2.delete(init === null || init === void 0 ? void 0 : init.signal);
505
519
  if (((_DEDUPLICATED_JOBS$st3 = DEDUPLICATED_JOBS[stringURL]) === null || _DEDUPLICATED_JOBS$st3 === void 0 ? void 0 : _DEDUPLICATED_JOBS$st3.size) === 0) delete DEDUPLICATED_JOBS[stringURL];
@@ -514,7 +528,7 @@ async function request(url, init, fetchFn) {
514
528
  await new Promise((resolve) => setTimeout(resolve, resolvedRetryAfter));
515
529
  return request(url, init, fetchFn);
516
530
  }
517
- return response.clone();
531
+ return response;
518
532
  }
519
533
  var DEFAULT_RETRY_AFTER, THROTTLED_RUNNERS, DEDUPLICATED_JOBS;
520
534
  var init_request = __esm({
@@ -654,7 +668,7 @@ var init_Client = __esm({
654
668
  if (!isRepositoryEndpoint(this.documentAPIEndpoint)) throw new PrismicError(`documentAPIEndpoint is not a valid URL: ${documentAPIEndpoint}`, void 0, void 0);
655
669
  if (isRepositoryEndpoint(repositoryNameOrEndpoint) && documentAPIEndpoint && repositoryNameOrEndpoint !== documentAPIEndpoint) console.warn(`[@prismicio/client] Multiple incompatible endpoints were provided. Create the client using a repository name to prevent this error. For more details, see ${devMsg("prefer-repository-name")}`);
656
670
  if (process.env.NODE_ENV === "development" && /\.prismic\.io\/(?!api\/v2\/?)/i.test(this.documentAPIEndpoint)) throw new PrismicError("@prismicio/client only supports Prismic Rest API V2. Please provide only the repository name to the first createClient() parameter or use the getRepositoryEndpoint() helper to generate a valid Rest API V2 endpoint URL.", void 0, void 0);
657
- if (process.env.NODE_ENV === "development" && /(?<!\.cdn)\.prismic\.io$/i.test(new URL(this.documentAPIEndpoint).hostname)) console.warn(`[@prismicio/client] The client was created with a non-CDN endpoint. Convert it to the CDN endpoint for better performance. For more details, see ${devMsg("endpoint-must-use-cdn")}`);
671
+ if (process.env.NODE_ENV === "development" && /\.prismic\.io$/i.test(new URL(this.documentAPIEndpoint).hostname) && !/\.cdn\.prismic\.io$/i.test(new URL(this.documentAPIEndpoint).hostname)) console.warn(`[@prismicio/client] The client was created with a non-CDN endpoint. Convert it to the CDN endpoint for better performance. For more details, see ${devMsg("endpoint-must-use-cdn")}`);
658
672
  this.accessToken = accessToken;
659
673
  this.routes = routes;
660
674
  this.brokenRoute = brokenRoute;
@@ -7082,6 +7096,7 @@ async function getS3Client(config) {
7082
7096
  return new S3Client({
7083
7097
  region: config.region || "us-east-1",
7084
7098
  endpoint: config.endpoint,
7099
+ forcePathStyle: false,
7085
7100
  credentials: {
7086
7101
  accessKeyId: config.accessKeyId,
7087
7102
  secretAccessKey: config.secretAccessKey
@@ -7107,15 +7122,16 @@ async function uploadToS3(buffer, filename, contentType, config) {
7107
7122
  const client = await getS3Client(config);
7108
7123
  const ext = filename.split(".").pop()?.toLowerCase() || "jpg";
7109
7124
  const key = `uploads/${randomUUID()}.${ext}`;
7110
- await client.send(
7111
- new PutObjectCommand({
7112
- Bucket: config.bucket,
7113
- Key: key,
7114
- Body: buffer,
7115
- ContentType: contentType,
7116
- ACL: "public-read"
7117
- })
7118
- );
7125
+ const params = {
7126
+ Bucket: config.bucket,
7127
+ Key: key,
7128
+ Body: buffer,
7129
+ ContentType: contentType
7130
+ };
7131
+ if (config.acl) {
7132
+ params.ACL = config.acl;
7133
+ }
7134
+ await client.send(new PutObjectCommand(params));
7119
7135
  const cdnEndpoint = config.cdnEndpoint || config.endpoint || `https://${config.bucket}.s3.${config.region || "us-east-1"}.amazonaws.com`;
7120
7136
  const url = cdnEndpoint.endsWith("/") ? `${cdnEndpoint}${key}` : `${cdnEndpoint}/${key}`;
7121
7137
  return { url, key };
@@ -7942,8 +7958,12 @@ var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch })
7942
7958
  }
7943
7959
  });
7944
7960
  };
7945
- if (view.hasFocus() && position === null || position === false) {
7946
- return true;
7961
+ try {
7962
+ if (view.hasFocus() && position === null || position === false) {
7963
+ return true;
7964
+ }
7965
+ } catch {
7966
+ return false;
7947
7967
  }
7948
7968
  if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
7949
7969
  delayedFocus();
@@ -8591,6 +8611,9 @@ function getAttributesFromExtensions(extensions) {
8591
8611
  keepOnSplit: true,
8592
8612
  isRequired: false
8593
8613
  };
8614
+ const nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== "text").map((ext) => ext.name);
8615
+ const markExtensionTypes = markExtensions.map((ext) => ext.name);
8616
+ const allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];
8594
8617
  extensions.forEach((extension) => {
8595
8618
  const context = {
8596
8619
  name: extension.name,
@@ -8608,7 +8631,19 @@ function getAttributesFromExtensions(extensions) {
8608
8631
  }
8609
8632
  const globalAttributes = addGlobalAttributes();
8610
8633
  globalAttributes.forEach((globalAttribute) => {
8611
- globalAttribute.types.forEach((type) => {
8634
+ let resolvedTypes;
8635
+ if (Array.isArray(globalAttribute.types)) {
8636
+ resolvedTypes = globalAttribute.types;
8637
+ } else if (globalAttribute.types === "*") {
8638
+ resolvedTypes = allExtensionTypes;
8639
+ } else if (globalAttribute.types === "nodes") {
8640
+ resolvedTypes = nodeExtensionTypes;
8641
+ } else if (globalAttribute.types === "marks") {
8642
+ resolvedTypes = markExtensionTypes;
8643
+ } else {
8644
+ resolvedTypes = [];
8645
+ }
8646
+ resolvedTypes.forEach((type) => {
8612
8647
  Object.entries(globalAttribute.attributes).forEach(([name2, attribute]) => {
8613
8648
  extensionAttributes.push({
8614
8649
  type,
@@ -9029,6 +9064,9 @@ function isMarkActive(state, typeOrName, attributes = {}) {
9029
9064
  const from = $from.pos;
9030
9065
  const to = $to.pos;
9031
9066
  state.doc.nodesBetween(from, to, (node, pos) => {
9067
+ if (type && node.inlineContent && !node.type.allowsMarkType(type)) {
9068
+ return false;
9069
+ }
9032
9070
  if (!node.isText && !node.marks.length) {
9033
9071
  return;
9034
9072
  }
@@ -10413,6 +10451,39 @@ var ExtensionManager = class {
10413
10451
  };
10414
10452
  }, baseDispatch);
10415
10453
  }
10454
+ /**
10455
+ * Get the composed transformPastedHTML function from all extensions.
10456
+ * @param baseTransform The base transform function (e.g. from the editor props)
10457
+ * @returns A composed transform function that chains all extension transforms
10458
+ */
10459
+ transformPastedHTML(baseTransform) {
10460
+ const { editor } = this;
10461
+ const extensions = sortExtensions([...this.extensions]);
10462
+ return extensions.reduce(
10463
+ (transform, extension) => {
10464
+ const context = {
10465
+ name: extension.name,
10466
+ options: extension.options,
10467
+ storage: this.editor.extensionStorage[extension.name],
10468
+ editor,
10469
+ type: getSchemaTypeByName(extension.name, this.schema)
10470
+ };
10471
+ const extensionTransform = getExtensionField(
10472
+ extension,
10473
+ "transformPastedHTML",
10474
+ context
10475
+ );
10476
+ if (!extensionTransform) {
10477
+ return transform;
10478
+ }
10479
+ return (html, view) => {
10480
+ const transformedHtml = transform(html, view);
10481
+ return extensionTransform.call(context, transformedHtml);
10482
+ };
10483
+ },
10484
+ baseTransform || ((html) => html)
10485
+ );
10486
+ }
10416
10487
  get markViews() {
10417
10488
  const { editor } = this;
10418
10489
  const { markExtensions } = splitExtensions(this.extensions);