@workglow/storage 0.0.100 → 0.0.102
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/dist/browser.js +38 -31
- package/dist/browser.js.map +7 -7
- package/dist/bun.js +84 -66
- package/dist/bun.js.map +10 -10
- package/dist/node.js +84 -66
- package/dist/node.js.map +10 -10
- package/dist/tabular/BaseSqlTabularStorage.d.ts.map +1 -1
- package/dist/tabular/BaseTabularStorage.d.ts.map +1 -1
- package/dist/tabular/PostgresTabularStorage.d.ts.map +1 -1
- package/dist/tabular/SqliteTabularStorage.d.ts.map +1 -1
- package/dist/tabular/SupabaseTabularStorage.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -189,11 +189,12 @@ class BaseTabularStorage {
|
|
|
189
189
|
const valueNames = this.valueColumns();
|
|
190
190
|
const value = {};
|
|
191
191
|
const key = {};
|
|
192
|
+
const objRecord = obj;
|
|
192
193
|
for (const k of primaryKeyNames) {
|
|
193
|
-
key[k] =
|
|
194
|
+
key[k] = objRecord[k];
|
|
194
195
|
}
|
|
195
196
|
for (const k of valueNames) {
|
|
196
|
-
value[k] =
|
|
197
|
+
value[k] = objRecord[k];
|
|
197
198
|
}
|
|
198
199
|
return { value, key };
|
|
199
200
|
}
|
|
@@ -2761,17 +2762,16 @@ class BaseSqlTabularStorage extends BaseTabularStorage {
|
|
|
2761
2762
|
return value;
|
|
2762
2763
|
}
|
|
2763
2764
|
if (actualType.contentEncoding === "blob") {
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
return v;
|
|
2765
|
+
if (value instanceof Uint8Array) {
|
|
2766
|
+
return value;
|
|
2767
2767
|
}
|
|
2768
|
-
if (typeof Buffer !== "undefined" &&
|
|
2769
|
-
return new Uint8Array(
|
|
2768
|
+
if (typeof Buffer !== "undefined" && value instanceof Buffer) {
|
|
2769
|
+
return new Uint8Array(value);
|
|
2770
2770
|
}
|
|
2771
|
-
if (Array.isArray(
|
|
2772
|
-
return new Uint8Array(
|
|
2771
|
+
if (Array.isArray(value)) {
|
|
2772
|
+
return new Uint8Array(value);
|
|
2773
2773
|
}
|
|
2774
|
-
return
|
|
2774
|
+
return value;
|
|
2775
2775
|
} else if (value instanceof Date) {
|
|
2776
2776
|
return value.toISOString();
|
|
2777
2777
|
} else {
|
|
@@ -2791,14 +2791,13 @@ class BaseSqlTabularStorage extends BaseTabularStorage {
|
|
|
2791
2791
|
return value;
|
|
2792
2792
|
}
|
|
2793
2793
|
if (actualType.contentEncoding === "blob") {
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
return new Uint8Array(v);
|
|
2794
|
+
if (typeof Buffer !== "undefined" && value instanceof Buffer) {
|
|
2795
|
+
return new Uint8Array(value);
|
|
2797
2796
|
}
|
|
2798
|
-
if (
|
|
2799
|
-
return
|
|
2797
|
+
if (value instanceof Uint8Array) {
|
|
2798
|
+
return value;
|
|
2800
2799
|
}
|
|
2801
|
-
return
|
|
2800
|
+
return value;
|
|
2802
2801
|
} else {
|
|
2803
2802
|
return value;
|
|
2804
2803
|
}
|
|
@@ -3006,11 +3005,10 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3006
3005
|
}
|
|
3007
3006
|
const actualType = this.getNonNullType(typeDef);
|
|
3008
3007
|
if (typeof actualType !== "boolean" && (actualType.type === "number" || actualType.type === "integer")) {
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
const parsed = Number(v);
|
|
3008
|
+
if (typeof value === "number")
|
|
3009
|
+
return value;
|
|
3010
|
+
if (typeof value === "string") {
|
|
3011
|
+
const parsed = Number(value);
|
|
3014
3012
|
if (!isNaN(parsed))
|
|
3015
3013
|
return parsed;
|
|
3016
3014
|
}
|
|
@@ -3032,7 +3030,8 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3032
3030
|
let entityToInsert = { ...entity };
|
|
3033
3031
|
if (this.hasAutoGeneratedKey() && this.autoGeneratedKeyName) {
|
|
3034
3032
|
const keyName = String(this.autoGeneratedKeyName);
|
|
3035
|
-
const
|
|
3033
|
+
const entityRecord = entity;
|
|
3034
|
+
const clientProvidedValue = entityRecord[keyName];
|
|
3036
3035
|
const hasClientValue = clientProvidedValue !== undefined && clientProvidedValue !== null;
|
|
3037
3036
|
let shouldOmitKey = false;
|
|
3038
3037
|
if (this.clientProvidedKeys === "never") {
|
|
@@ -3062,8 +3061,9 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3062
3061
|
if (error)
|
|
3063
3062
|
throw error;
|
|
3064
3063
|
const updatedEntity = data;
|
|
3064
|
+
const updatedRecord = updatedEntity;
|
|
3065
3065
|
for (const key in this.schema.properties) {
|
|
3066
|
-
|
|
3066
|
+
updatedRecord[key] = this.sqlToJsValue(key, updatedRecord[key]);
|
|
3067
3067
|
}
|
|
3068
3068
|
this.events.emit("put", updatedEntity);
|
|
3069
3069
|
return updatedEntity;
|
|
@@ -3075,8 +3075,9 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3075
3075
|
}
|
|
3076
3076
|
async get(key) {
|
|
3077
3077
|
let query = this.client.from(this.table).select("*");
|
|
3078
|
+
const keyRecord = key;
|
|
3078
3079
|
for (const pkName of this.primaryKeyNames) {
|
|
3079
|
-
query = query.eq(String(pkName),
|
|
3080
|
+
query = query.eq(String(pkName), keyRecord[String(pkName)]);
|
|
3080
3081
|
}
|
|
3081
3082
|
const { data, error } = await query.single();
|
|
3082
3083
|
if (error) {
|
|
@@ -3088,8 +3089,9 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3088
3089
|
}
|
|
3089
3090
|
const val = data;
|
|
3090
3091
|
if (val) {
|
|
3092
|
+
const valRecord = val;
|
|
3091
3093
|
for (const key2 in this.schema.properties) {
|
|
3092
|
-
|
|
3094
|
+
valRecord[key2] = this.sqlToJsValue(key2, valRecord[key2]);
|
|
3093
3095
|
}
|
|
3094
3096
|
}
|
|
3095
3097
|
this.events.emit("get", key, val);
|
|
@@ -3118,8 +3120,9 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3118
3120
|
throw error;
|
|
3119
3121
|
if (data && data.length > 0) {
|
|
3120
3122
|
for (const row of data) {
|
|
3123
|
+
const record = row;
|
|
3121
3124
|
for (const key in this.schema.properties) {
|
|
3122
|
-
|
|
3125
|
+
record[key] = this.sqlToJsValue(key, record[key]);
|
|
3123
3126
|
}
|
|
3124
3127
|
}
|
|
3125
3128
|
this.events.emit("search", searchCriteria, data);
|
|
@@ -3132,8 +3135,9 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3132
3135
|
async delete(value) {
|
|
3133
3136
|
const { key } = this.separateKeyValueFromCombined(value);
|
|
3134
3137
|
let query = this.client.from(this.table).delete();
|
|
3138
|
+
const deleteKeyRecord = key;
|
|
3135
3139
|
for (const pkName of this.primaryKeyNames) {
|
|
3136
|
-
query = query.eq(String(pkName),
|
|
3140
|
+
query = query.eq(String(pkName), deleteKeyRecord[String(pkName)]);
|
|
3137
3141
|
}
|
|
3138
3142
|
const { error } = await query;
|
|
3139
3143
|
if (error)
|
|
@@ -3146,8 +3150,9 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3146
3150
|
throw error;
|
|
3147
3151
|
if (data && data.length) {
|
|
3148
3152
|
for (const row of data) {
|
|
3153
|
+
const record = row;
|
|
3149
3154
|
for (const key in this.schema.properties) {
|
|
3150
|
-
|
|
3155
|
+
record[key] = this.sqlToJsValue(key, record[key]);
|
|
3151
3156
|
}
|
|
3152
3157
|
}
|
|
3153
3158
|
return data;
|
|
@@ -3179,8 +3184,9 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3179
3184
|
return;
|
|
3180
3185
|
}
|
|
3181
3186
|
for (const row of data) {
|
|
3187
|
+
const record = row;
|
|
3182
3188
|
for (const key in this.schema.properties) {
|
|
3183
|
-
|
|
3189
|
+
record[key] = this.sqlToJsValue(key, record[key]);
|
|
3184
3190
|
}
|
|
3185
3191
|
}
|
|
3186
3192
|
return data;
|
|
@@ -3229,8 +3235,9 @@ class SupabaseTabularStorage extends BaseSqlTabularStorage {
|
|
|
3229
3235
|
}
|
|
3230
3236
|
convertRealtimeRow(row) {
|
|
3231
3237
|
const entity = { ...row };
|
|
3238
|
+
const record = entity;
|
|
3232
3239
|
for (const key in this.schema.properties) {
|
|
3233
|
-
|
|
3240
|
+
record[key] = this.sqlToJsValue(key, row[key]);
|
|
3234
3241
|
}
|
|
3235
3242
|
return entity;
|
|
3236
3243
|
}
|
|
@@ -4788,4 +4795,4 @@ export {
|
|
|
4788
4795
|
BaseTabularStorage
|
|
4789
4796
|
};
|
|
4790
4797
|
|
|
4791
|
-
//# debugId=
|
|
4798
|
+
//# debugId=B7E554C36B7CCFEF64756E2164756E21
|