@fedify/fedify 0.8.0-dev.167 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of @fedify/fedify might be problematic. Click here for more details.

package/CHANGES.md CHANGED
@@ -6,7 +6,7 @@ Fedify changelog
6
6
  Version 0.8.0
7
7
  -------------
8
8
 
9
- To be released.
9
+ Released on May 6, 2024.
10
10
 
11
11
  - The CLI toolchain for testing and debugging is now available on JSR:
12
12
  [@fedify/cli]. You can install it with
@@ -66,6 +66,16 @@ To be released.
66
66
  - The type of the third parameter of `doesActorOwnKey()` function became
67
67
  `DoesActorOwnKeyOptions` (was `DocumentLoader`).
68
68
 
69
+ - Added `width` and `height` properties to `Document` class for better
70
+ compatibility with Mastodon. [[#47]]
71
+
72
+ - Added `Document.width` property.
73
+ - Added `Document.height` property.
74
+ - `new Document()` constructor now accepts `width` option.
75
+ - `new Document()` constructor now accepts `height` option.
76
+ - `Document.clone()` method now accepts `width` option.
77
+ - `Document.clone()` method now accepts `height` option.
78
+
69
79
  - Removed the dependency on *@js-temporal/polyfill* on Deno, and Fedify now
70
80
  requires `--unstable-temporal` flag. On other runtime, it still depends
71
81
  on *@js-temporal/polyfill*.
@@ -88,6 +98,7 @@ To be released.
88
98
  [@fedify/cli]: https://jsr.io/@fedify/cli
89
99
  [releases]: https://github.com/dahlia/fedify/releases
90
100
  [FEP-8fcf]: https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md
101
+ [#47]: https://github.com/dahlia/fedify/issues/47
91
102
 
92
103
 
93
104
  Version 0.7.0
package/README.md CHANGED
@@ -46,7 +46,7 @@ join our [Matrix chat space][Matrix] or [GitHub Discussions]. Or tag
46
46
  [Mastodon], [Lemmy], [Pixelfed], [PeerTube], and so on.
47
47
 
48
48
  [JSR]: https://jsr.io/@fedify/fedify
49
- [JSR badge]: https://jsr.io/badges/@fedify/fedify?v=0.6.0
49
+ [JSR badge]: https://jsr.io/badges/@fedify/fedify
50
50
  [npm]: https://www.npmjs.com/package/@fedify/fedify
51
51
  [npm badge]: https://img.shields.io/npm/v/@fedify/fedify?logo=npm
52
52
  [GitHub Actions]: https://github.com/dahlia/fedify/actions/workflows/build.yaml
@@ -5,4 +5,22 @@ extends: "https://www.w3.org/ns/activitystreams#Object"
5
5
  entity: true
6
6
  description: Represents a document of any kind.
7
7
  defaultContext: "https://www.w3.org/ns/activitystreams"
8
- properties: []
8
+
9
+ properties:
10
+ - singularName: width
11
+ functional: true
12
+ uri: "https://www.w3.org/ns/activitystreams#width"
13
+ description: |
14
+ Specifies a hint as to the rendering width in
15
+ device-independent pixels of the linked resource.
16
+ range:
17
+ - "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
18
+
19
+ - singularName: height
20
+ functional: true
21
+ uri: "https://www.w3.org/ns/activitystreams#height"
22
+ description: |
23
+ Specifies a hint as to the rendering height in
24
+ device-independent pixels of the linked resource.
25
+ range:
26
+ - "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
@@ -5825,6 +5825,8 @@ export class Document extends Object {
5825
5825
  static get typeId() {
5826
5826
  return new URL("https://www.w3.org/ns/activitystreams#Document");
5827
5827
  }
5828
+ #_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = [];
5829
+ #_2cGKFeFJMmiNpGZFEF75mCwFQsKb = [];
5828
5830
  /**
5829
5831
  * Constructs a new instance of Document with the given values.
5830
5832
  * @param values The values to initialize the instance with.
@@ -5832,6 +5834,12 @@ export class Document extends Object {
5832
5834
  */
5833
5835
  constructor(values, { documentLoader, contextLoader, } = {}) {
5834
5836
  super(values, { documentLoader, contextLoader });
5837
+ if ("width" in values && values.width != null) {
5838
+ this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = [values.width];
5839
+ }
5840
+ if ("height" in values && values.height != null) {
5841
+ this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb = [values.height];
5842
+ }
5835
5843
  }
5836
5844
  /**
5837
5845
  * Clones this instance, optionally updating it with the given values.
@@ -5841,8 +5849,32 @@ export class Document extends Object {
5841
5849
  */
5842
5850
  clone(values = {}, options = {}) {
5843
5851
  const clone = super.clone(values, options);
5852
+ clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe;
5853
+ if ("width" in values && values.width != null) {
5854
+ clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = [values.width];
5855
+ }
5856
+ clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb;
5857
+ if ("height" in values && values.height != null) {
5858
+ clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb = [values.height];
5859
+ }
5844
5860
  return clone;
5845
5861
  }
5862
+ /** Specifies a hint as to the rendering width in
5863
+ * device-independent pixels of the linked resource.
5864
+ */
5865
+ get width() {
5866
+ if (this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe.length < 1)
5867
+ return null;
5868
+ return this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe[0];
5869
+ }
5870
+ /** Specifies a hint as to the rendering height in
5871
+ * device-independent pixels of the linked resource.
5872
+ */
5873
+ get height() {
5874
+ if (this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb.length < 1)
5875
+ return null;
5876
+ return this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb[0];
5877
+ }
5846
5878
  /**
5847
5879
  * Converts this object to a JSON-LD structure.
5848
5880
  * @returns The JSON-LD representation of this object.
@@ -5859,6 +5891,26 @@ export class Document extends Object {
5859
5891
  expand: true,
5860
5892
  });
5861
5893
  const values = baseValues[0];
5894
+ array = [];
5895
+ for (const v of this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe) {
5896
+ array.push({
5897
+ "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger",
5898
+ "@value": v,
5899
+ });
5900
+ }
5901
+ if (array.length > 0) {
5902
+ values["https://www.w3.org/ns/activitystreams#width"] = array;
5903
+ }
5904
+ array = [];
5905
+ for (const v of this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb) {
5906
+ array.push({
5907
+ "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger",
5908
+ "@value": v,
5909
+ });
5910
+ }
5911
+ if (array.length > 0) {
5912
+ values["https://www.w3.org/ns/activitystreams#height"] = array;
5913
+ }
5862
5914
  values["@type"] = ["https://www.w3.org/ns/activitystreams#Document"];
5863
5915
  if (this.id)
5864
5916
  values["@id"] = this.id.href;
@@ -5923,10 +5975,46 @@ export class Document extends Object {
5923
5975
  if (!(instance instanceof Document)) {
5924
5976
  throw new TypeError("Unexpected type: " + instance.constructor.name);
5925
5977
  }
5978
+ const _2e9AP7WdHBJYAgXG6GEyq7nSkNMe = [];
5979
+ for (const v of values["https://www.w3.org/ns/activitystreams#width"] ?? []) {
5980
+ if (v == null)
5981
+ continue;
5982
+ _2e9AP7WdHBJYAgXG6GEyq7nSkNMe.push(v["@value"]);
5983
+ }
5984
+ instance.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe;
5985
+ const _2cGKFeFJMmiNpGZFEF75mCwFQsKb = [];
5986
+ for (const v of values["https://www.w3.org/ns/activitystreams#height"] ?? []) {
5987
+ if (v == null)
5988
+ continue;
5989
+ _2cGKFeFJMmiNpGZFEF75mCwFQsKb.push(v["@value"]);
5990
+ }
5991
+ instance.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb = _2cGKFeFJMmiNpGZFEF75mCwFQsKb;
5926
5992
  return instance;
5927
5993
  }
5928
5994
  _getCustomInspectProxy() {
5929
5995
  const proxy = super._getCustomInspectProxy();
5996
+ const _2e9AP7WdHBJYAgXG6GEyq7nSkNMe = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe
5997
+ // deno-lint-ignore no-explicit-any
5998
+ .map((v) => v instanceof URL
5999
+ ? {
6000
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
6001
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
6002
+ }
6003
+ : v);
6004
+ if (_2e9AP7WdHBJYAgXG6GEyq7nSkNMe.length == 1) {
6005
+ proxy.width = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe[0];
6006
+ }
6007
+ const _2cGKFeFJMmiNpGZFEF75mCwFQsKb = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb
6008
+ // deno-lint-ignore no-explicit-any
6009
+ .map((v) => v instanceof URL
6010
+ ? {
6011
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
6012
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
6013
+ }
6014
+ : v);
6015
+ if (_2cGKFeFJMmiNpGZFEF75mCwFQsKb.length == 1) {
6016
+ proxy.height = _2cGKFeFJMmiNpGZFEF75mCwFQsKb[0];
6017
+ }
5930
6018
  return proxy;
5931
6019
  }
5932
6020
  [Symbol.for("Deno.customInspect")](inspect, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "0.8.0-dev.167+c47b7e4d",
3
+ "version": "0.8.0",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -1826,6 +1826,7 @@ export declare class Article extends Object {
1826
1826
  /** Represents a document of any kind.
1827
1827
  */
1828
1828
  export declare class Document extends Object {
1829
+ #private;
1829
1830
  /**
1830
1831
  * The type URI of {@link Document}: `https://www.w3.org/ns/activitystreams#Document`.
1831
1832
  */
@@ -1879,6 +1880,8 @@ export declare class Document extends Object {
1879
1880
  mediaType?: string | null;
1880
1881
  duration?: dntShim.Temporal.Duration | null;
1881
1882
  sensitive?: boolean | null;
1883
+ width?: number | null;
1884
+ height?: number | null;
1882
1885
  }, { documentLoader, contextLoader, }?: {
1883
1886
  documentLoader?: DocumentLoader;
1884
1887
  contextLoader?: DocumentLoader;
@@ -1933,10 +1936,20 @@ export declare class Document extends Object {
1933
1936
  mediaType?: string | null;
1934
1937
  duration?: dntShim.Temporal.Duration | null;
1935
1938
  sensitive?: boolean | null;
1939
+ width?: number | null;
1940
+ height?: number | null;
1936
1941
  }, options?: {
1937
1942
  documentLoader?: DocumentLoader;
1938
1943
  contextLoader?: DocumentLoader;
1939
1944
  }): Document;
1945
+ /** Specifies a hint as to the rendering width in
1946
+ * device-independent pixels of the linked resource.
1947
+ */
1948
+ get width(): number | null;
1949
+ /** Specifies a hint as to the rendering height in
1950
+ * device-independent pixels of the linked resource.
1951
+ */
1952
+ get height(): number | null;
1940
1953
  /**
1941
1954
  * Converts this object to a JSON-LD structure.
1942
1955
  * @returns The JSON-LD representation of this object.
@@ -2013,6 +2026,8 @@ export declare class Audio extends Document {
2013
2026
  mediaType?: string | null;
2014
2027
  duration?: dntShim.Temporal.Duration | null;
2015
2028
  sensitive?: boolean | null;
2029
+ width?: number | null;
2030
+ height?: number | null;
2016
2031
  }, { documentLoader, contextLoader, }?: {
2017
2032
  documentLoader?: DocumentLoader;
2018
2033
  contextLoader?: DocumentLoader;
@@ -2067,6 +2082,8 @@ export declare class Audio extends Document {
2067
2082
  mediaType?: string | null;
2068
2083
  duration?: dntShim.Temporal.Duration | null;
2069
2084
  sensitive?: boolean | null;
2085
+ width?: number | null;
2086
+ height?: number | null;
2070
2087
  }, options?: {
2071
2088
  documentLoader?: DocumentLoader;
2072
2089
  contextLoader?: DocumentLoader;
@@ -4126,6 +4143,8 @@ export declare class Image extends Document {
4126
4143
  mediaType?: string | null;
4127
4144
  duration?: dntShim.Temporal.Duration | null;
4128
4145
  sensitive?: boolean | null;
4146
+ width?: number | null;
4147
+ height?: number | null;
4129
4148
  }, { documentLoader, contextLoader, }?: {
4130
4149
  documentLoader?: DocumentLoader;
4131
4150
  contextLoader?: DocumentLoader;
@@ -4180,6 +4199,8 @@ export declare class Image extends Document {
4180
4199
  mediaType?: string | null;
4181
4200
  duration?: dntShim.Temporal.Duration | null;
4182
4201
  sensitive?: boolean | null;
4202
+ width?: number | null;
4203
+ height?: number | null;
4183
4204
  }, options?: {
4184
4205
  documentLoader?: DocumentLoader;
4185
4206
  contextLoader?: DocumentLoader;
@@ -5532,6 +5553,8 @@ export declare class Page extends Document {
5532
5553
  mediaType?: string | null;
5533
5554
  duration?: dntShim.Temporal.Duration | null;
5534
5555
  sensitive?: boolean | null;
5556
+ width?: number | null;
5557
+ height?: number | null;
5535
5558
  }, { documentLoader, contextLoader, }?: {
5536
5559
  documentLoader?: DocumentLoader;
5537
5560
  contextLoader?: DocumentLoader;
@@ -5586,6 +5609,8 @@ export declare class Page extends Document {
5586
5609
  mediaType?: string | null;
5587
5610
  duration?: dntShim.Temporal.Duration | null;
5588
5611
  sensitive?: boolean | null;
5612
+ width?: number | null;
5613
+ height?: number | null;
5589
5614
  }, options?: {
5590
5615
  documentLoader?: DocumentLoader;
5591
5616
  contextLoader?: DocumentLoader;
@@ -7469,6 +7494,8 @@ export declare class Video extends Document {
7469
7494
  mediaType?: string | null;
7470
7495
  duration?: dntShim.Temporal.Duration | null;
7471
7496
  sensitive?: boolean | null;
7497
+ width?: number | null;
7498
+ height?: number | null;
7472
7499
  }, { documentLoader, contextLoader, }?: {
7473
7500
  documentLoader?: DocumentLoader;
7474
7501
  contextLoader?: DocumentLoader;
@@ -7523,6 +7550,8 @@ export declare class Video extends Document {
7523
7550
  mediaType?: string | null;
7524
7551
  duration?: dntShim.Temporal.Duration | null;
7525
7552
  sensitive?: boolean | null;
7553
+ width?: number | null;
7554
+ height?: number | null;
7526
7555
  }, options?: {
7527
7556
  documentLoader?: DocumentLoader;
7528
7557
  contextLoader?: DocumentLoader;