@0xobelisk/graphql-client 1.2.0-pre.62 → 1.2.0-pre.64

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/client.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare class DubheGraphqlClient {
5
5
  private subscriptionClient?;
6
6
  private dubheMetadata?;
7
7
  private parsedTables;
8
+ private uniqueTableNames;
8
9
  constructor(config: DubheClientConfig);
9
10
  /**
10
11
  * Execute GraphQL query
@@ -18,14 +19,14 @@ export declare class DubheGraphqlClient {
18
19
  * Query all table data - Adapted to API without store prefix
19
20
  *
20
21
  * OrderBy field name support:
21
- * - camelCase: { field: 'updatedAt', direction: 'DESC' } → UPDATED_AT_DESC
22
+ * - camelCase: { field: 'updatedAtTimestampMs', direction: 'DESC' } → UPDATED_AT_TIMESTAMP_MS_DESC
22
23
  * - snake_case: { field: 'updated_at', direction: 'DESC' } → UPDATED_AT_DESC
23
24
  *
24
25
  * Usage examples:
25
26
  * ```ts
26
27
  * // Using camelCase field names
27
28
  * const result = await client.getAllTables('account', {
28
- * orderBy: [{ field: 'updatedAt', direction: 'DESC' }]
29
+ * orderBy: [{ field: 'updatedAtTimestampMs', direction: 'DESC' }]
29
30
  * });
30
31
  *
31
32
  * // Using snake_case field names
@@ -36,7 +37,7 @@ export declare class DubheGraphqlClient {
36
37
  * // Mixed usage
37
38
  * const result = await client.getAllTables('account', {
38
39
  * orderBy: [
39
- * { field: 'updatedAt', direction: 'DESC' },
40
+ * { field: 'updatedAtTimestampMs', direction: 'DESC' },
40
41
  * { field: 'created_at', direction: 'ASC' }
41
42
  * ]
42
43
  * });
@@ -195,6 +196,7 @@ export declare class DubheGraphqlClient {
195
196
  getTableEnumFields(tableName: string): Record<string, string[]>;
196
197
  /**
197
198
  * Get all parsed table information
199
+ * Returns only unique tables from the original dubhe config (no duplicate names)
198
200
  */
199
201
  getAllTableInfo(): Map<string, ParsedTableInfo>;
200
202
  /**
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ var import_retry = require("@apollo/client/link/retry");
47
47
  var import_subscriptions = require("@apollo/client/link/subscriptions");
48
48
  var import_utilities = require("@apollo/client/utilities");
49
49
 
50
- // ../../node_modules/.pnpm/graphql-ws@6.0.5_graphql@15.10.1_ws@8.18.3/node_modules/graphql-ws/dist/common-CGW11Fyb.js
50
+ // ../../node_modules/.pnpm/graphql-ws@6.0.6_graphql@15.10.1_ws@8.18.3/node_modules/graphql-ws/dist/common-CGW11Fyb.js
51
51
  function extendedTypeof(val) {
52
52
  if (val === null) {
53
53
  return "null";
@@ -246,7 +246,7 @@ function stringifyMessage(msg, replacer) {
246
246
  return JSON.stringify(msg, replacer);
247
247
  }
248
248
 
249
- // ../../node_modules/.pnpm/graphql-ws@6.0.5_graphql@15.10.1_ws@8.18.3/node_modules/graphql-ws/dist/client.js
249
+ // ../../node_modules/.pnpm/graphql-ws@6.0.6_graphql@15.10.1_ws@8.18.3/node_modules/graphql-ws/dist/client.js
250
250
  function createClient(options) {
251
251
  const {
252
252
  url,
@@ -752,7 +752,7 @@ function isWebSocket(val) {
752
752
  return typeof val === "function" && "constructor" in val && "CLOSED" in val && "CLOSING" in val && "CONNECTING" in val && "OPEN" in val;
753
753
  }
754
754
 
755
- // ../../node_modules/.pnpm/graphql-ws@6.0.5_graphql@15.10.1_ws@8.18.3/node_modules/graphql-ws/dist/index.js
755
+ // ../../node_modules/.pnpm/graphql-ws@6.0.6_graphql@15.10.1_ws@8.18.3/node_modules/graphql-ws/dist/index.js
756
756
  var import_graphql = require("graphql");
757
757
 
758
758
  // src/client.ts
@@ -774,8 +774,10 @@ function mapCachePolicyToFetchPolicy(cachePolicy) {
774
774
  }
775
775
  }
776
776
  var DubheGraphqlClient = class {
777
+ // Track unique table names from config
777
778
  constructor(config) {
778
779
  this.parsedTables = /* @__PURE__ */ new Map();
780
+ this.uniqueTableNames = /* @__PURE__ */ new Set();
779
781
  this.dubheMetadata = config.dubheMetadata;
780
782
  if (this.dubheMetadata) {
781
783
  this.parseTableInfoFromConfig();
@@ -933,14 +935,14 @@ var DubheGraphqlClient = class {
933
935
  * Query all table data - Adapted to API without store prefix
934
936
  *
935
937
  * OrderBy field name support:
936
- * - camelCase: { field: 'updatedAt', direction: 'DESC' } → UPDATED_AT_DESC
938
+ * - camelCase: { field: 'updatedAtTimestampMs', direction: 'DESC' } → UPDATED_AT_TIMESTAMP_MS_DESC
937
939
  * - snake_case: { field: 'updated_at', direction: 'DESC' } → UPDATED_AT_DESC
938
940
  *
939
941
  * Usage examples:
940
942
  * ```ts
941
943
  * // Using camelCase field names
942
944
  * const result = await client.getAllTables('account', {
943
- * orderBy: [{ field: 'updatedAt', direction: 'DESC' }]
945
+ * orderBy: [{ field: 'updatedAtTimestampMs', direction: 'DESC' }]
944
946
  * });
945
947
  *
946
948
  * // Using snake_case field names
@@ -951,7 +953,7 @@ var DubheGraphqlClient = class {
951
953
  * // Mixed usage
952
954
  * const result = await client.getAllTables('account', {
953
955
  * orderBy: [
954
- * { field: 'updatedAt', direction: 'DESC' },
956
+ * { field: 'updatedAtTimestampMs', direction: 'DESC' },
955
957
  * { field: 'created_at', direction: 'ASC' }
956
958
  * ]
957
959
  * });
@@ -1415,7 +1417,7 @@ var DubheGraphqlClient = class {
1415
1417
  );
1416
1418
  });
1417
1419
  }
1418
- fields.push("createdAt", "updatedAt");
1420
+ fields.push("createdAtTimestampMs", "updatedAtTimestampMs", "isDeleted");
1419
1421
  const primaryKeys = tableData.keys.map(
1420
1422
  (key) => this.toCamelCase(key)
1421
1423
  );
@@ -1426,6 +1428,7 @@ var DubheGraphqlClient = class {
1426
1428
  primaryKeys,
1427
1429
  enumFields
1428
1430
  };
1431
+ this.uniqueTableNames.add(tableName);
1429
1432
  this.parsedTables.set(tableName, tableInfo);
1430
1433
  this.parsedTables.set(normalizedTableName, tableInfo);
1431
1434
  if (tableName !== normalizedTableName) {
@@ -1472,9 +1475,17 @@ var DubheGraphqlClient = class {
1472
1475
  }
1473
1476
  /**
1474
1477
  * Get all parsed table information
1478
+ * Returns only unique tables from the original dubhe config (no duplicate names)
1475
1479
  */
1476
1480
  getAllTableInfo() {
1477
- return new Map(this.parsedTables);
1481
+ const uniqueTables = /* @__PURE__ */ new Map();
1482
+ this.uniqueTableNames.forEach((tableName) => {
1483
+ const tableInfo = this.parsedTables.get(tableName);
1484
+ if (tableInfo) {
1485
+ uniqueTables.set(tableName, tableInfo);
1486
+ }
1487
+ });
1488
+ return uniqueTables;
1478
1489
  }
1479
1490
  /**
1480
1491
  * Get table's minimal field set (for fallback)
@@ -1484,7 +1495,7 @@ var DubheGraphqlClient = class {
1484
1495
  if (tableInfo) {
1485
1496
  return tableInfo.fields;
1486
1497
  }
1487
- return ["createdAt", "updatedAt"];
1498
+ return ["createdAtTimestampMs", "updatedAtTimestampMs", "isDeleted"];
1488
1499
  }
1489
1500
  /**
1490
1501
  * Convert table fields to GraphQL query string
@@ -1498,7 +1509,7 @@ var DubheGraphqlClient = class {
1498
1509
  if (autoFields.length > 0) {
1499
1510
  fields = autoFields;
1500
1511
  } else {
1501
- fields = ["createdAt", "updatedAt"];
1512
+ fields = ["createdAtTimestampMs", "updatedAtTimestampMs", "isDeleted"];
1502
1513
  }
1503
1514
  }
1504
1515
  return fields.join("\n ");
@@ -1509,7 +1520,11 @@ function createDubheGraphqlClient(config) {
1509
1520
  }
1510
1521
  var QueryBuilders = {
1511
1522
  // Build basic query - Adapted to API without store prefix
1512
- basic: (tableName, fields = ["createdAt", "updatedAt"]) => import_client2.gql`
1523
+ basic: (tableName, fields = [
1524
+ "createdAtTimestampMs",
1525
+ "updatedAtTimestampMs",
1526
+ "isDeleted"
1527
+ ]) => import_client2.gql`
1513
1528
  query Basic${tableName.charAt(0).toUpperCase() + tableName.slice(1)}Query(
1514
1529
  $first: Int
1515
1530
  $after: String
@@ -1534,15 +1549,16 @@ var QueryBuilders = {
1534
1549
  subscription: (tableName) => import_client2.gql`
1535
1550
  subscription ${tableName.charAt(0).toUpperCase() + tableName.slice(1)}Subscription {
1536
1551
  ${tableName.charAt(0).toLowerCase() + tableName.slice(1)}Changed {
1537
- createdAt
1538
- updatedAt
1552
+ createdAtTimestampMs
1553
+ updatedAtTimestampMs
1554
+ isDeleted
1539
1555
  }
1540
1556
  }
1541
1557
  `
1542
1558
  };
1543
1559
  function convertOrderByToEnum(orderBy) {
1544
1560
  if (!orderBy || orderBy.length === 0) {
1545
- return ["UPDATED_AT_DESC"];
1561
+ return ["UPDATED_AT_TIMESTAMP_MS_DESC"];
1546
1562
  }
1547
1563
  return orderBy.map((order) => {
1548
1564
  const field = toSnakeCaseForEnum(order.field);