@onyx.dev/onyx-database 2.0.0 → 2.0.1

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/index.cjs CHANGED
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ // package.json
4
+ var name = "@onyx.dev/onyx-database";
5
+ var version = "2.0.1";
6
+
3
7
  // src/config/defaults.ts
4
8
  var DEFAULT_BASE_URL = "https://api.onyx.dev";
5
9
  var DEFAULT_AI_BASE_URL = "https://ai.onyx.dev";
@@ -951,8 +955,8 @@ var CascadeRelationshipBuilder = class {
951
955
  * builder.graph('programs');
952
956
  * ```
953
957
  */
954
- graph(name) {
955
- this.graphName = name;
958
+ graph(name2) {
959
+ this.graphName = name2;
956
960
  return this;
957
961
  }
958
962
  /**
@@ -1039,24 +1043,24 @@ function diffAttributes(apiAttrs, localAttrs) {
1039
1043
  const added = [];
1040
1044
  const removed = [];
1041
1045
  const changed = [];
1042
- for (const [name, local] of localMap.entries()) {
1043
- if (!apiMap.has(name)) {
1046
+ for (const [name2, local] of localMap.entries()) {
1047
+ if (!apiMap.has(name2)) {
1044
1048
  added.push(local);
1045
1049
  continue;
1046
1050
  }
1047
- const api = apiMap.get(name);
1051
+ const api = apiMap.get(name2);
1048
1052
  const apiNull = Boolean(api.isNullable);
1049
1053
  const localNull = Boolean(local.isNullable);
1050
1054
  if (api.type !== local.type || apiNull !== localNull) {
1051
1055
  changed.push({
1052
- name,
1056
+ name: name2,
1053
1057
  from: { type: api.type, isNullable: apiNull },
1054
1058
  to: { type: local.type, isNullable: localNull }
1055
1059
  });
1056
1060
  }
1057
1061
  }
1058
- for (const name of apiMap.keys()) {
1059
- if (!localMap.has(name)) removed.push(name);
1062
+ for (const name2 of apiMap.keys()) {
1063
+ if (!localMap.has(name2)) removed.push(name2);
1060
1064
  }
1061
1065
  added.sort((a, b) => a.name.localeCompare(b.name));
1062
1066
  removed.sort();
@@ -1070,22 +1074,22 @@ function diffIndexes(apiIndexes, localIndexes) {
1070
1074
  const added = [];
1071
1075
  const removed = [];
1072
1076
  const changed = [];
1073
- for (const [name, local] of localMap.entries()) {
1074
- if (!apiMap.has(name)) {
1077
+ for (const [name2, local] of localMap.entries()) {
1078
+ if (!apiMap.has(name2)) {
1075
1079
  added.push(local);
1076
1080
  continue;
1077
1081
  }
1078
- const api = apiMap.get(name);
1082
+ const api = apiMap.get(name2);
1079
1083
  const apiType = api.type ?? "DEFAULT";
1080
1084
  const localType = local.type ?? "DEFAULT";
1081
1085
  const apiScore = api.minimumScore;
1082
1086
  const localScore = local.minimumScore;
1083
1087
  if (apiType !== localType || apiScore !== localScore) {
1084
- changed.push({ name, from: api, to: local });
1088
+ changed.push({ name: name2, from: api, to: local });
1085
1089
  }
1086
1090
  }
1087
- for (const name of apiMap.keys()) {
1088
- if (!localMap.has(name)) removed.push(name);
1091
+ for (const name2 of apiMap.keys()) {
1092
+ if (!localMap.has(name2)) removed.push(name2);
1089
1093
  }
1090
1094
  added.sort((a, b) => a.name.localeCompare(b.name));
1091
1095
  removed.sort();
@@ -1099,18 +1103,18 @@ function diffResolvers(apiResolvers, localResolvers) {
1099
1103
  const added = [];
1100
1104
  const removed = [];
1101
1105
  const changed = [];
1102
- for (const [name, local] of localMap.entries()) {
1103
- if (!apiMap.has(name)) {
1106
+ for (const [name2, local] of localMap.entries()) {
1107
+ if (!apiMap.has(name2)) {
1104
1108
  added.push(local);
1105
1109
  continue;
1106
1110
  }
1107
- const api = apiMap.get(name);
1111
+ const api = apiMap.get(name2);
1108
1112
  if (api.resolver !== local.resolver) {
1109
- changed.push({ name, from: api, to: local });
1113
+ changed.push({ name: name2, from: api, to: local });
1110
1114
  }
1111
1115
  }
1112
- for (const name of apiMap.keys()) {
1113
- if (!localMap.has(name)) removed.push(name);
1116
+ for (const name2 of apiMap.keys()) {
1117
+ if (!localMap.has(name2)) removed.push(name2);
1114
1118
  }
1115
1119
  added.sort((a, b) => a.name.localeCompare(b.name));
1116
1120
  removed.sort();
@@ -1124,18 +1128,18 @@ function diffTriggers(apiTriggers, localTriggers) {
1124
1128
  const added = [];
1125
1129
  const removed = [];
1126
1130
  const changed = [];
1127
- for (const [name, local] of localMap.entries()) {
1128
- if (!apiMap.has(name)) {
1131
+ for (const [name2, local] of localMap.entries()) {
1132
+ if (!apiMap.has(name2)) {
1129
1133
  added.push(local);
1130
1134
  continue;
1131
1135
  }
1132
- const api = apiMap.get(name);
1136
+ const api = apiMap.get(name2);
1133
1137
  if (api.event !== local.event || api.trigger !== local.trigger) {
1134
- changed.push({ name, from: api, to: local });
1138
+ changed.push({ name: name2, from: api, to: local });
1135
1139
  }
1136
1140
  }
1137
- for (const name of apiMap.keys()) {
1138
- if (!localMap.has(name)) removed.push(name);
1141
+ for (const name2 of apiMap.keys()) {
1142
+ if (!localMap.has(name2)) removed.push(name2);
1139
1143
  }
1140
1144
  added.sort((a, b) => a.name.localeCompare(b.name));
1141
1145
  removed.sort();
@@ -1151,13 +1155,13 @@ function computeSchemaDiff(apiSchema, localSchema) {
1151
1155
  const newTables = [];
1152
1156
  const removedTables = [];
1153
1157
  const changedTables = [];
1154
- for (const [name, localEntity] of localMap.entries()) {
1155
- if (!apiMap.has(name)) {
1156
- newTables.push(name);
1158
+ for (const [name2, localEntity] of localMap.entries()) {
1159
+ if (!apiMap.has(name2)) {
1160
+ newTables.push(name2);
1157
1161
  continue;
1158
1162
  }
1159
- const apiEntity = apiMap.get(name);
1160
- const tableDiff = { name };
1163
+ const apiEntity = apiMap.get(name2);
1164
+ const tableDiff = { name: name2 };
1161
1165
  const partitionFrom = normalizePartition(apiEntity.partition);
1162
1166
  const partitionTo = normalizePartition(localEntity.partition);
1163
1167
  if (partitionFrom !== partitionTo) {
@@ -1182,8 +1186,8 @@ function computeSchemaDiff(apiSchema, localSchema) {
1182
1186
  changedTables.push(tableDiff);
1183
1187
  }
1184
1188
  }
1185
- for (const name of apiMap.keys()) {
1186
- if (!localMap.has(name)) removedTables.push(name);
1189
+ for (const name2 of apiMap.keys()) {
1190
+ if (!localMap.has(name2)) removedTables.push(name2);
1187
1191
  }
1188
1192
  newTables.sort();
1189
1193
  removedTables.sort();
@@ -2327,12 +2331,9 @@ var upper = (attribute) => `upper(${attribute})`;
2327
2331
  var lower = (attribute) => `lower(${attribute})`;
2328
2332
  var substring = (attribute, from, length) => `substring(${attribute},${from},${length})`;
2329
2333
  var replace = (attribute, pattern, repl) => `replace(${attribute}, '${pattern.replace(/'/g, "\\'")}', '${repl.replace(/'/g, "\\'")}')`;
2334
+ var format = (attribute, formatter) => `format(${attribute}, '${formatter.replace(/'/g, "\\'")}')`;
2330
2335
  var percentile = (attribute, p) => `percentile(${attribute}, ${p})`;
2331
2336
 
2332
- // src/index.ts
2333
- var sdkName = "@onyx.dev/onyx-database";
2334
- var sdkVersion = "0.1.0";
2335
-
2336
2337
  exports.QueryResults = QueryResults;
2337
2338
  exports.asc = asc;
2338
2339
  exports.avg = avg;
@@ -2342,6 +2343,7 @@ exports.containsIgnoreCase = containsIgnoreCase;
2342
2343
  exports.count = count;
2343
2344
  exports.desc = desc;
2344
2345
  exports.eq = eq;
2346
+ exports.format = format;
2345
2347
  exports.gt = gt;
2346
2348
  exports.gte = gte;
2347
2349
  exports.inOp = inOp;
@@ -2366,8 +2368,8 @@ exports.notWithin = notWithin;
2366
2368
  exports.onyx = onyx;
2367
2369
  exports.percentile = percentile;
2368
2370
  exports.replace = replace;
2369
- exports.sdkName = sdkName;
2370
- exports.sdkVersion = sdkVersion;
2371
+ exports.sdkName = name;
2372
+ exports.sdkVersion = version;
2371
2373
  exports.search = search;
2372
2374
  exports.startsWith = startsWith;
2373
2375
  exports.std = std;