@seed-hypermedia/client 0.0.51 → 0.0.53

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.
@@ -834,15 +834,16 @@ var HMListCommentsByAuthorRequestSchema = z.object({
834
834
  input: HMListCommentsByAuthorInputSchema,
835
835
  output: HMListCommentsByAuthorOutputSchema
836
836
  });
837
- var HMRawMentionSchema = z.object({
837
+ var HMRawCitationSchema = z.object({
838
838
  source: z.string(),
839
839
  sourceType: z.string().optional(),
840
840
  sourceDocument: z.string().optional(),
841
841
  targetFragment: z.string().optional(),
842
- isExact: z.boolean().optional()
842
+ isExactVersion: z.boolean().optional(),
843
+ targetBlockRevision: z.string().optional()
843
844
  });
844
845
  var HMListCitationsOutputSchema = z.object({
845
- citations: z.array(HMRawMentionSchema)
846
+ citations: z.array(HMRawCitationSchema)
846
847
  });
847
848
  var HMListCitationsInputSchema = z.object({
848
849
  targetId: unpackedHmIdSchema
@@ -1404,7 +1405,7 @@ export {
1404
1405
  HMListCommentsByAuthorOutputSchema,
1405
1406
  HMListCommentsByAuthorInputSchema,
1406
1407
  HMListCommentsByAuthorRequestSchema,
1407
- HMRawMentionSchema,
1408
+ HMRawCitationSchema,
1408
1409
  HMListCitationsOutputSchema,
1409
1410
  HMListCitationsInputSchema,
1410
1411
  HMListCitationsRequestSchema,
@@ -26539,61 +26539,69 @@ export declare const HMListCommentsByAuthorRequestSchema: z.ZodObject<{
26539
26539
  };
26540
26540
  }>;
26541
26541
  export type HMListCommentsByAuthorRequest = z.infer<typeof HMListCommentsByAuthorRequestSchema>;
26542
- export declare const HMRawMentionSchema: z.ZodObject<{
26542
+ export declare const HMRawCitationSchema: z.ZodObject<{
26543
26543
  source: z.ZodString;
26544
26544
  sourceType: z.ZodOptional<z.ZodString>;
26545
26545
  sourceDocument: z.ZodOptional<z.ZodString>;
26546
26546
  targetFragment: z.ZodOptional<z.ZodString>;
26547
- isExact: z.ZodOptional<z.ZodBoolean>;
26547
+ isExactVersion: z.ZodOptional<z.ZodBoolean>;
26548
+ targetBlockRevision: z.ZodOptional<z.ZodString>;
26548
26549
  }, "strip", z.ZodTypeAny, {
26549
26550
  source: string;
26550
26551
  sourceType?: string | undefined;
26552
+ isExactVersion?: boolean | undefined;
26551
26553
  targetFragment?: string | undefined;
26552
26554
  sourceDocument?: string | undefined;
26553
- isExact?: boolean | undefined;
26555
+ targetBlockRevision?: string | undefined;
26554
26556
  }, {
26555
26557
  source: string;
26556
26558
  sourceType?: string | undefined;
26559
+ isExactVersion?: boolean | undefined;
26557
26560
  targetFragment?: string | undefined;
26558
26561
  sourceDocument?: string | undefined;
26559
- isExact?: boolean | undefined;
26562
+ targetBlockRevision?: string | undefined;
26560
26563
  }>;
26561
- export type HMRawMention = z.infer<typeof HMRawMentionSchema>;
26564
+ export type HMRawCitation = z.infer<typeof HMRawCitationSchema>;
26562
26565
  export declare const HMListCitationsOutputSchema: z.ZodObject<{
26563
26566
  citations: z.ZodArray<z.ZodObject<{
26564
26567
  source: z.ZodString;
26565
26568
  sourceType: z.ZodOptional<z.ZodString>;
26566
26569
  sourceDocument: z.ZodOptional<z.ZodString>;
26567
26570
  targetFragment: z.ZodOptional<z.ZodString>;
26568
- isExact: z.ZodOptional<z.ZodBoolean>;
26571
+ isExactVersion: z.ZodOptional<z.ZodBoolean>;
26572
+ targetBlockRevision: z.ZodOptional<z.ZodString>;
26569
26573
  }, "strip", z.ZodTypeAny, {
26570
26574
  source: string;
26571
26575
  sourceType?: string | undefined;
26576
+ isExactVersion?: boolean | undefined;
26572
26577
  targetFragment?: string | undefined;
26573
26578
  sourceDocument?: string | undefined;
26574
- isExact?: boolean | undefined;
26579
+ targetBlockRevision?: string | undefined;
26575
26580
  }, {
26576
26581
  source: string;
26577
26582
  sourceType?: string | undefined;
26583
+ isExactVersion?: boolean | undefined;
26578
26584
  targetFragment?: string | undefined;
26579
26585
  sourceDocument?: string | undefined;
26580
- isExact?: boolean | undefined;
26586
+ targetBlockRevision?: string | undefined;
26581
26587
  }>, "many">;
26582
26588
  }, "strip", z.ZodTypeAny, {
26583
26589
  citations: {
26584
26590
  source: string;
26585
26591
  sourceType?: string | undefined;
26592
+ isExactVersion?: boolean | undefined;
26586
26593
  targetFragment?: string | undefined;
26587
26594
  sourceDocument?: string | undefined;
26588
- isExact?: boolean | undefined;
26595
+ targetBlockRevision?: string | undefined;
26589
26596
  }[];
26590
26597
  }, {
26591
26598
  citations: {
26592
26599
  source: string;
26593
26600
  sourceType?: string | undefined;
26601
+ isExactVersion?: boolean | undefined;
26594
26602
  targetFragment?: string | undefined;
26595
26603
  sourceDocument?: string | undefined;
26596
- isExact?: boolean | undefined;
26604
+ targetBlockRevision?: string | undefined;
26597
26605
  }[];
26598
26606
  }>;
26599
26607
  export type HMListCitationsOutput = z.infer<typeof HMListCitationsOutputSchema>;
@@ -26796,35 +26804,40 @@ export declare const HMListCitationsRequestSchema: z.ZodObject<{
26796
26804
  sourceType: z.ZodOptional<z.ZodString>;
26797
26805
  sourceDocument: z.ZodOptional<z.ZodString>;
26798
26806
  targetFragment: z.ZodOptional<z.ZodString>;
26799
- isExact: z.ZodOptional<z.ZodBoolean>;
26807
+ isExactVersion: z.ZodOptional<z.ZodBoolean>;
26808
+ targetBlockRevision: z.ZodOptional<z.ZodString>;
26800
26809
  }, "strip", z.ZodTypeAny, {
26801
26810
  source: string;
26802
26811
  sourceType?: string | undefined;
26812
+ isExactVersion?: boolean | undefined;
26803
26813
  targetFragment?: string | undefined;
26804
26814
  sourceDocument?: string | undefined;
26805
- isExact?: boolean | undefined;
26815
+ targetBlockRevision?: string | undefined;
26806
26816
  }, {
26807
26817
  source: string;
26808
26818
  sourceType?: string | undefined;
26819
+ isExactVersion?: boolean | undefined;
26809
26820
  targetFragment?: string | undefined;
26810
26821
  sourceDocument?: string | undefined;
26811
- isExact?: boolean | undefined;
26822
+ targetBlockRevision?: string | undefined;
26812
26823
  }>, "many">;
26813
26824
  }, "strip", z.ZodTypeAny, {
26814
26825
  citations: {
26815
26826
  source: string;
26816
26827
  sourceType?: string | undefined;
26828
+ isExactVersion?: boolean | undefined;
26817
26829
  targetFragment?: string | undefined;
26818
26830
  sourceDocument?: string | undefined;
26819
- isExact?: boolean | undefined;
26831
+ targetBlockRevision?: string | undefined;
26820
26832
  }[];
26821
26833
  }, {
26822
26834
  citations: {
26823
26835
  source: string;
26824
26836
  sourceType?: string | undefined;
26837
+ isExactVersion?: boolean | undefined;
26825
26838
  targetFragment?: string | undefined;
26826
26839
  sourceDocument?: string | undefined;
26827
- isExact?: boolean | undefined;
26840
+ targetBlockRevision?: string | undefined;
26828
26841
  }[];
26829
26842
  }>;
26830
26843
  }, "strip", z.ZodTypeAny, {
@@ -26852,9 +26865,10 @@ export declare const HMListCitationsRequestSchema: z.ZodObject<{
26852
26865
  citations: {
26853
26866
  source: string;
26854
26867
  sourceType?: string | undefined;
26868
+ isExactVersion?: boolean | undefined;
26855
26869
  targetFragment?: string | undefined;
26856
26870
  sourceDocument?: string | undefined;
26857
- isExact?: boolean | undefined;
26871
+ targetBlockRevision?: string | undefined;
26858
26872
  }[];
26859
26873
  };
26860
26874
  }, {
@@ -26882,9 +26896,10 @@ export declare const HMListCitationsRequestSchema: z.ZodObject<{
26882
26896
  citations: {
26883
26897
  source: string;
26884
26898
  sourceType?: string | undefined;
26899
+ isExactVersion?: boolean | undefined;
26885
26900
  targetFragment?: string | undefined;
26886
26901
  sourceDocument?: string | undefined;
26887
- isExact?: boolean | undefined;
26902
+ targetBlockRevision?: string | undefined;
26888
26903
  }[];
26889
26904
  };
26890
26905
  }>;
@@ -44431,35 +44446,40 @@ export declare const HMGetRequestSchema: z.ZodDiscriminatedUnion<"key", [z.ZodOb
44431
44446
  sourceType: z.ZodOptional<z.ZodString>;
44432
44447
  sourceDocument: z.ZodOptional<z.ZodString>;
44433
44448
  targetFragment: z.ZodOptional<z.ZodString>;
44434
- isExact: z.ZodOptional<z.ZodBoolean>;
44449
+ isExactVersion: z.ZodOptional<z.ZodBoolean>;
44450
+ targetBlockRevision: z.ZodOptional<z.ZodString>;
44435
44451
  }, "strip", z.ZodTypeAny, {
44436
44452
  source: string;
44437
44453
  sourceType?: string | undefined;
44454
+ isExactVersion?: boolean | undefined;
44438
44455
  targetFragment?: string | undefined;
44439
44456
  sourceDocument?: string | undefined;
44440
- isExact?: boolean | undefined;
44457
+ targetBlockRevision?: string | undefined;
44441
44458
  }, {
44442
44459
  source: string;
44443
44460
  sourceType?: string | undefined;
44461
+ isExactVersion?: boolean | undefined;
44444
44462
  targetFragment?: string | undefined;
44445
44463
  sourceDocument?: string | undefined;
44446
- isExact?: boolean | undefined;
44464
+ targetBlockRevision?: string | undefined;
44447
44465
  }>, "many">;
44448
44466
  }, "strip", z.ZodTypeAny, {
44449
44467
  citations: {
44450
44468
  source: string;
44451
44469
  sourceType?: string | undefined;
44470
+ isExactVersion?: boolean | undefined;
44452
44471
  targetFragment?: string | undefined;
44453
44472
  sourceDocument?: string | undefined;
44454
- isExact?: boolean | undefined;
44473
+ targetBlockRevision?: string | undefined;
44455
44474
  }[];
44456
44475
  }, {
44457
44476
  citations: {
44458
44477
  source: string;
44459
44478
  sourceType?: string | undefined;
44479
+ isExactVersion?: boolean | undefined;
44460
44480
  targetFragment?: string | undefined;
44461
44481
  sourceDocument?: string | undefined;
44462
- isExact?: boolean | undefined;
44482
+ targetBlockRevision?: string | undefined;
44463
44483
  }[];
44464
44484
  }>;
44465
44485
  }, "strip", z.ZodTypeAny, {
@@ -44487,9 +44507,10 @@ export declare const HMGetRequestSchema: z.ZodDiscriminatedUnion<"key", [z.ZodOb
44487
44507
  citations: {
44488
44508
  source: string;
44489
44509
  sourceType?: string | undefined;
44510
+ isExactVersion?: boolean | undefined;
44490
44511
  targetFragment?: string | undefined;
44491
44512
  sourceDocument?: string | undefined;
44492
- isExact?: boolean | undefined;
44513
+ targetBlockRevision?: string | undefined;
44493
44514
  }[];
44494
44515
  };
44495
44516
  }, {
@@ -44517,9 +44538,10 @@ export declare const HMGetRequestSchema: z.ZodDiscriminatedUnion<"key", [z.ZodOb
44517
44538
  citations: {
44518
44539
  source: string;
44519
44540
  sourceType?: string | undefined;
44541
+ isExactVersion?: boolean | undefined;
44520
44542
  targetFragment?: string | undefined;
44521
44543
  sourceDocument?: string | undefined;
44522
- isExact?: boolean | undefined;
44544
+ targetBlockRevision?: string | undefined;
44523
44545
  }[];
44524
44546
  };
44525
44547
  }>, z.ZodObject<{
@@ -57325,35 +57347,40 @@ export declare const HMRequestSchema: z.ZodDiscriminatedUnion<"key", [z.ZodObjec
57325
57347
  sourceType: z.ZodOptional<z.ZodString>;
57326
57348
  sourceDocument: z.ZodOptional<z.ZodString>;
57327
57349
  targetFragment: z.ZodOptional<z.ZodString>;
57328
- isExact: z.ZodOptional<z.ZodBoolean>;
57350
+ isExactVersion: z.ZodOptional<z.ZodBoolean>;
57351
+ targetBlockRevision: z.ZodOptional<z.ZodString>;
57329
57352
  }, "strip", z.ZodTypeAny, {
57330
57353
  source: string;
57331
57354
  sourceType?: string | undefined;
57355
+ isExactVersion?: boolean | undefined;
57332
57356
  targetFragment?: string | undefined;
57333
57357
  sourceDocument?: string | undefined;
57334
- isExact?: boolean | undefined;
57358
+ targetBlockRevision?: string | undefined;
57335
57359
  }, {
57336
57360
  source: string;
57337
57361
  sourceType?: string | undefined;
57362
+ isExactVersion?: boolean | undefined;
57338
57363
  targetFragment?: string | undefined;
57339
57364
  sourceDocument?: string | undefined;
57340
- isExact?: boolean | undefined;
57365
+ targetBlockRevision?: string | undefined;
57341
57366
  }>, "many">;
57342
57367
  }, "strip", z.ZodTypeAny, {
57343
57368
  citations: {
57344
57369
  source: string;
57345
57370
  sourceType?: string | undefined;
57371
+ isExactVersion?: boolean | undefined;
57346
57372
  targetFragment?: string | undefined;
57347
57373
  sourceDocument?: string | undefined;
57348
- isExact?: boolean | undefined;
57374
+ targetBlockRevision?: string | undefined;
57349
57375
  }[];
57350
57376
  }, {
57351
57377
  citations: {
57352
57378
  source: string;
57353
57379
  sourceType?: string | undefined;
57380
+ isExactVersion?: boolean | undefined;
57354
57381
  targetFragment?: string | undefined;
57355
57382
  sourceDocument?: string | undefined;
57356
- isExact?: boolean | undefined;
57383
+ targetBlockRevision?: string | undefined;
57357
57384
  }[];
57358
57385
  }>;
57359
57386
  }, "strip", z.ZodTypeAny, {
@@ -57381,9 +57408,10 @@ export declare const HMRequestSchema: z.ZodDiscriminatedUnion<"key", [z.ZodObjec
57381
57408
  citations: {
57382
57409
  source: string;
57383
57410
  sourceType?: string | undefined;
57411
+ isExactVersion?: boolean | undefined;
57384
57412
  targetFragment?: string | undefined;
57385
57413
  sourceDocument?: string | undefined;
57386
- isExact?: boolean | undefined;
57414
+ targetBlockRevision?: string | undefined;
57387
57415
  }[];
57388
57416
  };
57389
57417
  }, {
@@ -57411,9 +57439,10 @@ export declare const HMRequestSchema: z.ZodDiscriminatedUnion<"key", [z.ZodObjec
57411
57439
  citations: {
57412
57440
  source: string;
57413
57441
  sourceType?: string | undefined;
57442
+ isExactVersion?: boolean | undefined;
57414
57443
  targetFragment?: string | undefined;
57415
57444
  sourceDocument?: string | undefined;
57416
- isExact?: boolean | undefined;
57445
+ targetBlockRevision?: string | undefined;
57417
57446
  }[];
57418
57447
  };
57419
57448
  }>, z.ZodObject<{
package/dist/hm-types.mjs CHANGED
@@ -124,8 +124,8 @@ import {
124
124
  HMQuerySortSchema,
125
125
  HMQueryStyleSchema,
126
126
  HMRawCapabilitySchema,
127
+ HMRawCitationSchema,
127
128
  HMRawDocumentChangeSchema,
128
- HMRawMentionSchema,
129
129
  HMRedirectInfoSchema,
130
130
  HMRequestSchema,
131
131
  HMResolvedResourceSchema,
@@ -176,7 +176,7 @@ import {
176
176
  toNumber,
177
177
  unpackHmId,
178
178
  unpackedHmIdSchema
179
- } from "./chunk-S3TOHNCG.mjs";
179
+ } from "./chunk-64QUVNND.mjs";
180
180
  export {
181
181
  BackgroundColorAnnotationSchema,
182
182
  BlockRangeSchema,
@@ -303,8 +303,8 @@ export {
303
303
  HMQuerySortSchema,
304
304
  HMQueryStyleSchema,
305
305
  HMRawCapabilitySchema,
306
+ HMRawCitationSchema,
306
307
  HMRawDocumentChangeSchema,
307
- HMRawMentionSchema,
308
308
  HMRedirectInfoSchema,
309
309
  HMRequestSchema,
310
310
  HMResolvedResourceSchema,
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  serializeBlockRange,
18
18
  toNumber,
19
19
  unpackHmId
20
- } from "./chunk-S3TOHNCG.mjs";
20
+ } from "./chunk-64QUVNND.mjs";
21
21
 
22
22
  // src/capability.ts
23
23
  import { encode as cborEncode2 } from "@ipld/dag-cbor";
@@ -4107,8 +4107,30 @@ function toImageWidthNumber(width) {
4107
4107
  }
4108
4108
  return toNumber(width);
4109
4109
  }
4110
+ function unknownEditorBlockToHMBlock(editorBlock) {
4111
+ const props = editorBlock.props ?? {};
4112
+ if (props.originalData) {
4113
+ try {
4114
+ const parsed = JSON.parse(props.originalData);
4115
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4116
+ return { ...parsed, id: editorBlock.id };
4117
+ }
4118
+ } catch {
4119
+ }
4120
+ }
4121
+ return {
4122
+ id: editorBlock.id,
4123
+ type: props.originalType || "unknown",
4124
+ text: "",
4125
+ annotations: [],
4126
+ attributes: {}
4127
+ };
4128
+ }
4110
4129
  function editorBlockToHMBlock(editorBlock) {
4111
4130
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4131
+ if (editorBlock.type === "unknown") {
4132
+ return unknownEditorBlockToHMBlock(editorBlock);
4133
+ }
4112
4134
  const blockType = toHMBlockType(editorBlock.type);
4113
4135
  if (!blockType) throw new Error("Unsupported block type " + editorBlock.type);
4114
4136
  let block = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",