autoblogger 0.2.28 → 0.2.30

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,17 @@ 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 acl = config.acl !== void 0 ? config.acl : "public-read";
7126
+ const params = {
7127
+ Bucket: config.bucket,
7128
+ Key: key,
7129
+ Body: buffer,
7130
+ ContentType: contentType
7131
+ };
7132
+ if (acl) {
7133
+ params.ACL = acl;
7134
+ }
7135
+ await client.send(new PutObjectCommand(params));
7119
7136
  const cdnEndpoint = config.cdnEndpoint || config.endpoint || `https://${config.bucket}.s3.${config.region || "us-east-1"}.amazonaws.com`;
7120
7137
  const url = cdnEndpoint.endsWith("/") ? `${cdnEndpoint}${key}` : `${cdnEndpoint}/${key}`;
7121
7138
  return { url, key };
@@ -7942,8 +7959,12 @@ var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch })
7942
7959
  }
7943
7960
  });
7944
7961
  };
7945
- if (view.hasFocus() && position === null || position === false) {
7946
- return true;
7962
+ try {
7963
+ if (view.hasFocus() && position === null || position === false) {
7964
+ return true;
7965
+ }
7966
+ } catch {
7967
+ return false;
7947
7968
  }
7948
7969
  if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
7949
7970
  delayedFocus();
@@ -8591,6 +8612,9 @@ function getAttributesFromExtensions(extensions) {
8591
8612
  keepOnSplit: true,
8592
8613
  isRequired: false
8593
8614
  };
8615
+ const nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== "text").map((ext) => ext.name);
8616
+ const markExtensionTypes = markExtensions.map((ext) => ext.name);
8617
+ const allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];
8594
8618
  extensions.forEach((extension) => {
8595
8619
  const context = {
8596
8620
  name: extension.name,
@@ -8608,7 +8632,19 @@ function getAttributesFromExtensions(extensions) {
8608
8632
  }
8609
8633
  const globalAttributes = addGlobalAttributes();
8610
8634
  globalAttributes.forEach((globalAttribute) => {
8611
- globalAttribute.types.forEach((type) => {
8635
+ let resolvedTypes;
8636
+ if (Array.isArray(globalAttribute.types)) {
8637
+ resolvedTypes = globalAttribute.types;
8638
+ } else if (globalAttribute.types === "*") {
8639
+ resolvedTypes = allExtensionTypes;
8640
+ } else if (globalAttribute.types === "nodes") {
8641
+ resolvedTypes = nodeExtensionTypes;
8642
+ } else if (globalAttribute.types === "marks") {
8643
+ resolvedTypes = markExtensionTypes;
8644
+ } else {
8645
+ resolvedTypes = [];
8646
+ }
8647
+ resolvedTypes.forEach((type) => {
8612
8648
  Object.entries(globalAttribute.attributes).forEach(([name2, attribute]) => {
8613
8649
  extensionAttributes.push({
8614
8650
  type,
@@ -9029,6 +9065,9 @@ function isMarkActive(state, typeOrName, attributes = {}) {
9029
9065
  const from = $from.pos;
9030
9066
  const to = $to.pos;
9031
9067
  state.doc.nodesBetween(from, to, (node, pos) => {
9068
+ if (type && node.inlineContent && !node.type.allowsMarkType(type)) {
9069
+ return false;
9070
+ }
9032
9071
  if (!node.isText && !node.marks.length) {
9033
9072
  return;
9034
9073
  }
@@ -10413,6 +10452,39 @@ var ExtensionManager = class {
10413
10452
  };
10414
10453
  }, baseDispatch);
10415
10454
  }
10455
+ /**
10456
+ * Get the composed transformPastedHTML function from all extensions.
10457
+ * @param baseTransform The base transform function (e.g. from the editor props)
10458
+ * @returns A composed transform function that chains all extension transforms
10459
+ */
10460
+ transformPastedHTML(baseTransform) {
10461
+ const { editor } = this;
10462
+ const extensions = sortExtensions([...this.extensions]);
10463
+ return extensions.reduce(
10464
+ (transform, extension) => {
10465
+ const context = {
10466
+ name: extension.name,
10467
+ options: extension.options,
10468
+ storage: this.editor.extensionStorage[extension.name],
10469
+ editor,
10470
+ type: getSchemaTypeByName(extension.name, this.schema)
10471
+ };
10472
+ const extensionTransform = getExtensionField(
10473
+ extension,
10474
+ "transformPastedHTML",
10475
+ context
10476
+ );
10477
+ if (!extensionTransform) {
10478
+ return transform;
10479
+ }
10480
+ return (html, view) => {
10481
+ const transformedHtml = transform(html, view);
10482
+ return extensionTransform.call(context, transformedHtml);
10483
+ };
10484
+ },
10485
+ baseTransform || ((html) => html)
10486
+ );
10487
+ }
10416
10488
  get markViews() {
10417
10489
  const { editor } = this;
10418
10490
  const { markExtensions } = splitExtensions(this.extensions);