@onchaindb/sdk 0.4.5 → 2.0.0

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.
Files changed (117) hide show
  1. package/.claude/settings.local.json +10 -2
  2. package/README.md +422 -355
  3. package/dist/batch.d.ts +1 -10
  4. package/dist/batch.d.ts.map +1 -1
  5. package/dist/batch.js +4 -26
  6. package/dist/batch.js.map +1 -1
  7. package/dist/client.d.ts +31 -46
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +222 -357
  10. package/dist/client.js.map +1 -1
  11. package/dist/database.d.ts +14 -131
  12. package/dist/database.d.ts.map +1 -1
  13. package/dist/database.js +35 -131
  14. package/dist/database.js.map +1 -1
  15. package/dist/index.d.ts +10 -13
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +4 -18
  18. package/dist/index.js.map +1 -1
  19. package/dist/query-sdk/ConditionBuilder.d.ts +3 -11
  20. package/dist/query-sdk/ConditionBuilder.d.ts.map +1 -1
  21. package/dist/query-sdk/ConditionBuilder.js +10 -48
  22. package/dist/query-sdk/ConditionBuilder.js.map +1 -1
  23. package/dist/query-sdk/NestedBuilders.d.ts +33 -30
  24. package/dist/query-sdk/NestedBuilders.d.ts.map +1 -1
  25. package/dist/query-sdk/NestedBuilders.js +46 -43
  26. package/dist/query-sdk/NestedBuilders.js.map +1 -1
  27. package/{src/query-sdk/dist/OnChainDB.d.ts → dist/query-sdk/OnDB.d.ts} +10 -2
  28. package/dist/query-sdk/OnDB.d.ts.map +1 -0
  29. package/{src/query-sdk/dist/OnChainDB.js → dist/query-sdk/OnDB.js} +86 -18
  30. package/dist/query-sdk/OnDB.js.map +1 -0
  31. package/dist/query-sdk/QueryBuilder.d.ts +4 -2
  32. package/dist/query-sdk/QueryBuilder.d.ts.map +1 -1
  33. package/dist/query-sdk/QueryBuilder.js +47 -169
  34. package/dist/query-sdk/QueryBuilder.js.map +1 -1
  35. package/dist/query-sdk/QueryResult.d.ts +0 -38
  36. package/dist/query-sdk/QueryResult.d.ts.map +1 -1
  37. package/dist/query-sdk/QueryResult.js +1 -227
  38. package/dist/query-sdk/QueryResult.js.map +1 -1
  39. package/dist/query-sdk/index.d.ts +2 -2
  40. package/dist/query-sdk/index.d.ts.map +1 -1
  41. package/dist/query-sdk/index.js +3 -3
  42. package/dist/query-sdk/index.js.map +1 -1
  43. package/dist/query-sdk/operators.d.ts +32 -28
  44. package/dist/query-sdk/operators.d.ts.map +1 -1
  45. package/dist/query-sdk/operators.js +45 -155
  46. package/dist/query-sdk/operators.js.map +1 -1
  47. package/dist/types.d.ts +159 -36
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/types.js +8 -8
  50. package/dist/types.js.map +1 -1
  51. package/dist/x402/types.d.ts +1 -1
  52. package/dist/x402/types.d.ts.map +1 -1
  53. package/dist/x402/utils.js +2 -2
  54. package/dist/x402/utils.js.map +1 -1
  55. package/jest.config.js +4 -0
  56. package/package.json +1 -1
  57. package/skills.md +0 -1
  58. package/src/batch.d.ts +3 -3
  59. package/src/batch.js +1 -1
  60. package/src/client.ts +287 -823
  61. package/src/database.d.ts +1 -1
  62. package/src/database.js +4 -4
  63. package/src/database.ts +71 -494
  64. package/src/index.d.ts +18 -18
  65. package/src/index.js +16 -16
  66. package/src/index.ts +44 -198
  67. package/src/query-sdk/ConditionBuilder.ts +37 -89
  68. package/src/query-sdk/NestedBuilders.ts +90 -92
  69. package/src/query-sdk/{OnChainDB.ts → OnDB.ts} +1 -1
  70. package/src/query-sdk/QueryBuilder.ts +59 -218
  71. package/src/query-sdk/QueryResult.ts +4 -330
  72. package/src/query-sdk/README.md +218 -587
  73. package/src/query-sdk/index.ts +2 -2
  74. package/src/query-sdk/operators.ts +91 -200
  75. package/src/query-sdk/tests/FieldConditionBuilder.test.ts +70 -71
  76. package/src/query-sdk/tests/LogicalOperator.test.ts +43 -82
  77. package/src/query-sdk/tests/NestedBuilders.test.ts +229 -309
  78. package/src/query-sdk/tests/QueryBuilder.test.ts +5 -5
  79. package/src/query-sdk/tests/QueryResult.test.ts +41 -435
  80. package/src/query-sdk/tests/comprehensive.test.ts +4 -185
  81. package/src/tests/client-requests.test.ts +280 -0
  82. package/src/tests/client-validation.test.ts +80 -0
  83. package/src/types.d.ts +6 -6
  84. package/src/types.js +8 -8
  85. package/src/types.ts +239 -54
  86. package/src/x402/types.ts +3 -3
  87. package/src/x402/utils.ts +3 -3
  88. package/examples/blob-upload-example.ts +0 -140
  89. package/src/batch.ts +0 -257
  90. package/src/query-sdk/dist/ConditionBuilder.d.ts +0 -22
  91. package/src/query-sdk/dist/ConditionBuilder.js +0 -90
  92. package/src/query-sdk/dist/FieldConditionBuilder.d.ts +0 -1
  93. package/src/query-sdk/dist/FieldConditionBuilder.js +0 -6
  94. package/src/query-sdk/dist/NestedBuilders.d.ts +0 -43
  95. package/src/query-sdk/dist/NestedBuilders.js +0 -144
  96. package/src/query-sdk/dist/QueryBuilder.d.ts +0 -70
  97. package/src/query-sdk/dist/QueryBuilder.js +0 -295
  98. package/src/query-sdk/dist/QueryResult.d.ts +0 -52
  99. package/src/query-sdk/dist/QueryResult.js +0 -293
  100. package/src/query-sdk/dist/SelectionBuilder.d.ts +0 -20
  101. package/src/query-sdk/dist/SelectionBuilder.js +0 -80
  102. package/src/query-sdk/dist/adapters/HttpClientAdapter.d.ts +0 -27
  103. package/src/query-sdk/dist/adapters/HttpClientAdapter.js +0 -170
  104. package/src/query-sdk/dist/index.d.ts +0 -36
  105. package/src/query-sdk/dist/index.js +0 -27
  106. package/src/query-sdk/dist/operators.d.ts +0 -56
  107. package/src/query-sdk/dist/operators.js +0 -289
  108. package/src/query-sdk/dist/tests/setup.d.ts +0 -15
  109. package/src/query-sdk/dist/tests/setup.js +0 -46
  110. package/src/query-sdk/jest.config.js +0 -25
  111. package/src/query-sdk/package.json +0 -46
  112. package/src/query-sdk/tests/aggregations.test.ts +0 -653
  113. package/src/query-sdk/tests/integration.test.ts +0 -608
  114. package/src/query-sdk/tests/operators.test.ts +0 -327
  115. package/src/query-sdk/tests/unit.test.ts +0 -794
  116. package/src/query-sdk/tsconfig.json +0 -26
  117. package/src/query-sdk/yarn.lock +0 -3092
@@ -1,85 +1,46 @@
1
1
  import { FieldConditionBuilder, LogicalOperator } from '../index';
2
2
 
3
3
  describe('LogicalOperator', () => {
4
- test('should combine conditions with AND operator', () => {
5
- const condition1 = new FieldConditionBuilder('user.name').equals('John');
6
- const condition2 = new FieldConditionBuilder('user.age').greaterThan(25);
7
-
8
- const andOp = LogicalOperator.And([
9
- LogicalOperator.Condition(condition1),
10
- LogicalOperator.Condition(condition2)
11
- ]);
12
-
13
- const composable = andOp.toComposable();
14
-
15
- const expected = {
16
- and: [
17
- {
18
- user: {
19
- name: {
20
- is: 'John'
21
- }
22
- }
23
- },
24
- {
25
- user: {
26
- age: {
27
- greaterThan: 25
28
- }
29
- }
30
- }
31
- ]
32
- };
33
-
34
- expect(composable).toEqual(expected);
35
- });
36
-
37
- test('should combine conditions with OR operator', () => {
38
- const condition1 = new FieldConditionBuilder('status').equals('active');
39
- const condition2 = new FieldConditionBuilder('status').equals('pending');
40
-
41
- const orOp = LogicalOperator.Or([
42
- LogicalOperator.Condition(condition1),
43
- LogicalOperator.Condition(condition2)
44
- ]);
45
-
46
- const composable = orOp.toComposable();
47
-
48
- const expected = {
49
- or: [
50
- {
51
- status: {
52
- is: 'active'
53
- }
54
- },
55
- {
56
- status: {
57
- is: 'pending'
58
- }
59
- }
60
- ]
61
- };
62
-
63
- expect(composable).toEqual(expected);
64
- });
65
-
66
- test('should handle nested logical operations', () => {
67
- const condition1 = new FieldConditionBuilder('name').equals('John');
68
- const condition2 = new FieldConditionBuilder('age').greaterThan(25);
69
- const condition3 = new FieldConditionBuilder('status').equals('active');
70
-
71
- const nestedOp = LogicalOperator.Or([
72
- LogicalOperator.And([
73
- LogicalOperator.Condition(condition1),
74
- LogicalOperator.Condition(condition2)
75
- ]),
76
- LogicalOperator.Condition(condition3)
77
- ]);
78
-
79
- const composable = nestedOp.toComposable();
80
-
81
- expect(composable).toHaveProperty('or');
82
- expect(composable.or).toHaveLength(2);
83
- expect(composable.or[0]).toHaveProperty('and');
84
- });
85
- });
4
+ test('should combine conditions with AND operator', () => {
5
+ const andOp = LogicalOperator.And([
6
+ new FieldConditionBuilder('user.name').equals('John'),
7
+ new FieldConditionBuilder('user.age').greaterThan(25)
8
+ ]);
9
+
10
+ expect(andOp.toComposable()).toEqual({
11
+ and: [
12
+ { user: { name: { is: 'John' } } },
13
+ { user: { age: { greaterThan: 25 } } }
14
+ ]
15
+ });
16
+ });
17
+
18
+ test('should combine conditions with OR operator', () => {
19
+ const orOp = LogicalOperator.Or([
20
+ new FieldConditionBuilder('status').equals('active'),
21
+ new FieldConditionBuilder('status').equals('pending')
22
+ ]);
23
+
24
+ expect(orOp.toComposable()).toEqual({
25
+ or: [
26
+ { status: { is: 'active' } },
27
+ { status: { is: 'pending' } }
28
+ ]
29
+ });
30
+ });
31
+
32
+ test('should handle nested logical operations', () => {
33
+ const nestedOp = LogicalOperator.Or([
34
+ LogicalOperator.And([
35
+ new FieldConditionBuilder('name').equals('John'),
36
+ new FieldConditionBuilder('age').greaterThan(25)
37
+ ]),
38
+ new FieldConditionBuilder('status').equals('active')
39
+ ]);
40
+
41
+ const composable = nestedOp.toComposable();
42
+ expect(composable).toHaveProperty('or');
43
+ expect(composable.or).toHaveLength(2);
44
+ expect(composable.or[0]).toHaveProperty('and');
45
+ });
46
+ });