@xyo-network/diviner-jsonpatch-memory 5.1.22 → 5.1.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/diviner-jsonpatch-memory",
3
- "version": "5.1.22",
3
+ "version": "5.1.24",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,26 +30,29 @@
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "files": [
32
32
  "dist",
33
- "src"
33
+ "src",
34
+ "!**/*.bench.*",
35
+ "!**/*.spec.*",
36
+ "!**/*.test.*"
34
37
  ],
35
38
  "dependencies": {
36
- "@xylabs/assert": "~5.0.24",
37
- "@xylabs/exists": "~5.0.24",
38
- "@xyo-network/diviner-abstract": "~5.1.22",
39
- "@xyo-network/diviner-jsonpatch-model": "~5.1.22",
40
- "@xyo-network/diviner-model": "~5.1.22",
41
- "@xyo-network/module-model": "~5.1.22",
42
- "@xyo-network/payload-model": "~5.1.22",
39
+ "@xylabs/assert": "~5.0.37",
40
+ "@xylabs/exists": "~5.0.37",
41
+ "@xyo-network/diviner-abstract": "~5.1.24",
42
+ "@xyo-network/diviner-jsonpatch-model": "~5.1.24",
43
+ "@xyo-network/diviner-model": "~5.1.24",
44
+ "@xyo-network/module-model": "~5.1.24",
45
+ "@xyo-network/payload-model": "~5.1.24",
43
46
  "fast-json-patch": "~3.1.1"
44
47
  },
45
48
  "devDependencies": {
46
49
  "@xylabs/ts-scripts-yarn3": "~7.2.8",
47
50
  "@xylabs/tsconfig": "~7.2.8",
48
- "@xylabs/vitest-extended": "~5.0.24",
49
- "@xyo-network/wallet": "~5.1.22",
50
- "@xyo-network/wallet-model": "~5.1.22",
51
+ "@xylabs/vitest-extended": "~5.0.37",
52
+ "@xyo-network/wallet": "~5.1.24",
53
+ "@xyo-network/wallet-model": "~5.1.24",
51
54
  "typescript": "~5.9.3",
52
- "vitest": "~4.0.8"
55
+ "vitest": "~4.0.10"
53
56
  },
54
57
  "publishConfig": {
55
58
  "access": "public"
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=Diviner.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Diviner.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Diviner.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,204 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import type { JsonPatchDivinerConfig } from '@xyo-network/diviner-jsonpatch-model'
4
- import { JsonPatchDivinerConfigSchema } from '@xyo-network/diviner-jsonpatch-model'
5
- import type { AnyPayload } from '@xyo-network/payload-model'
6
- import { HDWallet } from '@xyo-network/wallet'
7
- import type { WalletInstance } from '@xyo-network/wallet-model'
8
- import {
9
- beforeAll,
10
- describe, expect, it,
11
- } from 'vitest'
12
-
13
- import { JsonPatchDiviner } from '../Diviner.ts'
14
-
15
- const cases: [string, JsonPatchDivinerConfig, AnyPayload[], AnyPayload[]][] = [
16
- [
17
- 'Adds a value',
18
- {
19
- operations: [{
20
- op: 'add', path: '/value', value: 'foo',
21
- }],
22
- schema: JsonPatchDivinerConfigSchema,
23
- },
24
- [{ schema: 'network.xyo.test' }],
25
- [{ schema: 'network.xyo.test', value: 'foo' }],
26
- ],
27
- [
28
- 'Removes a value',
29
- {
30
- operations: [{ op: 'remove', path: '/value' }],
31
- schema: JsonPatchDivinerConfigSchema,
32
- },
33
- [{ schema: 'network.xyo.test', value: 'foo' }],
34
- [{ schema: 'network.xyo.test' }],
35
- ],
36
- [
37
- 'Replaces a schema',
38
- {
39
- operations: [{
40
- op: 'replace', path: '/schema', value: 'network.xyo.debug',
41
- }],
42
- schema: JsonPatchDivinerConfigSchema,
43
- },
44
- [{ schema: 'network.xyo.test' }],
45
- [{ schema: 'network.xyo.debug' }],
46
- ],
47
- [
48
- 'Replaces a value',
49
- {
50
- operations: [{
51
- op: 'replace', path: '/value', value: 'bar',
52
- }],
53
- schema: JsonPatchDivinerConfigSchema,
54
- },
55
- [{ schema: 'network.xyo.test', value: 'foo' }],
56
- [{ schema: 'network.xyo.test', value: 'bar' }],
57
- ],
58
- [
59
- 'Moves a value',
60
- {
61
- operations: [{
62
- from: '/value', op: 'move', path: '/target',
63
- }],
64
- schema: JsonPatchDivinerConfigSchema,
65
- },
66
- [{ schema: 'network.xyo.test', value: 'foo' }],
67
- [{ schema: 'network.xyo.test', target: 'foo' }],
68
- ],
69
- [
70
- 'Copies a value',
71
- {
72
- operations: [{
73
- from: '/value', op: 'copy', path: '/target',
74
- }],
75
- schema: JsonPatchDivinerConfigSchema,
76
- },
77
- [{ schema: 'network.xyo.test', value: 'foo' }],
78
- [{
79
- schema: 'network.xyo.test', target: 'foo', value: 'foo',
80
- }],
81
- ],
82
- [
83
- 'Filters by schema',
84
- {
85
- operations: [{
86
- op: 'test', path: '/schema', value: 'network.xyo.test',
87
- }],
88
- schema: JsonPatchDivinerConfigSchema,
89
- },
90
- [
91
- { schema: 'network.xyo.test', value: 'foo' },
92
- { schema: 'network.xyo.debug', value: 'bar' },
93
- ],
94
- [{ schema: 'network.xyo.test', value: 'foo' }],
95
- ],
96
- [
97
- 'Filters by value',
98
- {
99
- operations: [{
100
- op: 'test', path: '/value', value: 'foo',
101
- }],
102
- schema: JsonPatchDivinerConfigSchema,
103
- },
104
- [
105
- { schema: 'network.xyo.test', value: 'foo' },
106
- { schema: 'network.xyo.test', value: 'bar' },
107
- ],
108
- [{ schema: 'network.xyo.test', value: 'foo' }],
109
- ],
110
- [
111
- 'Handles multiple operations',
112
- {
113
- operations: [
114
- {
115
- op: 'test', path: '/schema', value: 'network.xyo.test',
116
- },
117
- {
118
- op: 'add', path: '/value', value: 'foo',
119
- },
120
- {
121
- from: '/value', op: 'copy', path: '/target',
122
- },
123
- {
124
- op: 'replace', path: '/target', value: 'bar',
125
- },
126
- ],
127
- schema: JsonPatchDivinerConfigSchema,
128
- },
129
- [{ schema: 'network.xyo.test' }, { schema: 'network.xyo.debug' }],
130
- [{
131
- schema: 'network.xyo.test', target: 'bar', value: 'foo',
132
- }],
133
- ],
134
- [
135
- 'Filters multiple by schema',
136
- {
137
- operations: [{
138
- op: 'test', path: '/schema', value: 'network.xyo.test',
139
- }],
140
- schema: JsonPatchDivinerConfigSchema,
141
- },
142
- [
143
- { schema: 'network.xyo.test', value: 'foo' },
144
- { schema: 'network.xyo.test', value: 'bar' },
145
- ],
146
- [
147
- { schema: 'network.xyo.test', value: 'foo' },
148
- { schema: 'network.xyo.test', value: 'bar' },
149
- ],
150
- ],
151
- [
152
- 'Filters if property defined',
153
- {
154
- operations: [{
155
- op: 'test', path: '/value', value: 'foo',
156
- }],
157
- schema: JsonPatchDivinerConfigSchema,
158
- },
159
- [{ schema: 'network.xyo.test', value: 'foo' }],
160
- [{ schema: 'network.xyo.test', value: 'foo' }],
161
- ],
162
- [
163
- 'Filters if property null',
164
- {
165
- operations: [{
166
- op: 'test', path: '/value', value: null,
167
- }],
168
- schema: JsonPatchDivinerConfigSchema,
169
- },
170
- [{ schema: 'network.xyo.test', value: null }],
171
- [{ schema: 'network.xyo.test', value: null }],
172
- ],
173
- /* [
174
- 'Filters if property not null',
175
- {
176
- operations: [{
177
- not: true, op: 'test', path: '/value', value: null,
178
- }],
179
- schema: JsonPatchDivinerConfigSchema,
180
- },
181
- [{ schema: 'network.xyo.test', value: 'foo' }],
182
- [{ schema: 'network.xyo.test', value: 'foo' }],
183
- ], */
184
- ]
185
-
186
- /**
187
- * @group module
188
- * @group diviner
189
- */
190
-
191
- describe('JsonPatchDiviner', () => {
192
- let wallet: WalletInstance
193
- beforeAll(async () => {
194
- wallet = await HDWallet.random()
195
- })
196
- describe('divine', () => {
197
- it.each(cases)('%s', async (_title, config, input, expected) => {
198
- const sut = await JsonPatchDiviner.create({ account: wallet, config })
199
- const result = await sut.divine(input)
200
- expect(result).toBeArrayOfSize(expected.length)
201
- expect(result).toMatchObject(expected)
202
- })
203
- })
204
- })