@shushed/helpers 0.0.198-v2-20251117110037 → 0.0.198-v2-20251117161322
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.
|
@@ -49,6 +49,7 @@ class AirtableHelper extends runtime_1.default {
|
|
|
49
49
|
}) {
|
|
50
50
|
let response = null;
|
|
51
51
|
const tableUrl = `https://api.airtable.com/v0/${this.baseId}/${this.tableId}`;
|
|
52
|
+
const currentBatch = payload.slice(callIdx * 10, (callIdx + 1) * 10);
|
|
52
53
|
try {
|
|
53
54
|
response = await fetch(`${tableUrl}`, {
|
|
54
55
|
method: "PATCH",
|
|
@@ -61,7 +62,7 @@ class AirtableHelper extends runtime_1.default {
|
|
|
61
62
|
fieldsToMergeOn: (options.fieldsToMergeOn ?? [this.primaryKeyFieldName]).map(x => this.dictionary[x] || x),
|
|
62
63
|
},
|
|
63
64
|
returnFieldsByFieldId: true,
|
|
64
|
-
records:
|
|
65
|
+
records: currentBatch.map(x => ({
|
|
65
66
|
fields: AirtableHelper.convertToDictionary(this.dictionary, this.primaryKeyWritable === false ? AirtableHelper.removePrimaryKey(x, this.primaryKeyFieldName) : x),
|
|
66
67
|
}))
|
|
67
68
|
}),
|
|
@@ -82,7 +83,17 @@ class AirtableHelper extends runtime_1.default {
|
|
|
82
83
|
return nextCollectedResult;
|
|
83
84
|
}
|
|
84
85
|
catch (err) {
|
|
85
|
-
|
|
86
|
+
const errorMessage = `Failed to update records in ${this.tableId} table (baseId: ${this.baseId}). Status: ${response?.status || 'unknown'}. Error: ${err.message}`;
|
|
87
|
+
const batchErrors = currentBatch.map(() => new Error(errorMessage));
|
|
88
|
+
const nextCollectedResult = {
|
|
89
|
+
updatedRecords: collectedResult.updatedRecords,
|
|
90
|
+
createdRecords: collectedResult.createdRecords,
|
|
91
|
+
records: collectedResult.records.concat(batchErrors)
|
|
92
|
+
};
|
|
93
|
+
if (payload.length > (callIdx + 1) * 10) {
|
|
94
|
+
return this.updateMultiple(payload, options, callIdx + 1, nextCollectedResult);
|
|
95
|
+
}
|
|
96
|
+
return nextCollectedResult;
|
|
86
97
|
}
|
|
87
98
|
}
|
|
88
99
|
async upsert(payload) {
|
|
@@ -396,7 +396,7 @@ class EnvEngine extends runtime_1.default {
|
|
|
396
396
|
await (0, jose_1.jwtVerify)(accessToken, await (0, jose_1.importJWK)(publicKey, keyMeta.alg), {
|
|
397
397
|
issuer: ['https://accounts.google.com', 'accounts.google.com'],
|
|
398
398
|
clockTolerance: 0,
|
|
399
|
-
audience: [expectedAudience, expectedAudience + '-' + this.workflowId, expectedAudience + '-' + this.workflowId + '-' + this.triggerId],
|
|
399
|
+
audience: [expectedAudience, expectedAudience + '-' + this.workflowId, expectedAudience + '-' + this.workflowId + '-' + this.triggerId, expectedAudience + '/' + this.workflowId + '/' + this.triggerId, expectedAudience + '/' + this.workflowId, expectedAudience + '/' + this.triggerId, expectedAudience + '-' + this.triggerId],
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
catch (err) {
|
|
@@ -46,7 +46,7 @@ declare class AirtableHelper<T extends Record<string, string>, K extends keyof T
|
|
|
46
46
|
fields: {
|
|
47
47
|
[key in T[keyof T]]: any;
|
|
48
48
|
};
|
|
49
|
-
}>;
|
|
49
|
+
} | Error>;
|
|
50
50
|
}): Promise<{
|
|
51
51
|
updatedRecords: Array<string>;
|
|
52
52
|
createdRecords: Array<string>;
|
|
@@ -55,7 +55,7 @@ declare class AirtableHelper<T extends Record<string, string>, K extends keyof T
|
|
|
55
55
|
fields: {
|
|
56
56
|
[key in T[keyof T]]: any;
|
|
57
57
|
};
|
|
58
|
-
}>;
|
|
58
|
+
} | Error>;
|
|
59
59
|
}>;
|
|
60
60
|
upsert(payload: Partial<{
|
|
61
61
|
[key in keyof T]: any;
|