@glissandoo/lib 1.108.1 → 1.108.3

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.
@@ -106,7 +106,6 @@ export declare enum FbFunctionName {
106
106
  GroupSendInvitationEmail = "group-sendInvitationEmail",
107
107
  MetricsWeekly = "metrics-week",
108
108
  MiscAddSubscriber = "misc-addSubscriber",
109
- MiscHandleActiveCampaignAutomationContacts = "misc-handleActiveCampaignAutomationContacts",
110
109
  MiscScheduledFirestoreExport = "misc-scheduledFirestoreExport",
111
110
  MiscValidateUsername = "misc-validateUsername",
112
111
  NotificationMarkAllAsReaded = "notification-markAllAsReaded",
@@ -175,5 +174,11 @@ export declare enum FbFunctionName {
175
174
  WebhookEventOnCreate = "webhookEvent-onCreate",
176
175
  WebhookGocardless = "webhook-gocardless",
177
176
  WebhookMessagebird = "webhook-messagebird",
178
- WebhookStripe = "webhook-stripe"
177
+ WebhookStripe = "webhook-stripe",
178
+ InventoryAddType = "inventory-addType",
179
+ InventoryDeleteType = "inventory-deleteType",
180
+ InventoryMerge = "inventory-merge",
181
+ InventoryItemAdd = "inventoryItem-add",
182
+ InventoryItemDelete = "inventoryItem-delete",
183
+ InventoryItemEdit = "inventoryItem-edit"
179
184
  }
@@ -110,7 +110,6 @@ var FbFunctionName;
110
110
  FbFunctionName["GroupSendInvitationEmail"] = "group-sendInvitationEmail";
111
111
  FbFunctionName["MetricsWeekly"] = "metrics-week";
112
112
  FbFunctionName["MiscAddSubscriber"] = "misc-addSubscriber";
113
- FbFunctionName["MiscHandleActiveCampaignAutomationContacts"] = "misc-handleActiveCampaignAutomationContacts";
114
113
  FbFunctionName["MiscScheduledFirestoreExport"] = "misc-scheduledFirestoreExport";
115
114
  FbFunctionName["MiscValidateUsername"] = "misc-validateUsername";
116
115
  FbFunctionName["NotificationMarkAllAsReaded"] = "notification-markAllAsReaded";
@@ -181,4 +180,10 @@ var FbFunctionName;
181
180
  FbFunctionName["WebhookGocardless"] = "webhook-gocardless";
182
181
  FbFunctionName["WebhookMessagebird"] = "webhook-messagebird";
183
182
  FbFunctionName["WebhookStripe"] = "webhook-stripe";
183
+ FbFunctionName["InventoryAddType"] = "inventory-addType";
184
+ FbFunctionName["InventoryDeleteType"] = "inventory-deleteType";
185
+ FbFunctionName["InventoryMerge"] = "inventory-merge";
186
+ FbFunctionName["InventoryItemAdd"] = "inventoryItem-add";
187
+ FbFunctionName["InventoryItemDelete"] = "inventoryItem-delete";
188
+ FbFunctionName["InventoryItemEdit"] = "inventoryItem-edit";
184
189
  })(FbFunctionName = exports.FbFunctionName || (exports.FbFunctionName = {}));
@@ -0,0 +1,22 @@
1
+ import { AInventoryTypeCustomField } from '../models/Inventory/types';
2
+ export declare namespace InventoryFbFunctionsTypes {
3
+ interface AddTypeParams {
4
+ inventoryId: string;
5
+ typeId: string;
6
+ groupId: string;
7
+ name: string;
8
+ customFields: Omit<AInventoryTypeCustomField, 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy'>[];
9
+ }
10
+ type AddTypeResult = void;
11
+ interface DeleteTypeParams {
12
+ inventoryId: string;
13
+ groupId: string;
14
+ typeId: string;
15
+ }
16
+ type DeleteTypeResult = void;
17
+ interface MergeParams {
18
+ baseGroupId: string;
19
+ targetGroupId: string;
20
+ }
21
+ type MergeResult = void;
22
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ import { InventoryItemCustomFieldValue, InventoryItemStatus } from '../models/Inventory/Item/types';
2
+ export declare namespace InventoryItemFbFunctionsTypes {
3
+ interface AddParams {
4
+ itemId: string;
5
+ inventoryId: string;
6
+ groupId: string;
7
+ typeId: string;
8
+ title: string;
9
+ thumbnailURL: string | null;
10
+ fieldValues: Record<string, InventoryItemCustomFieldValue>;
11
+ }
12
+ type AddResult = void;
13
+ interface EditParams {
14
+ itemId: string;
15
+ inventoryId: string;
16
+ groupId: string;
17
+ title: string;
18
+ status: InventoryItemStatus;
19
+ thumbnailUrl: string | null;
20
+ fieldValues: Record<string, InventoryItemCustomFieldValue>;
21
+ }
22
+ type EditResult = void;
23
+ interface DeleteParams {
24
+ itemId: string;
25
+ inventoryId: string;
26
+ groupId: string;
27
+ }
28
+ type DeleteResult = void;
29
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -117,7 +117,6 @@ const regionByFunctions = {
117
117
  [index_1.FbFunctionName.GroupSendInvitationEmail]: GCloudRegions.EuropeWest6,
118
118
  [index_1.FbFunctionName.MetricsWeekly]: GCloudRegions.EuropeWest6,
119
119
  [index_1.FbFunctionName.MiscAddSubscriber]: GCloudRegions.EuropeWest6,
120
- [index_1.FbFunctionName.MiscHandleActiveCampaignAutomationContacts]: GCloudRegions.EuropeWest6,
121
120
  [index_1.FbFunctionName.MiscScheduledFirestoreExport]: GCloudRegions.EuropeWest6,
122
121
  [index_1.FbFunctionName.MiscValidateUsername]: GCloudRegions.UsCentral1,
123
122
  [index_1.FbFunctionName.NotificationMarkAllAsReaded]: GCloudRegions.UsCentral1,
@@ -188,6 +187,12 @@ const regionByFunctions = {
188
187
  [index_1.FbFunctionName.WebhookGocardless]: GCloudRegions.EuropeWest6,
189
188
  [index_1.FbFunctionName.WebhookMessagebird]: GCloudRegions.EuropeWest6,
190
189
  [index_1.FbFunctionName.WebhookStripe]: GCloudRegions.EuropeWest6,
190
+ [index_1.FbFunctionName.InventoryAddType]: GCloudRegions.EuropeWest6,
191
+ [index_1.FbFunctionName.InventoryDeleteType]: GCloudRegions.EuropeWest6,
192
+ [index_1.FbFunctionName.InventoryMerge]: GCloudRegions.EuropeWest6,
193
+ [index_1.FbFunctionName.InventoryItemAdd]: GCloudRegions.EuropeWest6,
194
+ [index_1.FbFunctionName.InventoryItemDelete]: GCloudRegions.EuropeWest6,
195
+ [index_1.FbFunctionName.InventoryItemEdit]: GCloudRegions.EuropeWest6,
191
196
  };
192
197
  const getFunctionRegion = (fn) => regionByFunctions[fn] || defaultRegion;
193
198
  exports.getFunctionRegion = getFunctionRegion;
@@ -32,5 +32,7 @@ export declare enum CollectionNames {
32
32
  FederationPartnerships = "partnerships",
33
33
  Offer = "offer",
34
34
  OfferApplicants = "applicants",
35
- WebhookEvent = "webhookEvent"
35
+ WebhookEvent = "webhookEvent",
36
+ Inventory = "inventory",
37
+ InventoryItems = "inventoryItems"
36
38
  }
@@ -37,4 +37,6 @@ var CollectionNames;
37
37
  CollectionNames["Offer"] = "offer";
38
38
  CollectionNames["OfferApplicants"] = "applicants";
39
39
  CollectionNames["WebhookEvent"] = "webhookEvent";
40
+ CollectionNames["Inventory"] = "inventory";
41
+ CollectionNames["InventoryItems"] = "inventoryItems";
40
42
  })(CollectionNames = exports.CollectionNames || (exports.CollectionNames = {}));
@@ -131,4 +131,6 @@ export default class Group extends GroupBasic<GroupData> {
131
131
  } | undefined;
132
132
  get customFields(): Record<string, import("./types").GroupCustomField>;
133
133
  get customFieldsList(): AGroupCustomField[];
134
+ get inventoryId(): string;
135
+ get coverURL(): string | null;
134
136
  }
@@ -292,5 +292,11 @@ class Group extends basic_1.default {
292
292
  }))
293
293
  .sort((a, b) => a.order - b.order);
294
294
  }
295
+ get inventoryId() {
296
+ return this.data.inventoryId;
297
+ }
298
+ get coverURL() {
299
+ return this.data.coverURL || null;
300
+ }
295
301
  }
296
302
  exports.default = Group;
@@ -71,7 +71,8 @@ export declare enum AdminPermissions {
71
71
  Repertoire = "repertoire",
72
72
  Communications = "communications",
73
73
  Offers = "offers",
74
- Billing = "billing"
74
+ Billing = "billing",
75
+ Inventory = "inventory"
75
76
  }
76
77
  export declare enum GroupConfigKey {
77
78
  IncludesMembersToEventsWhenJoined = "includesMembersToEventsWhenJoined",
@@ -249,6 +250,8 @@ export interface GroupData extends GroupBasicData {
249
250
  subscriptionId: string | null;
250
251
  questions: Record<string, GroupEventQuestion>;
251
252
  customFields: Record<string, GroupCustomField>;
253
+ inventoryId: string;
254
+ coverURL: string | null;
252
255
  readonly createdOn: CreatedOn;
253
256
  readonly owner: DocumentReference;
254
257
  readonly createdAt: Timestamp;
@@ -45,6 +45,7 @@ var AdminPermissions;
45
45
  AdminPermissions["Communications"] = "communications";
46
46
  AdminPermissions["Offers"] = "offers";
47
47
  AdminPermissions["Billing"] = "billing";
48
+ AdminPermissions["Inventory"] = "inventory";
48
49
  })(AdminPermissions = exports.AdminPermissions || (exports.AdminPermissions = {}));
49
50
  var GroupConfigKey;
50
51
  (function (GroupConfigKey) {
@@ -0,0 +1,33 @@
1
+ import Model, { DocumentModel } from '../../Model';
2
+ import { InventoryItemAssignmentKind, InventoryItemData, InventoryItemStatus } from './types';
3
+ export default class InventoryItem extends Model<InventoryItemData> {
4
+ constructor(doc: DocumentModel);
5
+ get title(): string;
6
+ get typeId(): string;
7
+ get assignedToKind(): InventoryItemAssignmentKind | null;
8
+ get assignedToMemberId(): string | null;
9
+ get assignedToOtherLabel(): string | null;
10
+ get assignedAt(): FirebaseFirestore.Timestamp | null;
11
+ get isAssigned(): boolean;
12
+ get isAssignedToMember(): boolean;
13
+ get isAssignedToOther(): boolean;
14
+ get assignedHistory(): {
15
+ memberId: string | null;
16
+ otherLabel: string | null;
17
+ assignedAt: FirebaseFirestore.Timestamp | null;
18
+ returnedAt: FirebaseFirestore.Timestamp | null;
19
+ }[];
20
+ get status(): InventoryItemStatus;
21
+ get isAvailable(): boolean;
22
+ get isOnHold(): boolean;
23
+ get isRetired(): boolean;
24
+ get fieldValues(): Record<string, import("./types").InventoryItemCustomFieldValue>;
25
+ get createdAt(): FirebaseFirestore.Timestamp;
26
+ get createdBy(): string;
27
+ get updatedAt(): FirebaseFirestore.Timestamp;
28
+ get updatedBy(): string;
29
+ get deletedAt(): FirebaseFirestore.Timestamp | null;
30
+ get isDeleted(): boolean;
31
+ get isActive(): boolean;
32
+ get thumbnailURL(): string | null;
33
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lodash_1 = require("lodash");
7
+ const Model_1 = __importDefault(require("../../Model"));
8
+ const types_1 = require("./types");
9
+ class InventoryItem extends Model_1.default {
10
+ constructor(doc) {
11
+ super(doc);
12
+ }
13
+ get title() {
14
+ return this.data.title || '';
15
+ }
16
+ get typeId() {
17
+ return this.data.typeId;
18
+ }
19
+ get assignedToKind() {
20
+ return this.data.assignedToKind || null;
21
+ }
22
+ get assignedToMemberId() {
23
+ return this.data.assignedToMemberId || null;
24
+ }
25
+ get assignedToOtherLabel() {
26
+ return this.data.assignedToOtherLabel || null;
27
+ }
28
+ get assignedAt() {
29
+ return this.data.assignedAt || null;
30
+ }
31
+ get isAssigned() {
32
+ return !(0, lodash_1.isNull)(this.assignedToKind);
33
+ }
34
+ get isAssignedToMember() {
35
+ return this.assignedToKind === types_1.InventoryItemAssignmentKind.Member;
36
+ }
37
+ get isAssignedToOther() {
38
+ return this.assignedToKind === types_1.InventoryItemAssignmentKind.Other;
39
+ }
40
+ get assignedHistory() {
41
+ return this.data.assignedHistory || [];
42
+ }
43
+ get status() {
44
+ return this.data.status || types_1.InventoryItemStatus.Available;
45
+ }
46
+ get isAvailable() {
47
+ return this.status === types_1.InventoryItemStatus.Available;
48
+ }
49
+ get isOnHold() {
50
+ return this.status === types_1.InventoryItemStatus.OnHold;
51
+ }
52
+ get isRetired() {
53
+ return this.status === types_1.InventoryItemStatus.Retired;
54
+ }
55
+ get fieldValues() {
56
+ return this.data.fieldValues || {};
57
+ }
58
+ get createdAt() {
59
+ return this.data.createdAt;
60
+ }
61
+ get createdBy() {
62
+ return this.data.createdBy;
63
+ }
64
+ get updatedAt() {
65
+ return this.data.updatedAt;
66
+ }
67
+ get updatedBy() {
68
+ return this.data.updatedBy;
69
+ }
70
+ get deletedAt() {
71
+ return this.data.deletedAt || null;
72
+ }
73
+ get isDeleted() {
74
+ return !this.exists || !(0, lodash_1.isNull)(this.deletedAt);
75
+ }
76
+ get isActive() {
77
+ return !this.isDeleted;
78
+ }
79
+ get thumbnailURL() {
80
+ return this.data.thumbnailURL || null;
81
+ }
82
+ }
83
+ exports.default = InventoryItem;
@@ -0,0 +1,38 @@
1
+ import { Timestamp } from '@google-cloud/firestore';
2
+ export declare enum InventoryItemStatus {
3
+ Available = "available",
4
+ Assigned = "assigned",
5
+ OnHold = "onHold",
6
+ Retired = "retired"
7
+ }
8
+ export declare enum InventoryItemAssignmentKind {
9
+ Member = "member",
10
+ Other = "other"
11
+ }
12
+ export interface InventoryItemCustomFieldValue {
13
+ value: string | number | boolean | Timestamp | string[] | null;
14
+ updatedAt: Timestamp;
15
+ updatedBy: string;
16
+ }
17
+ export interface InventoryItemData {
18
+ title: string;
19
+ typeId: string;
20
+ thumbnailURL: string | null;
21
+ assignedToKind: InventoryItemAssignmentKind | null;
22
+ assignedToMemberId: string | null;
23
+ assignedToOtherLabel: string | null;
24
+ assignedAt: Timestamp | null;
25
+ assignedHistory: {
26
+ memberId: string | null;
27
+ otherLabel: string | null;
28
+ assignedAt: Timestamp | null;
29
+ returnedAt: Timestamp | null;
30
+ }[];
31
+ status: InventoryItemStatus;
32
+ fieldValues: Record<string, InventoryItemCustomFieldValue>;
33
+ createdAt: Timestamp;
34
+ createdBy: string;
35
+ updatedAt: Timestamp;
36
+ updatedBy: string;
37
+ deletedAt: Timestamp | null;
38
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InventoryItemAssignmentKind = exports.InventoryItemStatus = void 0;
4
+ var InventoryItemStatus;
5
+ (function (InventoryItemStatus) {
6
+ InventoryItemStatus["Available"] = "available";
7
+ InventoryItemStatus["Assigned"] = "assigned";
8
+ InventoryItemStatus["OnHold"] = "onHold";
9
+ InventoryItemStatus["Retired"] = "retired";
10
+ })(InventoryItemStatus = exports.InventoryItemStatus || (exports.InventoryItemStatus = {}));
11
+ var InventoryItemAssignmentKind;
12
+ (function (InventoryItemAssignmentKind) {
13
+ InventoryItemAssignmentKind["Member"] = "member";
14
+ InventoryItemAssignmentKind["Other"] = "other";
15
+ })(InventoryItemAssignmentKind = exports.InventoryItemAssignmentKind || (exports.InventoryItemAssignmentKind = {}));
@@ -0,0 +1,30 @@
1
+ import Model, { DocumentModel } from '../Model';
2
+ import { InventoryData } from './types';
3
+ export default class Inventory extends Model<InventoryData> {
4
+ constructor(doc: DocumentModel);
5
+ get groupIds(): string[];
6
+ get types(): Record<string, import("./types").InventoryTypeData>;
7
+ get typesList(): {
8
+ customFields: {
9
+ label: string;
10
+ type: import("./types").InventoryTypeCustomFieldType;
11
+ required: boolean;
12
+ placeholder: string | null;
13
+ options: import("./types").InventoryTypeCustomFieldOption[];
14
+ order: number;
15
+ createdAt: FirebaseFirestore.Timestamp;
16
+ updatedAt: FirebaseFirestore.Timestamp;
17
+ createdBy: string;
18
+ updatedBy: string;
19
+ id: string;
20
+ }[];
21
+ name: string;
22
+ id: string;
23
+ }[];
24
+ get mergedIntoGroupId(): string | null;
25
+ get isMerged(): boolean;
26
+ get archivedAt(): FirebaseFirestore.Timestamp | null;
27
+ get isArchived(): boolean;
28
+ get ownerGroupId(): string;
29
+ get createdAt(): FirebaseFirestore.Timestamp;
30
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lodash_1 = require("lodash");
7
+ const Model_1 = __importDefault(require("../Model"));
8
+ class Inventory extends Model_1.default {
9
+ constructor(doc) {
10
+ super(doc);
11
+ }
12
+ get groupIds() {
13
+ return this.data.groupIds || [];
14
+ }
15
+ get types() {
16
+ return this.data.types || {};
17
+ }
18
+ get typesList() {
19
+ return Object.entries(this.types).map(([id, type]) => {
20
+ const fields = type.customFields || {};
21
+ return {
22
+ id,
23
+ ...type,
24
+ customFields: Object.entries(fields)
25
+ .map(([fieldId, field]) => ({
26
+ id: fieldId,
27
+ ...field,
28
+ }))
29
+ .sort((a, b) => a.order - b.order),
30
+ };
31
+ });
32
+ }
33
+ get mergedIntoGroupId() {
34
+ return this.data.mergedIntoGroupId || null;
35
+ }
36
+ get isMerged() {
37
+ return !(0, lodash_1.isNull)(this.mergedIntoGroupId);
38
+ }
39
+ get archivedAt() {
40
+ return this.data.archivedAt || null;
41
+ }
42
+ get isArchived() {
43
+ return !(0, lodash_1.isNull)(this.archivedAt);
44
+ }
45
+ get ownerGroupId() {
46
+ return this.data.ownerGroupId;
47
+ }
48
+ get createdAt() {
49
+ return this.data.createdAt;
50
+ }
51
+ }
52
+ exports.default = Inventory;
@@ -0,0 +1,47 @@
1
+ import { Timestamp } from '@google-cloud/firestore';
2
+ export declare enum InventoryTypeCustomFieldType {
3
+ TEXT = "text",
4
+ NUMBER = "number",
5
+ DATE = "date",
6
+ SELECT = "select",
7
+ LINK = "link",
8
+ PARAGRAPH = "paragraph",
9
+ ASSIGNABLE = "assignable",
10
+ IMAGES = "images",
11
+ DOCUMENT = "document"
12
+ }
13
+ export interface InventoryTypeCustomFieldOption {
14
+ id: string;
15
+ value: string;
16
+ }
17
+ export interface InventoryTypeCustomField {
18
+ label: string;
19
+ type: InventoryTypeCustomFieldType;
20
+ required: boolean;
21
+ placeholder: string | null;
22
+ options: InventoryTypeCustomFieldOption[];
23
+ order: number;
24
+ createdAt: Timestamp;
25
+ updatedAt: Timestamp;
26
+ createdBy: string;
27
+ updatedBy: string;
28
+ }
29
+ export interface AInventoryTypeCustomField extends InventoryTypeCustomField {
30
+ id: string;
31
+ }
32
+ export interface InventoryTypeData {
33
+ name: string;
34
+ customFields: Record<string, InventoryTypeCustomField>;
35
+ }
36
+ export interface AInventoryTypeData extends Omit<InventoryTypeData, 'customFields'> {
37
+ id: string;
38
+ customFields: AInventoryTypeCustomField[];
39
+ }
40
+ export interface InventoryData {
41
+ groupIds: string[];
42
+ types: Record<string, InventoryTypeData>;
43
+ mergedIntoGroupId: string | null;
44
+ archivedAt: Timestamp | null;
45
+ readonly ownerGroupId: string;
46
+ readonly createdAt: Timestamp;
47
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InventoryTypeCustomFieldType = void 0;
4
+ var InventoryTypeCustomFieldType;
5
+ (function (InventoryTypeCustomFieldType) {
6
+ InventoryTypeCustomFieldType["TEXT"] = "text";
7
+ InventoryTypeCustomFieldType["NUMBER"] = "number";
8
+ InventoryTypeCustomFieldType["DATE"] = "date";
9
+ InventoryTypeCustomFieldType["SELECT"] = "select";
10
+ InventoryTypeCustomFieldType["LINK"] = "link";
11
+ InventoryTypeCustomFieldType["PARAGRAPH"] = "paragraph";
12
+ InventoryTypeCustomFieldType["ASSIGNABLE"] = "assignable";
13
+ InventoryTypeCustomFieldType["IMAGES"] = "images";
14
+ InventoryTypeCustomFieldType["DOCUMENT"] = "document";
15
+ })(InventoryTypeCustomFieldType = exports.InventoryTypeCustomFieldType || (exports.InventoryTypeCustomFieldType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.108.1",
3
+ "version": "1.108.3",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",