@onchaindb/sdk 0.4.5 → 1.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 (97) 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 +29 -43
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +198 -323
  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 +6 -9
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -15
  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/dist/query-sdk/QueryBuilder.d.ts +4 -2
  28. package/dist/query-sdk/QueryBuilder.d.ts.map +1 -1
  29. package/dist/query-sdk/QueryBuilder.js +47 -169
  30. package/dist/query-sdk/QueryBuilder.js.map +1 -1
  31. package/dist/query-sdk/QueryResult.d.ts +0 -38
  32. package/dist/query-sdk/QueryResult.d.ts.map +1 -1
  33. package/dist/query-sdk/QueryResult.js +1 -227
  34. package/dist/query-sdk/QueryResult.js.map +1 -1
  35. package/dist/query-sdk/index.d.ts +1 -1
  36. package/dist/query-sdk/index.d.ts.map +1 -1
  37. package/dist/query-sdk/index.js.map +1 -1
  38. package/dist/query-sdk/operators.d.ts +32 -28
  39. package/dist/query-sdk/operators.d.ts.map +1 -1
  40. package/dist/query-sdk/operators.js +45 -155
  41. package/dist/query-sdk/operators.js.map +1 -1
  42. package/dist/types.d.ts +153 -1
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/types.js.map +1 -1
  45. package/jest.config.js +4 -0
  46. package/package.json +1 -1
  47. package/skills.md +0 -1
  48. package/src/client.ts +242 -745
  49. package/src/database.ts +70 -493
  50. package/src/index.ts +40 -193
  51. package/src/query-sdk/ConditionBuilder.ts +37 -89
  52. package/src/query-sdk/NestedBuilders.ts +90 -92
  53. package/src/query-sdk/QueryBuilder.ts +59 -218
  54. package/src/query-sdk/QueryResult.ts +4 -330
  55. package/src/query-sdk/README.md +214 -583
  56. package/src/query-sdk/index.ts +1 -1
  57. package/src/query-sdk/operators.ts +91 -200
  58. package/src/query-sdk/tests/FieldConditionBuilder.test.ts +70 -71
  59. package/src/query-sdk/tests/LogicalOperator.test.ts +43 -82
  60. package/src/query-sdk/tests/NestedBuilders.test.ts +229 -309
  61. package/src/query-sdk/tests/QueryBuilder.test.ts +5 -5
  62. package/src/query-sdk/tests/QueryResult.test.ts +41 -435
  63. package/src/query-sdk/tests/comprehensive.test.ts +4 -185
  64. package/src/tests/client-requests.test.ts +280 -0
  65. package/src/tests/client-validation.test.ts +80 -0
  66. package/src/types.ts +229 -8
  67. package/src/batch.ts +0 -257
  68. package/src/query-sdk/dist/ConditionBuilder.d.ts +0 -22
  69. package/src/query-sdk/dist/ConditionBuilder.js +0 -90
  70. package/src/query-sdk/dist/FieldConditionBuilder.d.ts +0 -1
  71. package/src/query-sdk/dist/FieldConditionBuilder.js +0 -6
  72. package/src/query-sdk/dist/NestedBuilders.d.ts +0 -43
  73. package/src/query-sdk/dist/NestedBuilders.js +0 -144
  74. package/src/query-sdk/dist/OnChainDB.d.ts +0 -19
  75. package/src/query-sdk/dist/OnChainDB.js +0 -123
  76. package/src/query-sdk/dist/QueryBuilder.d.ts +0 -70
  77. package/src/query-sdk/dist/QueryBuilder.js +0 -295
  78. package/src/query-sdk/dist/QueryResult.d.ts +0 -52
  79. package/src/query-sdk/dist/QueryResult.js +0 -293
  80. package/src/query-sdk/dist/SelectionBuilder.d.ts +0 -20
  81. package/src/query-sdk/dist/SelectionBuilder.js +0 -80
  82. package/src/query-sdk/dist/adapters/HttpClientAdapter.d.ts +0 -27
  83. package/src/query-sdk/dist/adapters/HttpClientAdapter.js +0 -170
  84. package/src/query-sdk/dist/index.d.ts +0 -36
  85. package/src/query-sdk/dist/index.js +0 -27
  86. package/src/query-sdk/dist/operators.d.ts +0 -56
  87. package/src/query-sdk/dist/operators.js +0 -289
  88. package/src/query-sdk/dist/tests/setup.d.ts +0 -15
  89. package/src/query-sdk/dist/tests/setup.js +0 -46
  90. package/src/query-sdk/jest.config.js +0 -25
  91. package/src/query-sdk/package.json +0 -46
  92. package/src/query-sdk/tests/aggregations.test.ts +0 -653
  93. package/src/query-sdk/tests/integration.test.ts +0 -608
  94. package/src/query-sdk/tests/operators.test.ts +0 -327
  95. package/src/query-sdk/tests/unit.test.ts +0 -794
  96. package/src/query-sdk/tsconfig.json +0 -26
  97. 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
+ });