@sprucelabs/spruce-feed-view-controllers 1.1.10 → 1.3.0

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.
@@ -11,6 +11,7 @@ export default class FeedCardViewController extends AbstractViewController<Card>
11
11
  private pendingAddedMessages;
12
12
  protected feedVc: FeedViewController;
13
13
  protected recipientId?: string;
14
+ private locationId?;
14
15
  constructor(options: ViewControllerOptions & FeedCardViewControllerOptions);
15
16
  private FeedVc;
16
17
  private CardVc;
@@ -36,4 +37,5 @@ export interface FeedCardLoadOptions {
36
37
  predicates: FeedPredicate[];
37
38
  authenticator: Authenticator;
38
39
  recipientId?: string;
40
+ locationId?: string;
39
41
  }
@@ -129,19 +129,22 @@ class FeedCardViewController extends AbstractViewController {
129
129
  }
130
130
  load(options) {
131
131
  return __awaiter(this, void 0, void 0, function* () {
132
- const { predicates, authenticator, recipientId } = assertOptions(options, ['predicates', 'authenticator'], `You have to pass the search predicates and the authenticator to load the feed. They are in the form of { source: {...}, target: {...} }[]. If you wanna find anything to AND from a person, you gotta pass personId to both source AND target.`);
132
+ const { predicates, authenticator, recipientId, locationId } = assertOptions(options, ['predicates', 'authenticator'], `You have to pass the search predicates and the authenticator to load the feed. They are in the form of { source: {...}, target: {...} }[]. If you wanna find anything to AND from a person, you gotta pass personId to both source AND target.`);
133
133
  this.recipientId = recipientId;
134
134
  this.predicates = predicates;
135
135
  this.auth = authenticator;
136
+ this.locationId = locationId;
136
137
  const client = yield this.connectToApi();
137
138
  yield client.on('feed.did-update-feed::v2023_03_04', this.handleDidUpdateFeed);
138
139
  if (recipientId) {
139
140
  yield Promise.all([
140
141
  this.subscribe(client, {
141
142
  toPersonId: recipientId,
143
+ locationId,
142
144
  }),
143
145
  this.subscribe(client, {
144
146
  fromPersonId: recipientId,
147
+ locationId,
145
148
  }),
146
149
  ]);
147
150
  }
@@ -170,6 +173,9 @@ class FeedCardViewController extends AbstractViewController {
170
173
  const client = yield this.connectToApi();
171
174
  try {
172
175
  const [{ feed }] = yield client.emitAndFlattenResponses('get-feed::v2020_12_25', {
176
+ target: {
177
+ locationId: this.locationId,
178
+ },
173
179
  payload: {
174
180
  predicates: this.predicates,
175
181
  },
@@ -11,6 +11,7 @@ export default class FeedCardViewController extends AbstractViewController<Card>
11
11
  private pendingAddedMessages;
12
12
  protected feedVc: FeedViewController;
13
13
  protected recipientId?: string;
14
+ private locationId?;
14
15
  constructor(options: ViewControllerOptions & FeedCardViewControllerOptions);
15
16
  private FeedVc;
16
17
  private CardVc;
@@ -36,4 +37,5 @@ export interface FeedCardLoadOptions {
36
37
  predicates: FeedPredicate[];
37
38
  authenticator: Authenticator;
38
39
  recipientId?: string;
40
+ locationId?: string;
39
41
  }
@@ -115,19 +115,22 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
115
115
  return this.isLoaded;
116
116
  }
117
117
  async load(options) {
118
- const { predicates, authenticator, recipientId } = (0, schema_1.assertOptions)(options, ['predicates', 'authenticator'], `You have to pass the search predicates and the authenticator to load the feed. They are in the form of { source: {...}, target: {...} }[]. If you wanna find anything to AND from a person, you gotta pass personId to both source AND target.`);
118
+ const { predicates, authenticator, recipientId, locationId } = (0, schema_1.assertOptions)(options, ['predicates', 'authenticator'], `You have to pass the search predicates and the authenticator to load the feed. They are in the form of { source: {...}, target: {...} }[]. If you wanna find anything to AND from a person, you gotta pass personId to both source AND target.`);
119
119
  this.recipientId = recipientId;
120
120
  this.predicates = predicates;
121
121
  this.auth = authenticator;
122
+ this.locationId = locationId;
122
123
  const client = await this.connectToApi();
123
124
  await client.on('feed.did-update-feed::v2023_03_04', this.handleDidUpdateFeed);
124
125
  if (recipientId) {
125
126
  await Promise.all([
126
127
  this.subscribe(client, {
127
128
  toPersonId: recipientId,
129
+ locationId,
128
130
  }),
129
131
  this.subscribe(client, {
130
132
  fromPersonId: recipientId,
133
+ locationId,
131
134
  }),
132
135
  ]);
133
136
  }
@@ -147,6 +150,9 @@ class FeedCardViewController extends heartwood_view_controllers_1.AbstractViewCo
147
150
  const client = await this.connectToApi();
148
151
  try {
149
152
  const [{ feed }] = await client.emitAndFlattenResponses('get-feed::v2020_12_25', {
153
+ target: {
154
+ locationId: this.locationId,
155
+ },
150
156
  payload: {
151
157
  predicates: this.predicates,
152
158
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-feed-view-controllers",
3
3
  "description": "Spruce feed view controllers",
4
- "version": "1.1.10",
4
+ "version": "1.3.0",
5
5
  "skill": {
6
6
  "namespace": "feed"
7
7
  },