@glissandoo/lib 1.108.0 → 1.108.2
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/functions/index.d.ts +7 -1
- package/functions/index.js +6 -0
- package/functions/inventory.d.ts +22 -0
- package/functions/inventory.js +2 -0
- package/functions/inventoryItem.d.ts +29 -0
- package/functions/inventoryItem.js +2 -0
- package/functions/regions.js +6 -0
- package/helpers/collections.d.ts +3 -1
- package/helpers/collections.js +2 -0
- package/lang/ca.json +1 -1
- package/models/Group/index.d.ts +2 -0
- package/models/Group/index.js +6 -0
- package/models/Group/types.d.ts +7 -2
- package/models/Group/types.js +3 -0
- package/models/Inventory/Item/index.d.ts +33 -0
- package/models/Inventory/Item/index.js +83 -0
- package/models/Inventory/Item/types.d.ts +38 -0
- package/models/Inventory/Item/types.js +15 -0
- package/models/Inventory/index.d.ts +30 -0
- package/models/Inventory/index.js +52 -0
- package/models/Inventory/types.d.ts +47 -0
- package/models/Inventory/types.js +15 -0
- package/package.json +2 -1
package/functions/index.d.ts
CHANGED
|
@@ -175,5 +175,11 @@ export declare enum FbFunctionName {
|
|
|
175
175
|
WebhookEventOnCreate = "webhookEvent-onCreate",
|
|
176
176
|
WebhookGocardless = "webhook-gocardless",
|
|
177
177
|
WebhookMessagebird = "webhook-messagebird",
|
|
178
|
-
WebhookStripe = "webhook-stripe"
|
|
178
|
+
WebhookStripe = "webhook-stripe",
|
|
179
|
+
InventoryAddType = "inventory-addType",
|
|
180
|
+
InventoryDeleteType = "inventory-deleteType",
|
|
181
|
+
InventoryMerge = "inventory-merge",
|
|
182
|
+
InventoryItemAdd = "inventoryItem-add",
|
|
183
|
+
InventoryItemDelete = "inventoryItem-delete",
|
|
184
|
+
InventoryItemEdit = "inventoryItem-edit"
|
|
179
185
|
}
|
package/functions/index.js
CHANGED
|
@@ -181,4 +181,10 @@ var FbFunctionName;
|
|
|
181
181
|
FbFunctionName["WebhookGocardless"] = "webhook-gocardless";
|
|
182
182
|
FbFunctionName["WebhookMessagebird"] = "webhook-messagebird";
|
|
183
183
|
FbFunctionName["WebhookStripe"] = "webhook-stripe";
|
|
184
|
+
FbFunctionName["InventoryAddType"] = "inventory-addType";
|
|
185
|
+
FbFunctionName["InventoryDeleteType"] = "inventory-deleteType";
|
|
186
|
+
FbFunctionName["InventoryMerge"] = "inventory-merge";
|
|
187
|
+
FbFunctionName["InventoryItemAdd"] = "inventoryItem-add";
|
|
188
|
+
FbFunctionName["InventoryItemDelete"] = "inventoryItem-delete";
|
|
189
|
+
FbFunctionName["InventoryItemEdit"] = "inventoryItem-edit";
|
|
184
190
|
})(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,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
|
+
}
|
package/functions/regions.js
CHANGED
|
@@ -188,6 +188,12 @@ const regionByFunctions = {
|
|
|
188
188
|
[index_1.FbFunctionName.WebhookGocardless]: GCloudRegions.EuropeWest6,
|
|
189
189
|
[index_1.FbFunctionName.WebhookMessagebird]: GCloudRegions.EuropeWest6,
|
|
190
190
|
[index_1.FbFunctionName.WebhookStripe]: GCloudRegions.EuropeWest6,
|
|
191
|
+
[index_1.FbFunctionName.InventoryAddType]: GCloudRegions.EuropeWest6,
|
|
192
|
+
[index_1.FbFunctionName.InventoryDeleteType]: GCloudRegions.EuropeWest6,
|
|
193
|
+
[index_1.FbFunctionName.InventoryMerge]: GCloudRegions.EuropeWest6,
|
|
194
|
+
[index_1.FbFunctionName.InventoryItemAdd]: GCloudRegions.EuropeWest6,
|
|
195
|
+
[index_1.FbFunctionName.InventoryItemDelete]: GCloudRegions.EuropeWest6,
|
|
196
|
+
[index_1.FbFunctionName.InventoryItemEdit]: GCloudRegions.EuropeWest6,
|
|
191
197
|
};
|
|
192
198
|
const getFunctionRegion = (fn) => regionByFunctions[fn] || defaultRegion;
|
|
193
199
|
exports.getFunctionRegion = getFunctionRegion;
|
package/helpers/collections.d.ts
CHANGED
|
@@ -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
|
}
|
package/helpers/collections.js
CHANGED
|
@@ -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 = {}));
|
package/lang/ca.json
CHANGED
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"instruments.marchingToms": "Toms de marxa",
|
|
122
122
|
"instruments.melodica": "Melódica",
|
|
123
123
|
"instruments.mezzosoproano": "Mezzosoprano",
|
|
124
|
-
"instruments.musicConductor": "
|
|
124
|
+
"instruments.musicConductor": "Direcció Musical",
|
|
125
125
|
"instruments.oboe": "Oboè",
|
|
126
126
|
"instruments.peak-flute": "Flauta de bec",
|
|
127
127
|
"instruments.percussion": "Percussió",
|
package/models/Group/index.d.ts
CHANGED
|
@@ -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
|
}
|
package/models/Group/index.js
CHANGED
|
@@ -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;
|
package/models/Group/types.d.ts
CHANGED
|
@@ -33,7 +33,9 @@ export declare enum GroupCustomFieldType {
|
|
|
33
33
|
DATE = "date",
|
|
34
34
|
SELECT = "select",
|
|
35
35
|
EMAIL = "email",
|
|
36
|
-
PHONE = "phone"
|
|
36
|
+
PHONE = "phone",
|
|
37
|
+
LINK = "link",
|
|
38
|
+
PARAGRAPH = "paragraph"
|
|
37
39
|
}
|
|
38
40
|
export interface GroupCustomFieldOption {
|
|
39
41
|
id: string;
|
|
@@ -69,7 +71,8 @@ export declare enum AdminPermissions {
|
|
|
69
71
|
Repertoire = "repertoire",
|
|
70
72
|
Communications = "communications",
|
|
71
73
|
Offers = "offers",
|
|
72
|
-
Billing = "billing"
|
|
74
|
+
Billing = "billing",
|
|
75
|
+
Inventory = "inventory"
|
|
73
76
|
}
|
|
74
77
|
export declare enum GroupConfigKey {
|
|
75
78
|
IncludesMembersToEventsWhenJoined = "includesMembersToEventsWhenJoined",
|
|
@@ -247,6 +250,8 @@ export interface GroupData extends GroupBasicData {
|
|
|
247
250
|
subscriptionId: string | null;
|
|
248
251
|
questions: Record<string, GroupEventQuestion>;
|
|
249
252
|
customFields: Record<string, GroupCustomField>;
|
|
253
|
+
inventoryId: string;
|
|
254
|
+
coverURL: string | null;
|
|
250
255
|
readonly createdOn: CreatedOn;
|
|
251
256
|
readonly owner: DocumentReference;
|
|
252
257
|
readonly createdAt: Timestamp;
|
package/models/Group/types.js
CHANGED
|
@@ -32,6 +32,8 @@ var GroupCustomFieldType;
|
|
|
32
32
|
GroupCustomFieldType["SELECT"] = "select";
|
|
33
33
|
GroupCustomFieldType["EMAIL"] = "email";
|
|
34
34
|
GroupCustomFieldType["PHONE"] = "phone";
|
|
35
|
+
GroupCustomFieldType["LINK"] = "link";
|
|
36
|
+
GroupCustomFieldType["PARAGRAPH"] = "paragraph";
|
|
35
37
|
})(GroupCustomFieldType = exports.GroupCustomFieldType || (exports.GroupCustomFieldType = {}));
|
|
36
38
|
var AdminPermissions;
|
|
37
39
|
(function (AdminPermissions) {
|
|
@@ -43,6 +45,7 @@ var AdminPermissions;
|
|
|
43
45
|
AdminPermissions["Communications"] = "communications";
|
|
44
46
|
AdminPermissions["Offers"] = "offers";
|
|
45
47
|
AdminPermissions["Billing"] = "billing";
|
|
48
|
+
AdminPermissions["Inventory"] = "inventory";
|
|
46
49
|
})(AdminPermissions = exports.AdminPermissions || (exports.AdminPermissions = {}));
|
|
47
50
|
var GroupConfigKey;
|
|
48
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.
|
|
3
|
+
"version": "1.108.2",
|
|
4
4
|
"description": "Glissandoo library js",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"supabase:dev": "export $(grep -v '^#' supabase/.dev.env | xargs) && LINKED_REF=$(supabase projects list | grep '●' | awk -F '|' '{print $3}' | xargs) && [ \"$LINKED_REF\" != \"$SUPABASE_PROJECT_REF\" ] && npm run supabase:dev:link; supabase",
|
|
29
29
|
"supabase:prod": "export $(grep -v '^#' supabase/.prod.env | xargs) && LINKED_REF=$(supabase projects list | grep '●' | awk -F '|' '{print $3}' | xargs) && [ \"$LINKED_REF\" != \"$SUPABASE_PROJECT_REF\" ] && npm run supabase:prod:link; supabase",
|
|
30
30
|
"supabase:local:types": "supabase gen types typescript --local > src/types/supabase/generated.ts; prettier --write src/types/supabase/generated.ts",
|
|
31
|
+
"supabase:prod:types": "supabase gen types typescript --project-id fqqdedotyiuyetimcflq > src/types/supabase/generated.ts; prettier --write src/types/supabase/generated.ts",
|
|
31
32
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
32
33
|
"translation:download": "localazy download",
|
|
33
34
|
"translation:upload": "localazy upload",
|