@fedify/fedify 0.13.0-dev.311 → 0.13.0-dev.313

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/CHANGES.md CHANGED
@@ -8,6 +8,18 @@ Version 0.13.0
8
8
 
9
9
  To be released.
10
10
 
11
+ - Added `closed` property to `Question` class in Activity Vocabulary API.
12
+
13
+ - Added `Question.closed` property.
14
+ - `new Question()` constructor now accepts `closed` option.
15
+ - `Question.clone()` method now accepts `closed` option.
16
+
17
+ - Added `voters` property to `Question` class in Activity Vocabulary API.
18
+
19
+ - Added `Question.voters` property.
20
+ - `new Question()` constructor now accepts `voters` option.
21
+ - `Question.clone()` method now accepts `voters` option.
22
+
11
23
  - Removed the singular actor key pair dispatcher APIs which were deprecated
12
24
  in version 0.10.0.
13
25
 
@@ -12,6 +12,7 @@ defaultContext:
12
12
  - "https://w3id.org/security/data-integrity/v1"
13
13
  - toot: "http://joinmastodon.org/ns#"
14
14
  sensitive: "as:sensitive"
15
+ votersCount: "toot:votersCount"
15
16
  Emoji: "toot:Emoji"
16
17
  Hashtag: "as:Hashtag"
17
18
  properties: []
@@ -9,6 +9,7 @@ defaultContext:
9
9
  - "https://w3id.org/security/data-integrity/v1"
10
10
  - toot: "http://joinmastodon.org/ns#"
11
11
  sensitive: "as:sensitive"
12
+ votersCount: "toot:votersCount"
12
13
  Emoji: "toot:Emoji"
13
14
  Hashtag: "as:Hashtag"
14
15
  ChatMessage: "http://litepub.social/ns#ChatMessage"
@@ -9,5 +9,10 @@ description: |
9
9
  defaultContext:
10
10
  - "https://www.w3.org/ns/activitystreams"
11
11
  - "https://w3id.org/security/data-integrity/v1"
12
- - ChatMessage: "http://litepub.social/ns#ChatMessage"
12
+ - toot: "http://joinmastodon.org/ns#"
13
+ sensitive: "as:sensitive"
14
+ votersCount: "toot:votersCount"
15
+ Emoji: "toot:Emoji"
16
+ Hashtag: "as:Hashtag"
17
+ ChatMessage: "http://litepub.social/ns#ChatMessage"
13
18
  properties: []
@@ -9,13 +9,15 @@ description: |
9
9
  but the direct object is the question itself and therefore it would not
10
10
  contain an `object` property.
11
11
 
12
- Either of the `anyOf` and `oneOf` properties *may* be used to express possible
13
- answers, but a Question object *must not* have both properties.
12
+ Either of the `inclusiveOptions` and `exclusiveOptions` properties *may* be
13
+ used to express possible answers, but a Question object *must not* have both
14
+ properties.
14
15
  defaultContext:
15
16
  - "https://www.w3.org/ns/activitystreams"
16
17
  - "https://w3id.org/security/data-integrity/v1"
17
18
  - toot: "http://joinmastodon.org/ns#"
18
19
  sensitive: "as:sensitive"
20
+ votersCount: "toot:votersCount"
19
21
  Emoji: "toot:Emoji"
20
22
  Hashtag: "as:Hashtag"
21
23
 
@@ -27,7 +29,7 @@ properties:
27
29
  description: |
28
30
  Identifies an exclusive option for a Question. Use of `exclusiveOptions`
29
31
  implies that the Question can have only a single answer. To indicate that
30
- a Question can have multiple answers, use `inclusiveOptions`.
32
+ a Question can have multiple answers, use `inclusiveOptions`.
31
33
  range:
32
34
  - "https://www.w3.org/ns/activitystreams#Object"
33
35
 
@@ -41,3 +43,22 @@ properties:
41
43
  a Question can have only one answer, use `exclusiveOptions`.
42
44
  range:
43
45
  - "https://www.w3.org/ns/activitystreams#Object"
46
+
47
+ - singularName: closed
48
+ functional: true
49
+ uri: "https://www.w3.org/ns/activitystreams#closed"
50
+ description: |
51
+ Indicates that a question has been closed, and answers are no longer
52
+ accepted.
53
+ range:
54
+ - "http://www.w3.org/2001/XMLSchema#dateTime"
55
+ - "http://www.w3.org/2001/XMLSchema#boolean"
56
+
57
+ - singularName: voters
58
+ functional: true
59
+ uri: "http://joinmastodon.org/ns#votersCount"
60
+ description: |
61
+ How many people have voted in the poll. Distinct from how many votes have
62
+ been cast (in the case of multiple-choice polls).
63
+ range:
64
+ - "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
@@ -14,6 +14,7 @@ defaultContext:
14
14
  - "https://w3id.org/security/data-integrity/v1"
15
15
  - toot: "http://joinmastodon.org/ns#"
16
16
  sensitive: "as:sensitive"
17
+ votersCount: "toot:votersCount"
17
18
  Emoji: "toot:Emoji"
18
19
  Hashtag: "as:Hashtag"
19
20
  ChatMessage: "http://litepub.social/ns#ChatMessage"
@@ -8318,6 +8318,7 @@ export class Announce extends Activity {
8318
8318
  {
8319
8319
  "toot": "http://joinmastodon.org/ns#",
8320
8320
  "sensitive": "as:sensitive",
8321
+ "votersCount": "toot:votersCount",
8321
8322
  "Emoji": "toot:Emoji",
8322
8323
  "Hashtag": "as:Hashtag",
8323
8324
  },
@@ -12761,6 +12762,7 @@ export class Create extends Activity {
12761
12762
  {
12762
12763
  "toot": "http://joinmastodon.org/ns#",
12763
12764
  "sensitive": "as:sensitive",
12765
+ "votersCount": "toot:votersCount",
12764
12766
  "Emoji": "toot:Emoji",
12765
12767
  "Hashtag": "as:Hashtag",
12766
12768
  "ChatMessage": "http://litepub.social/ns#ChatMessage",
@@ -12892,7 +12894,14 @@ export class Delete extends Activity {
12892
12894
  [
12893
12895
  "https://www.w3.org/ns/activitystreams",
12894
12896
  "https://w3id.org/security/data-integrity/v1",
12895
- { "ChatMessage": "http://litepub.social/ns#ChatMessage" },
12897
+ {
12898
+ "toot": "http://joinmastodon.org/ns#",
12899
+ "sensitive": "as:sensitive",
12900
+ "votersCount": "toot:votersCount",
12901
+ "Emoji": "toot:Emoji",
12902
+ "Hashtag": "as:Hashtag",
12903
+ "ChatMessage": "http://litepub.social/ns#ChatMessage",
12904
+ },
12896
12905
  ];
12897
12906
  const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
12898
12907
  if (docContext != null) {
@@ -23897,8 +23906,9 @@ export class Profile extends Object {
23897
23906
  * but the direct object is the question itself and therefore it would not
23898
23907
  * contain an `object` property.
23899
23908
  *
23900
- * Either of the `anyOf` and `oneOf` properties *may* be used to express possible
23901
- * answers, but a Question object *must not* have both properties.
23909
+ * Either of the `inclusiveOptions` and `exclusiveOptions` properties *may* be
23910
+ * used to express possible answers, but a Question object *must not* have both
23911
+ * properties.
23902
23912
  */
23903
23913
  export class Question extends IntransitiveActivity {
23904
23914
  /**
@@ -23909,6 +23919,8 @@ export class Question extends IntransitiveActivity {
23909
23919
  }
23910
23920
  #_2N5scKaVEcdYHFmfKYYacAwUhUgQ = [];
23911
23921
  #_2mV6isMTPRKbWdLCjcpiEysq5dAY = [];
23922
+ #_3KronwL8DiiKBRcJFKQPiEHm8xb6 = [];
23923
+ #_3H4RdST7dxfmghccvE3rKD3KgcxG = [];
23912
23924
  /**
23913
23925
  * Constructs a new instance of Question with the given values.
23914
23926
  * @param values The values to initialize the instance with.
@@ -23938,6 +23950,28 @@ export class Question extends IntransitiveActivity {
23938
23950
  "Object | URL" + ".");
23939
23951
  }
23940
23952
  }
23953
+ if ("closed" in values && values.closed != null) {
23954
+ if (values.closed instanceof dntShim.Temporal.Instant ||
23955
+ typeof values.closed === "boolean") {
23956
+ // @ts-ignore: type is checked above.
23957
+ this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6 = [values.closed];
23958
+ }
23959
+ else {
23960
+ throw new TypeError("The closed must be of type " +
23961
+ "Temporal.Instant | boolean" + ".");
23962
+ }
23963
+ }
23964
+ if ("voters" in values && values.voters != null) {
23965
+ if (typeof values.voters === "number" && Number.isInteger(values.voters) &&
23966
+ values.voters >= 0) {
23967
+ // @ts-ignore: type is checked above.
23968
+ this.#_3H4RdST7dxfmghccvE3rKD3KgcxG = [values.voters];
23969
+ }
23970
+ else {
23971
+ throw new TypeError("The voters must be of type " +
23972
+ "number" + ".");
23973
+ }
23974
+ }
23941
23975
  }
23942
23976
  /**
23943
23977
  * Clones this instance, optionally updating it with the given values.
@@ -23971,6 +24005,30 @@ export class Question extends IntransitiveActivity {
23971
24005
  "Object | URL" + ".");
23972
24006
  }
23973
24007
  }
24008
+ clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6 = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6;
24009
+ if ("closed" in values && values.closed != null) {
24010
+ if (values.closed instanceof dntShim.Temporal.Instant ||
24011
+ typeof values.closed === "boolean") {
24012
+ // @ts-ignore: type is checked above.
24013
+ clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6 = [values.closed];
24014
+ }
24015
+ else {
24016
+ throw new TypeError("The closed must be of type " +
24017
+ "Temporal.Instant | boolean" + ".");
24018
+ }
24019
+ }
24020
+ clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG;
24021
+ if ("voters" in values && values.voters != null) {
24022
+ if (typeof values.voters === "number" && Number.isInteger(values.voters) &&
24023
+ values.voters >= 0) {
24024
+ // @ts-ignore: type is checked above.
24025
+ clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG = [values.voters];
24026
+ }
24027
+ else {
24028
+ throw new TypeError("The voters must be of type " +
24029
+ "number" + ".");
24030
+ }
24031
+ }
23974
24032
  return clone;
23975
24033
  }
23976
24034
  async #fetchExclusiveOption(url, options = {}) {
@@ -24081,6 +24139,22 @@ export class Question extends IntransitiveActivity {
24081
24139
  yield v;
24082
24140
  }
24083
24141
  }
24142
+ /** Indicates that a question has been closed, and answers are no longer
24143
+ * accepted.
24144
+ */
24145
+ get closed() {
24146
+ if (this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6.length < 1)
24147
+ return null;
24148
+ return this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6[0];
24149
+ }
24150
+ /** How many people have voted in the poll. Distinct from how many votes have
24151
+ * been cast (in the case of multiple-choice polls).
24152
+ */
24153
+ get voters() {
24154
+ if (this.#_3H4RdST7dxfmghccvE3rKD3KgcxG.length < 1)
24155
+ return null;
24156
+ return this.#_3H4RdST7dxfmghccvE3rKD3KgcxG[0];
24157
+ }
24084
24158
  /**
24085
24159
  * Converts this object to a JSON-LD structure.
24086
24160
  * @returns The JSON-LD representation of this object.
@@ -24117,6 +24191,30 @@ export class Question extends IntransitiveActivity {
24117
24191
  if (array.length > 0) {
24118
24192
  values["https://www.w3.org/ns/activitystreams#anyOf"] = array;
24119
24193
  }
24194
+ array = [];
24195
+ for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6) {
24196
+ const element = v instanceof dntShim.Temporal.Instant
24197
+ ? {
24198
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime",
24199
+ "@value": v.toString(),
24200
+ }
24201
+ : { "@value": v };
24202
+ array.push(element);
24203
+ }
24204
+ if (array.length > 0) {
24205
+ values["https://www.w3.org/ns/activitystreams#closed"] = array;
24206
+ }
24207
+ array = [];
24208
+ for (const v of this.#_3H4RdST7dxfmghccvE3rKD3KgcxG) {
24209
+ const element = {
24210
+ "@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger",
24211
+ "@value": v,
24212
+ };
24213
+ array.push(element);
24214
+ }
24215
+ if (array.length > 0) {
24216
+ values["http://joinmastodon.org/ns#votersCount"] = array;
24217
+ }
24120
24218
  values["@type"] = ["https://www.w3.org/ns/activitystreams#Question"];
24121
24219
  if (this.id)
24122
24220
  values["@id"] = this.id.href;
@@ -24130,6 +24228,7 @@ export class Question extends IntransitiveActivity {
24130
24228
  {
24131
24229
  "toot": "http://joinmastodon.org/ns#",
24132
24230
  "sensitive": "as:sensitive",
24231
+ "votersCount": "toot:votersCount",
24133
24232
  "Emoji": "toot:Emoji",
24134
24233
  "Hashtag": "as:Hashtag",
24135
24234
  },
@@ -24227,6 +24326,42 @@ export class Question extends IntransitiveActivity {
24227
24326
  _2mV6isMTPRKbWdLCjcpiEysq5dAY.push(await Object.fromJsonLd(v, options));
24228
24327
  }
24229
24328
  instance.#_2mV6isMTPRKbWdLCjcpiEysq5dAY = _2mV6isMTPRKbWdLCjcpiEysq5dAY;
24329
+ const _3KronwL8DiiKBRcJFKQPiEHm8xb6 = [];
24330
+ const _3KronwL8DiiKBRcJFKQPiEHm8xb6__array = values["https://www.w3.org/ns/activitystreams#closed"];
24331
+ for (const v of _3KronwL8DiiKBRcJFKQPiEHm8xb6__array == null
24332
+ ? []
24333
+ : _3KronwL8DiiKBRcJFKQPiEHm8xb6__array.length === 1 &&
24334
+ "@list" in _3KronwL8DiiKBRcJFKQPiEHm8xb6__array[0]
24335
+ ? _3KronwL8DiiKBRcJFKQPiEHm8xb6__array[0]["@list"]
24336
+ : _3KronwL8DiiKBRcJFKQPiEHm8xb6__array) {
24337
+ if (v == null)
24338
+ continue;
24339
+ const decoded = typeof v === "object" && "@type" in v &&
24340
+ "@value" in v && typeof v["@value"] === "string" &&
24341
+ v["@type"] === "http://www.w3.org/2001/XMLSchema#dateTime"
24342
+ ? dntShim.Temporal.Instant.from(v["@value"])
24343
+ : typeof v === "object" && "@value" in v &&
24344
+ typeof v["@value"] === "boolean"
24345
+ ? v["@value"]
24346
+ : undefined;
24347
+ if (typeof decoded === "undefined")
24348
+ continue;
24349
+ _3KronwL8DiiKBRcJFKQPiEHm8xb6.push(decoded);
24350
+ }
24351
+ instance.#_3KronwL8DiiKBRcJFKQPiEHm8xb6 = _3KronwL8DiiKBRcJFKQPiEHm8xb6;
24352
+ const _3H4RdST7dxfmghccvE3rKD3KgcxG = [];
24353
+ const _3H4RdST7dxfmghccvE3rKD3KgcxG__array = values["http://joinmastodon.org/ns#votersCount"];
24354
+ for (const v of _3H4RdST7dxfmghccvE3rKD3KgcxG__array == null
24355
+ ? []
24356
+ : _3H4RdST7dxfmghccvE3rKD3KgcxG__array.length === 1 &&
24357
+ "@list" in _3H4RdST7dxfmghccvE3rKD3KgcxG__array[0]
24358
+ ? _3H4RdST7dxfmghccvE3rKD3KgcxG__array[0]["@list"]
24359
+ : _3H4RdST7dxfmghccvE3rKD3KgcxG__array) {
24360
+ if (v == null)
24361
+ continue;
24362
+ _3H4RdST7dxfmghccvE3rKD3KgcxG.push(v["@value"]);
24363
+ }
24364
+ instance.#_3H4RdST7dxfmghccvE3rKD3KgcxG = _3H4RdST7dxfmghccvE3rKD3KgcxG;
24230
24365
  return instance;
24231
24366
  }
24232
24367
  _getCustomInspectProxy() {
@@ -24257,6 +24392,28 @@ export class Question extends IntransitiveActivity {
24257
24392
  _2mV6isMTPRKbWdLCjcpiEysq5dAY.length > 0) {
24258
24393
  proxy.inclusiveOptions = _2mV6isMTPRKbWdLCjcpiEysq5dAY;
24259
24394
  }
24395
+ const _3KronwL8DiiKBRcJFKQPiEHm8xb6 = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6
24396
+ // deno-lint-ignore no-explicit-any
24397
+ .map((v) => v instanceof URL
24398
+ ? {
24399
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
24400
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
24401
+ }
24402
+ : v);
24403
+ if (_3KronwL8DiiKBRcJFKQPiEHm8xb6.length == 1) {
24404
+ proxy.closed = _3KronwL8DiiKBRcJFKQPiEHm8xb6[0];
24405
+ }
24406
+ const _3H4RdST7dxfmghccvE3rKD3KgcxG = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG
24407
+ // deno-lint-ignore no-explicit-any
24408
+ .map((v) => v instanceof URL
24409
+ ? {
24410
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
24411
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options),
24412
+ }
24413
+ : v);
24414
+ if (_3H4RdST7dxfmghccvE3rKD3KgcxG.length == 1) {
24415
+ proxy.voters = _3H4RdST7dxfmghccvE3rKD3KgcxG[0];
24416
+ }
24260
24417
  return proxy;
24261
24418
  }
24262
24419
  [Symbol.for("Deno.customInspect")](inspect, options) {
@@ -28023,6 +28180,7 @@ export class Update extends Activity {
28023
28180
  {
28024
28181
  "toot": "http://joinmastodon.org/ns#",
28025
28182
  "sensitive": "as:sensitive",
28183
+ "votersCount": "toot:votersCount",
28026
28184
  "Emoji": "toot:Emoji",
28027
28185
  "Hashtag": "as:Hashtag",
28028
28186
  "ChatMessage": "http://litepub.social/ns#ChatMessage",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "0.13.0-dev.311+4c301514",
3
+ "version": "0.13.0-dev.313+a50df0be",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -8903,8 +8903,9 @@ export declare class Profile extends Object {
8903
8903
  * but the direct object is the question itself and therefore it would not
8904
8904
  * contain an `object` property.
8905
8905
  *
8906
- * Either of the `anyOf` and `oneOf` properties *may* be used to express possible
8907
- * answers, but a Question object *must not* have both properties.
8906
+ * Either of the `inclusiveOptions` and `exclusiveOptions` properties *may* be
8907
+ * used to express possible answers, but a Question object *must not* have both
8908
+ * properties.
8908
8909
  */
8909
8910
  export declare class Question extends IntransitiveActivity {
8910
8911
  #private;
@@ -8977,6 +8978,8 @@ export declare class Question extends IntransitiveActivity {
8977
8978
  instruments?: (Object | URL)[];
8978
8979
  exclusiveOptions?: (Object | URL)[];
8979
8980
  inclusiveOptions?: (Object | URL)[];
8981
+ closed?: dntShim.Temporal.Instant | boolean | null;
8982
+ voters?: number | null;
8980
8983
  }, { documentLoader, contextLoader, }?: {
8981
8984
  documentLoader?: DocumentLoader;
8982
8985
  contextLoader?: DocumentLoader;
@@ -9047,6 +9050,8 @@ export declare class Question extends IntransitiveActivity {
9047
9050
  instruments?: (Object | URL)[];
9048
9051
  exclusiveOptions?: (Object | URL)[];
9049
9052
  inclusiveOptions?: (Object | URL)[];
9053
+ closed?: dntShim.Temporal.Instant | boolean | null;
9054
+ voters?: number | null;
9050
9055
  }, options?: {
9051
9056
  documentLoader?: DocumentLoader;
9052
9057
  contextLoader?: DocumentLoader;
@@ -9081,6 +9086,14 @@ export declare class Question extends IntransitiveActivity {
9081
9086
  contextLoader?: DocumentLoader;
9082
9087
  suppressError?: boolean;
9083
9088
  }): AsyncIterable<Object>;
9089
+ /** Indicates that a question has been closed, and answers are no longer
9090
+ * accepted.
9091
+ */
9092
+ get closed(): dntShim.Temporal.Instant | boolean | null;
9093
+ /** How many people have voted in the poll. Distinct from how many votes have
9094
+ * been cast (in the case of multiple-choice polls).
9095
+ */
9096
+ get voters(): number | null;
9084
9097
  /**
9085
9098
  * Converts this object to a JSON-LD structure.
9086
9099
  * @returns The JSON-LD representation of this object.