@shushed/helpers 0.0.305 → 0.0.307-airtable-read-fields-20260409144255
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.
|
@@ -14,6 +14,7 @@ class AirtableHelper extends runtime_1.default {
|
|
|
14
14
|
primaryKeyFieldName;
|
|
15
15
|
primaryKeyWritable = true;
|
|
16
16
|
viewId;
|
|
17
|
+
readDictionary;
|
|
17
18
|
constructor(opts, airtableOpts) {
|
|
18
19
|
super(opts);
|
|
19
20
|
this.baseId = airtableOpts.baseId;
|
|
@@ -27,6 +28,7 @@ class AirtableHelper extends runtime_1.default {
|
|
|
27
28
|
if (typeof airtableOpts.viewId !== 'undefined') {
|
|
28
29
|
this.viewId = airtableOpts.viewId;
|
|
29
30
|
}
|
|
31
|
+
this.readDictionary = airtableOpts.readFieldIds;
|
|
30
32
|
}
|
|
31
33
|
static normalizeWebhookCellValues(cellValuesByFieldId) {
|
|
32
34
|
const isSelectOption = (v) => v && typeof v === 'object' && !Array.isArray(v) && typeof v.id === 'string' && v.id.startsWith('sel');
|
|
@@ -650,10 +652,11 @@ class AirtableHelper extends runtime_1.default {
|
|
|
650
652
|
async webhookHasChanged() {
|
|
651
653
|
const existingWebhook = await this.getWebhook();
|
|
652
654
|
const fieldIds = Object.values(this.dictionary).filter((x, idx, arr) => arr.indexOf(x) === idx);
|
|
655
|
+
const includeFieldIds = [...fieldIds, ...Object.values(this.readDictionary ?? {})].filter((x, idx, arr) => arr.indexOf(x) === idx);
|
|
653
656
|
const expectedScope = this.viewId || this.tableId;
|
|
654
657
|
if (existingWebhook?.specification.options.filters.recordChangeScope === expectedScope
|
|
655
658
|
&& (0, lodash_isequal_1.default)(existingWebhook?.specification.options.filters.watchDataInFieldIds, fieldIds)
|
|
656
|
-
&& (0, lodash_isequal_1.default)(existingWebhook?.specification.options.includes?.includeCellValuesInFieldIds,
|
|
659
|
+
&& (0, lodash_isequal_1.default)(existingWebhook?.specification.options.includes?.includeCellValuesInFieldIds, includeFieldIds)
|
|
657
660
|
&& existingWebhook.specification.options.includes?.includePreviousCellValues) {
|
|
658
661
|
return false;
|
|
659
662
|
}
|
|
@@ -662,10 +665,11 @@ class AirtableHelper extends runtime_1.default {
|
|
|
662
665
|
async updateOrCreateWebhook() {
|
|
663
666
|
const existingWebhook = await this.getWebhook();
|
|
664
667
|
const fieldIds = Object.values(this.dictionary).filter((x, idx, arr) => arr.indexOf(x) === idx);
|
|
668
|
+
const includeFieldIds = [...fieldIds, ...Object.values(this.readDictionary ?? {})].filter((x, idx, arr) => arr.indexOf(x) === idx);
|
|
665
669
|
const recordChangeScope = this.viewId || this.tableId;
|
|
666
670
|
if (existingWebhook?.specification.options.filters.recordChangeScope === recordChangeScope
|
|
667
671
|
&& (0, lodash_isequal_1.default)(existingWebhook?.specification.options.filters.watchDataInFieldIds, fieldIds)
|
|
668
|
-
&& (0, lodash_isequal_1.default)(existingWebhook?.specification.options.includes?.includeCellValuesInFieldIds,
|
|
672
|
+
&& (0, lodash_isequal_1.default)(existingWebhook?.specification.options.includes?.includeCellValuesInFieldIds, includeFieldIds)
|
|
669
673
|
&& existingWebhook.specification.options.includes?.includePreviousCellValues) {
|
|
670
674
|
return existingWebhook;
|
|
671
675
|
}
|
|
@@ -685,7 +689,7 @@ class AirtableHelper extends runtime_1.default {
|
|
|
685
689
|
},
|
|
686
690
|
includes: {
|
|
687
691
|
includePreviousCellValues: true,
|
|
688
|
-
includeCellValuesInFieldIds:
|
|
692
|
+
includeCellValuesInFieldIds: includeFieldIds
|
|
689
693
|
}
|
|
690
694
|
},
|
|
691
695
|
}
|
|
@@ -601,12 +601,6 @@ function transformMasterOrder(payload) {
|
|
|
601
601
|
if (code === 'TRACKED48') {
|
|
602
602
|
return 'EVRI';
|
|
603
603
|
}
|
|
604
|
-
if (code === 'HSHERMES48') {
|
|
605
|
-
return 'EVRI';
|
|
606
|
-
}
|
|
607
|
-
if (code === 'HSHERMES24') {
|
|
608
|
-
return 'EVRI';
|
|
609
|
-
}
|
|
610
604
|
if (code === 'EVRID') {
|
|
611
605
|
return 'EVRI';
|
|
612
606
|
}
|
|
@@ -13,6 +13,7 @@ declare class AirtableHelper<T extends Record<string, string>, K extends keyof T
|
|
|
13
13
|
primaryKeyFieldName: K;
|
|
14
14
|
primaryKeyWritable: boolean;
|
|
15
15
|
viewId?: string;
|
|
16
|
+
readDictionary?: Record<string, string>;
|
|
16
17
|
constructor(opts: RuntimeOpts, airtableOpts: {
|
|
17
18
|
baseId: string;
|
|
18
19
|
tableId: string;
|
|
@@ -21,6 +22,7 @@ declare class AirtableHelper<T extends Record<string, string>, K extends keyof T
|
|
|
21
22
|
primaryKeyFieldName: K;
|
|
22
23
|
primaryKeyWritable?: boolean;
|
|
23
24
|
viewId?: string;
|
|
25
|
+
readFieldIds?: Record<string, string>;
|
|
24
26
|
});
|
|
25
27
|
static normalizeWebhookCellValues(cellValuesByFieldId: Record<string, any>): Record<string, any>;
|
|
26
28
|
static translateFields<T extends Record<string, string>, S extends {
|