@social-mail/social-mail-web-server 1.7.607 → 1.7.609

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.
Files changed (44) hide show
  1. package/dist/server/model/SocialMailContext.d.ts +4 -2
  2. package/dist/server/model/SocialMailContext.d.ts.map +1 -1
  3. package/dist/server/model/SocialMailContext.js +4 -2
  4. package/dist/server/model/SocialMailContext.js.map +1 -1
  5. package/dist/server/model/SocialMailContextEvents.d.ts.map +1 -1
  6. package/dist/server/model/SocialMailContextEvents.js +6 -3
  7. package/dist/server/model/SocialMailContextEvents.js.map +1 -1
  8. package/dist/server/model/entities/{WebSiteTag.d.ts → StoreTag.d.ts} +3 -3
  9. package/dist/server/model/entities/StoreTag.d.ts.map +1 -0
  10. package/dist/server/model/entities/{WebSiteTag.js → StoreTag.js} +11 -11
  11. package/dist/server/model/entities/StoreTag.js.map +1 -0
  12. package/dist/server/model/entities/Tag.d.ts +4 -2
  13. package/dist/server/model/entities/Tag.d.ts.map +1 -1
  14. package/dist/server/model/entities/Tag.js.map +1 -1
  15. package/dist/server/model/entities/WebSite.d.ts +4 -2
  16. package/dist/server/model/entities/WebSite.d.ts.map +1 -1
  17. package/dist/server/model/entities/WebSite.js.map +1 -1
  18. package/dist/server/model/entities/WebSiteTemplateTag.d.ts +9 -0
  19. package/dist/server/model/entities/WebSiteTemplateTag.d.ts.map +1 -0
  20. package/dist/server/model/entities/WebSiteTemplateTag.js +45 -0
  21. package/dist/server/model/entities/WebSiteTemplateTag.js.map +1 -0
  22. package/dist/server/model/events/StoreTagEvents.d.ts +8 -0
  23. package/dist/server/model/events/StoreTagEvents.d.ts.map +1 -0
  24. package/dist/server/model/events/StoreTagEvents.js +34 -0
  25. package/dist/server/model/events/StoreTagEvents.js.map +1 -0
  26. package/dist/server/model/events/WebSiteTagEvents.d.ts +2 -2
  27. package/dist/server/model/events/WebSiteTagEvents.d.ts.map +1 -1
  28. package/dist/server/model/events/WebSiteTagEvents.js +9 -27
  29. package/dist/server/model/events/WebSiteTagEvents.js.map +1 -1
  30. package/dist/server/services/store/StoreTagCountService.js +1 -1
  31. package/dist/server/services/store/StoreTagCountService.js.map +1 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +1 -1
  34. package/src/server/model/SocialMailContext.ts +5 -3
  35. package/src/server/model/SocialMailContextEvents.ts +6 -3
  36. package/src/server/model/entities/{WebSiteTag.ts → StoreTag.ts} +5 -5
  37. package/src/server/model/entities/Tag.ts +4 -2
  38. package/src/server/model/entities/WebSite.ts +4 -2
  39. package/src/server/model/entities/WebSiteTemplateTag.ts +35 -0
  40. package/src/server/model/events/StoreTagEvents.ts +27 -0
  41. package/src/server/model/events/WebSiteTagEvents.ts +14 -15
  42. package/src/server/services/store/StoreTagCountService.ts +1 -1
  43. package/dist/server/model/entities/WebSiteTag.d.ts.map +0 -1
  44. package/dist/server/model/entities/WebSiteTag.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.7.607",
3
+ "version": "1.7.609",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -49,8 +49,7 @@ import { StoreItemFolderTag } from "./entities/StoreItemFolderTag.js";
49
49
  import { StoreItemFolder } from "./entities/StoreItemFolder.js";
50
50
  import { StoreJournalEntry } from "./entities/StoreJournalEntry.js";
51
51
  import { StoreJournalLineItem } from "./entities/StoreJournalLineItem.js";
52
- import { WebSiteTag } from "./entities/WebSiteTag.js";
53
- import RateLimitToken from "./entities/RateLimitToken.js";
52
+ import { StoreTag } from "./entities/StoreTag.js";
54
53
  import AccessToken from "./entities/AccessToken.js";
55
54
  import ServerActivity from "./entities/ServerActivity.js";
56
55
  import IncomingSmsSource from "./entities/IncomingSmsSource.js";
@@ -79,6 +78,7 @@ import { WebSiteChannelDomain } from "./entities/WebSiteChannelDomain.js";
79
78
  import GeoIPBlock from "./entities/GeoIPBlock.js";
80
79
  import AppTempFile from "./entities/AppTempFile.js";
81
80
  import UserGroupMember from "./entities/UserGroupMember.js";
81
+ import WebSiteTag from "./entities/WebSiteTemplateTag.js";
82
82
 
83
83
  @RegisterScoped
84
84
  export default class SocialMailContext extends EntityContext {
@@ -219,7 +219,7 @@ export default class SocialMailContext extends EntityContext {
219
219
 
220
220
  public storeItemTaxes = this.model.register(StoreItemTax);
221
221
 
222
- public storeTags = this.model.register(WebSiteTag);
222
+ public storeTags = this.model.register(StoreTag);
223
223
 
224
224
  public storeItemTags = this.model.register(StoreItemTag);
225
225
 
@@ -247,6 +247,8 @@ export default class SocialMailContext extends EntityContext {
247
247
 
248
248
  public websiteChannels = this.model.register(WebSiteChannel);
249
249
 
250
+ public websiteTags = this.model.register(WebSiteTag);
251
+
250
252
 
251
253
  public loginSessions = this.model.register(LoginSession);
252
254
 
@@ -80,7 +80,7 @@ import { StoreItemFolderTag } from "./entities/StoreItemFolderTag.js";
80
80
  import { StoreItemFolder } from "./entities/StoreItemFolder.js";
81
81
  import { StoreJournalEntry } from "./entities/StoreJournalEntry.js";
82
82
  import { StoreJournalLineItem } from "./entities/StoreJournalLineItem.js";
83
- import { WebSiteTag } from "./entities/WebSiteTag.js";
83
+ import { StoreTag } from "./entities/StoreTag.js";
84
84
  import StoreItemEvents from "./events/StoreItemEvents.js";
85
85
  import StoreItemPriceEvents from "./events/StoreItemPriceEvents.js";
86
86
  import AccessToken from "./entities/AccessToken.js";
@@ -98,7 +98,7 @@ import IncomingSmsSource from "./entities/IncomingSmsSource.js";
98
98
  import IncomingSmsSourceEvents from "./events/IncomingSmsSourceEvents.js";
99
99
  import VerificationToken, { VerificationTokenAddress } from "./entities/VerificationToken.js";
100
100
  import VerificationTokenEvents from "./events/VerificationTokenEvents.js";
101
- import WebSiteTagEvents from "./events/WebSiteTagEvents.js";
101
+ import StoreTagEvents from "./events/StoreTagEvents.js";
102
102
  import StoreItemFolderTagEvents from "./events/StoreItemFolderTagEvents.js";
103
103
  import HostedZone, { HostedZoneRecord, HostedZoneUser } from "./entities/HostedZone.js";
104
104
  import HostedZoneEvents, { HostedZoneRecordEvents, HostedZoneUserEvents } from "./events/HostedZoneEvents.js";
@@ -142,6 +142,8 @@ import CachedItem from "./entities/CachedItem.js";
142
142
  import CachedItemEvents from "./events/CachedItemEvents.js";
143
143
  import MailboxFolder from "./entities/MailboxFolder.js";
144
144
  import MailboxFolderEvents from "./events/MailboxFolderEvents.js";
145
+ import WebSiteTag from "./entities/WebSiteTemplateTag.js";
146
+ import WebSiteTagEvents from "./events/WebSiteTagEvents.js";
145
147
 
146
148
 
147
149
  @RegisterSingleton
@@ -207,7 +209,7 @@ export default class SocialMailContextEvents extends ContextEvents {
207
209
  this.register(StoreItemFolderTag, StoreItemFolderTagEvents);
208
210
  this.register(StoreMediaFile, StoreMediaFileEvents);
209
211
  this.register(StoreItemTax, StoreItemTaxEvents);
210
- this.register(WebSiteTag, WebSiteTagEvents);
212
+ this.register(StoreTag, StoreTagEvents);
211
213
  // this.register(StorePriceAddOn, StorePriceAddOnEvents);
212
214
  // this.register(StoreBill, StoreOrderEvents);
213
215
  // this.register(StoreBillLine, StoreOrderItemEvents);
@@ -231,6 +233,7 @@ export default class SocialMailContextEvents extends ContextEvents {
231
233
  this.register(WebSiteHost, WebSiteHostEvents);
232
234
  this.register(WebSiteVersion, WebSiteVersionEvents);
233
235
  this.register(WebSiteChannelDomain, WebSiteChannelDomainEvents);
236
+ this.register(WebSiteTag, WebSiteTagEvents);
234
237
 
235
238
  this.register(WebHook, WebHookEvents);
236
239
  this.register(WebHookEvent, WebHookEventEvents);
@@ -5,26 +5,26 @@ import Tag from "./Tag.js";
5
5
  import WebSite from "./WebSite.js";
6
6
 
7
7
 
8
- @Table("WebSiteTags")
9
- export class WebSiteTag {
8
+ @Table("StoreTags")
9
+ export class StoreTag {
10
10
 
11
11
  @Column({ dataType: "BigInt", key: true })
12
12
  @RelateTo(WebSite, {
13
13
  property: (x) => x.store,
14
14
  inverseProperty: (x) => x.tags,
15
15
  foreignKeyConstraint: {
16
- name: "FC_WebSiteTags_WebSiteID",
16
+ name: "FC_StoreTags_storeID",
17
17
  cascade: "delete"
18
18
  }
19
19
  })
20
- public webSiteID: number;
20
+ public storeID: number;
21
21
 
22
22
  @Column({ dataType: "BigInt", key: true })
23
23
  @RelateTo(Tag, {
24
24
  property: (x) => x.tag,
25
25
  inverseProperty: (x) => x.storeTags,
26
26
  foreignKeyConstraint: {
27
- name: "FC_WebSiteTags_TagID",
27
+ name: "FC_StoreTags_TagID",
28
28
  cascade: "delete"
29
29
  }
30
30
  })
@@ -10,9 +10,10 @@ import type MailboxContactTag from "./MailboxContactTag.js";
10
10
  import type EmailTag from "./EmailTag.js";
11
11
  import type { StoreItemTag } from "./StoreItemTag.js";
12
12
  import type { StoreItemFolderTag } from "./StoreItemFolderTag.js";
13
- import type { WebSiteTag } from "./WebSiteTag.js";
13
+ import type { StoreTag } from "./StoreTag.js";
14
14
  import type MailboxFolder from "./MailboxFolder.js";
15
15
  import type MailboxTag from "./MailboxTag.js";
16
+ import type WebSiteTag from "./WebSiteTemplateTag.js";
16
17
 
17
18
  /**
18
19
  * The reason tags table exists in form of string,bigint pair is, we need
@@ -83,8 +84,9 @@ export default class Tag {
83
84
  public contactTags: ContactTag[];
84
85
 
85
86
  public storeItemTags: StoreItemTag[];
86
- storeTags: WebSiteTag[];
87
+ storeTags: StoreTag[];
87
88
  storeItemFolderTags: StoreItemFolderTag[];
88
89
  mailboxFolders: MailboxFolder[];
89
90
  mailboxTags: MailboxTag[];
91
+ webSiteTags: WebSiteTag[];
90
92
  }
@@ -5,7 +5,7 @@ import AppFile, { AppFileVersion } from "./AppFile.js";
5
5
  import { JsonProperty, ReadOnlyJsonProperty } from "@entity-access/server-pages/dist/services/ModelService.js";
6
6
  import Index from "@entity-access/entity-access/dist/decorators/Index.js";
7
7
  import type ServerActivity from "./ServerActivity.js";
8
- import type { WebSiteTag } from "./WebSiteTag.js";
8
+ import type { StoreTag } from "./StoreTag.js";
9
9
  import type { StoreAccount } from "./StoreAccount.js";
10
10
  import type { StoreInsight } from "./StoreInsight.js";
11
11
  import type { StoreItem } from "./StoreItem.js";
@@ -18,6 +18,7 @@ import type { WebSiteChannelDomain } from "./WebSiteChannelDomain.js";
18
18
  import type { WebSiteChannel } from "./WebSiteChannel.js";
19
19
  import type { WebSiteVersion } from "./WebSiteVersion.js";
20
20
  import type { WebSiteHost } from "./WebSiteHost.js";
21
+ import type WebSiteTag from "./WebSiteTemplateTag.js";
21
22
 
22
23
  @Table("WebSites")
23
24
  @Index({
@@ -109,7 +110,7 @@ export default class WebSite {
109
110
  channels: WebSiteChannel[];
110
111
 
111
112
  activities: ServerActivity[];
112
- tags: WebSiteTag[];
113
+ tags: StoreTag[];
113
114
  storeAccounts: StoreAccount[];
114
115
  insights: StoreInsight[];
115
116
  storeItems: StoreItem[];
@@ -119,6 +120,7 @@ export default class WebSite {
119
120
  coupons: StoreCoupon[];
120
121
  webHooks: WebHook[];
121
122
  channelDomains: WebSiteChannelDomain[];
123
+ webSiteTags: WebSiteTag[];
122
124
 
123
125
  }
124
126
 
@@ -0,0 +1,35 @@
1
+ import Column from "@entity-access/entity-access/dist/decorators/Column.js";
2
+ import { RelateTo } from "@entity-access/entity-access/dist/decorators/Relate.js";
3
+ import Table from "@entity-access/entity-access/dist/decorators/Table.js";
4
+ import WebSite from "./WebSite.js";
5
+ import Tag from "./Tag.js";
6
+
7
+ @Table("WebSiteTags")
8
+ export default class WebSiteTag {
9
+
10
+ @Column({ dataType: "BigInt", key: true })
11
+ @RelateTo(WebSite, {
12
+ property: (x) => x.webSite,
13
+ inverseProperty: (x) => x.webSiteTags,
14
+ foreignKeyConstraint: {
15
+ name: "FC_WebSiteTags_TemplateID",
16
+ cascade:"delete"
17
+ }
18
+ })
19
+ templateID: number;
20
+
21
+ @Column({ dataType: "BigInt", key: true })
22
+ @RelateTo(Tag, {
23
+ property: (x) => x.tag,
24
+ inverseProperty: (x) => x.webSiteTags,
25
+ foreignKeyConstraint: {
26
+ name: "FC_WebSiteTags_TemplateID",
27
+ cascade:"delete"
28
+ }
29
+ })
30
+ tagID: number;
31
+
32
+ tag: Tag;
33
+ webSite: WebSite;
34
+
35
+ }
@@ -0,0 +1,27 @@
1
+ import { IEntityQuery } from "@entity-access/entity-access/dist/model/IFilterWithParameter.js";
2
+ import { StoreTag } from "../entities/StoreTag.js";
3
+ import AuthenticatedEvents from "./AuthenticatedEvents.js";
4
+ import ExternalQuery from "@entity-access/server-pages/dist/decorators/ExternalQuery.js";
5
+ import Page from "@entity-access/server-pages/dist/Page.js";
6
+ import { ServiceProvider } from "@entity-access/entity-access/dist/di/di.js";
7
+ import SocialMailContext from "../SocialMailContext.js";
8
+
9
+ export default class StoreTagEvents extends AuthenticatedEvents<StoreTag> {
10
+
11
+ @ExternalQuery
12
+ storeQuery() {
13
+ const page = ServiceProvider.resolve(this, Page as any) as Page;
14
+ const host = page.request.host;
15
+
16
+ const db = ServiceProvider.resolve(this, SocialMailContext);
17
+ const q = db.storeTags.where({ host }, (p) => (x) => x.store.hosts
18
+ .some((h) => h.host === p.host));
19
+ return q;
20
+ }
21
+
22
+
23
+ filter(query: IEntityQuery<StoreTag>): IEntityQuery<StoreTag> {
24
+ return query;
25
+ }
26
+
27
+ }
@@ -1,26 +1,25 @@
1
1
  import { IEntityQuery } from "@entity-access/entity-access/dist/model/IFilterWithParameter.js";
2
- import { WebSiteTag } from "../entities/WebSiteTag.js";
3
2
  import AuthenticatedEvents from "./AuthenticatedEvents.js";
4
- import ExternalQuery from "@entity-access/server-pages/dist/decorators/ExternalQuery.js";
5
- import Page from "@entity-access/server-pages/dist/Page.js";
6
- import { ServiceProvider } from "@entity-access/entity-access/dist/di/di.js";
7
- import SocialMailContext from "../SocialMailContext.js";
3
+ import WebSiteTag from "../entities/WebSiteTemplateTag.js";
4
+ import Sql from "@entity-access/entity-access/dist/sql/Sql.js";
8
5
 
9
6
  export default class WebSiteTagEvents extends AuthenticatedEvents<WebSiteTag> {
10
7
 
11
- @ExternalQuery
12
- storeQuery() {
13
- const page = ServiceProvider.resolve(this, Page as any) as Page;
14
- const host = page.request.host;
8
+ filter(query: IEntityQuery<WebSiteTag>): IEntityQuery<WebSiteTag> {
15
9
 
16
- const db = ServiceProvider.resolve(this, SocialMailContext);
17
- const q = db.storeTags.where({ host }, (p) => (x) => x.store.hosts
18
- .some((h) => h.host === p.host));
19
- return q;
20
- }
10
+ const { sessionUser } = this;
21
11
 
12
+ if (sessionUser.isAdmin) {
13
+ return query;
14
+ }
22
15
 
23
- filter(query: IEntityQuery<WebSiteTag>): IEntityQuery<WebSiteTag> {
16
+ const { readFileAccess } = sessionUser;
17
+
18
+ return query.where({ readFileAccess }, (p) =>
19
+ (x) => Sql.text.likeAny(x.webSite.folder.path, p.readFileAccess));
20
+ }
21
+
22
+ includeFilter(query: IEntityQuery<WebSiteTag>, type?: any, key?: string): IEntityQuery<WebSiteTag> {
24
23
  return query;
25
24
  }
26
25
 
@@ -18,7 +18,7 @@ export default class StoreTagCountService {
18
18
  const ti = { tagID , storeID };
19
19
  const count = diff * (await db.storeItemTags.where(ti, (p) => (x) => x.tagID === p.tagID && x.storeItem.storeID === p.storeID)
20
20
  .count());
21
- await db.storeTags.statements.upsert({ tagID, webSiteID: storeID, count}, void 0, { tagID, webSiteID: storeID });
21
+ await db.storeTags.statements.upsert({ tagID, storeID, count}, void 0, { tagID, storeID });
22
22
  }
23
23
 
24
24
  // const updated = await db.storeTags.where(entity, (p) => (x) => x.storeID === p.storeID)
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebSiteTag.d.ts","sourceRoot":"","sources":["../../../../src/server/model/entities/WebSiteTag.ts"],"names":[],"mappings":"AAGA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,qBACa,UAAU;IAWZ,SAAS,EAAE,MAAM,CAAC;IAWlB,KAAK,EAAE,MAAM,CAAC;IAGd,KAA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