@xyo-network/chain-bridge 1.16.1 → 1.16.2
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/node/driver/index.d.ts +1 -1
- package/dist/node/driver/index.d.ts.map +1 -1
- package/dist/node/manifest/getLocator.d.ts.map +1 -1
- package/dist/node/server/routes/bridge/routeDefinitions/pathParams/ChainIdPathParam.d.ts +1 -5
- package/dist/node/server/routes/bridge/routeDefinitions/pathParams/ChainIdPathParam.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/driver/index.ts +1 -1
- package/src/manifest/getLocator.ts +1 -2
- package/dist/node/driver/mongo/MongoMap.d.ts +0 -18
- package/dist/node/driver/mongo/MongoMap.d.ts.map +0 -1
- package/dist/node/driver/mongo/index.d.ts +0 -2
- package/dist/node/driver/mongo/index.d.ts.map +0 -1
- package/dist/node/driver/mongo/spec/MongoMap.spec.d.ts +0 -2
- package/dist/node/driver/mongo/spec/MongoMap.spec.d.ts.map +0 -1
- package/src/driver/mongo/MongoMap.ts +0 -72
- package/src/driver/mongo/index.ts +0 -1
- package/src/driver/mongo/spec/MongoMap.spec.ts +0 -67
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './indexer/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/driver/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/driver/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAY5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAI1E,OAAO,KAAK,EACW,MAAM,EAC5B,MAAM,+BAA+B,CAAA;AAGtC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,SAAS,iBAAiB,kCAqE1D,CAAA"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export declare const ChainIdPathParam: import("zod").
|
|
2
|
-
readonly __hex: true;
|
|
3
|
-
}>, unknown, import("zod/v4/core").$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
|
|
4
|
-
readonly __hex: true;
|
|
5
|
-
}>, unknown>>;
|
|
1
|
+
export declare const ChainIdPathParam: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<import("@xylabs/hex").Hex, string>>;
|
|
6
2
|
//# sourceMappingURL=ChainIdPathParam.d.ts.map
|
package/dist/node/server/routes/bridge/routeDefinitions/pathParams/ChainIdPathParam.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainIdPathParam.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/routes/bridge/routeDefinitions/pathParams/ChainIdPathParam.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"ChainIdPathParam.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/routes/bridge/routeDefinitions/pathParams/ChainIdPathParam.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,+GAS5B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/chain-bridge",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.2",
|
|
4
4
|
"description": "XYO Layer One Bridge",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"@opentelemetry/instrumentation": "~0.208.0",
|
|
50
50
|
"@opentelemetry/instrumentation-express": "~0.57.0",
|
|
51
51
|
"@opentelemetry/instrumentation-http": "~0.208.0",
|
|
52
|
-
"@xylabs/creatable": "~5.0.
|
|
53
|
-
"@xylabs/express": "~5.0.
|
|
54
|
-
"@xylabs/hex": "~5.0.
|
|
55
|
-
"@xylabs/logger": "~5.0.
|
|
56
|
-
"@xylabs/mongo": "~5.0.
|
|
57
|
-
"@xylabs/typeof": "~5.0.
|
|
52
|
+
"@xylabs/creatable": "~5.0.22",
|
|
53
|
+
"@xylabs/express": "~5.0.22",
|
|
54
|
+
"@xylabs/hex": "~5.0.22",
|
|
55
|
+
"@xylabs/logger": "~5.0.22",
|
|
56
|
+
"@xylabs/mongo": "~5.0.22",
|
|
57
|
+
"@xylabs/typeof": "~5.0.22",
|
|
58
58
|
"@xyo-network/archivist-model": "~5.1.18",
|
|
59
59
|
"@xyo-network/boundwitness-model": "~5.1.18",
|
|
60
|
-
"@xyo-network/chain-protocol": "~1.16.
|
|
60
|
+
"@xyo-network/chain-protocol": "~1.16.2",
|
|
61
61
|
"@xyo-network/manifest-model": "~5.1.18",
|
|
62
62
|
"@xyo-network/module-factory-locator": "~5.1.18",
|
|
63
63
|
"@xyo-network/module-model": "~5.1.18",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"@xyo-network/payload-model": "~5.1.18",
|
|
67
67
|
"@xyo-network/typechain": "~4.0.10",
|
|
68
68
|
"@xyo-network/wallet-model": "~5.1.18",
|
|
69
|
-
"@xyo-network/xl1-protocol": "~1.13.
|
|
70
|
-
"@xyo-network/xl1-protocol-sdk": "~1.16.
|
|
69
|
+
"@xyo-network/xl1-protocol": "~1.13.1",
|
|
70
|
+
"@xyo-network/xl1-protocol-sdk": "~1.16.2",
|
|
71
71
|
"compression": "~1.8.1",
|
|
72
72
|
"cors": "~2.8.5",
|
|
73
73
|
"express": "~5.1.0",
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
"@types/express": "5.0.5",
|
|
84
84
|
"@types/express-serve-static-core": "~5.1.0",
|
|
85
85
|
"@types/node": "~24.10.0",
|
|
86
|
-
"@xylabs/assert": "~5.0.
|
|
87
|
-
"@xylabs/base": "~5.0.
|
|
88
|
-
"@xylabs/delay": "~5.0.
|
|
89
|
-
"@xylabs/object": "~5.0.
|
|
90
|
-
"@xylabs/promise": "~5.0.
|
|
86
|
+
"@xylabs/assert": "~5.0.22",
|
|
87
|
+
"@xylabs/base": "~5.0.22",
|
|
88
|
+
"@xylabs/delay": "~5.0.22",
|
|
89
|
+
"@xylabs/object": "~5.0.22",
|
|
90
|
+
"@xylabs/promise": "~5.0.22",
|
|
91
91
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
92
92
|
"@xylabs/tsconfig": "~7.2.8",
|
|
93
93
|
"@xyo-network/account": "~5.1.18",
|
|
@@ -99,10 +99,10 @@
|
|
|
99
99
|
"@xyo-network/bios": "~7.1.1",
|
|
100
100
|
"@xyo-network/bios-model": "~7.1.1",
|
|
101
101
|
"@xyo-network/boundwitness-builder": "~5.1.18",
|
|
102
|
-
"@xyo-network/chain-modules": "~1.16.
|
|
103
|
-
"@xyo-network/chain-protocol": "~1.16.
|
|
104
|
-
"@xyo-network/chain-services": "~1.16.
|
|
105
|
-
"@xyo-network/chain-telemetry": "~1.16.
|
|
102
|
+
"@xyo-network/chain-modules": "~1.16.2",
|
|
103
|
+
"@xyo-network/chain-protocol": "~1.16.2",
|
|
104
|
+
"@xyo-network/chain-services": "~1.16.2",
|
|
105
|
+
"@xyo-network/chain-telemetry": "~1.16.2",
|
|
106
106
|
"@xyo-network/manifest-wrapper": "~5.1.18",
|
|
107
107
|
"@xyo-network/module-abstract": "~5.1.18",
|
|
108
108
|
"@xyo-network/module-abstract-mongodb": "~5.1.18",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@xyo-network/payload-builder": "~5.1.18",
|
|
112
112
|
"@xyo-network/sentinel-memory": "~5.1.18",
|
|
113
113
|
"@xyo-network/wallet": "~5.1.18",
|
|
114
|
-
"@xyo-network/xl1-protocol": "~1.13.
|
|
114
|
+
"@xyo-network/xl1-protocol": "~1.13.1",
|
|
115
115
|
"dotenv": "~17.2.3",
|
|
116
116
|
"eslint": "^9.39.1",
|
|
117
117
|
"ethers": "~6.15.0",
|
package/src/driver/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './indexer/index.ts'
|
|
@@ -10,6 +10,7 @@ import { ViewArchivist } from '@xyo-network/archivist-view'
|
|
|
10
10
|
import {
|
|
11
11
|
AddressBalanceDivinerV2, ArchivistSyncDiviner, HeadValidationDiviner,
|
|
12
12
|
} from '@xyo-network/chain-modules'
|
|
13
|
+
import { MongoMap } from '@xyo-network/chain-protocol'
|
|
13
14
|
import { initTelemetry } from '@xyo-network/chain-telemetry'
|
|
14
15
|
import { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'
|
|
15
16
|
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
@@ -21,8 +22,6 @@ import type {
|
|
|
21
22
|
} from '@xyo-network/xl1-protocol-sdk'
|
|
22
23
|
import { hasMongoConfig, MemoryMap } from '@xyo-network/xl1-protocol-sdk'
|
|
23
24
|
|
|
24
|
-
import { MongoMap } from '../driver/index.ts'
|
|
25
|
-
|
|
26
25
|
export interface GetLocatorContext {
|
|
27
26
|
config: Config
|
|
28
27
|
logger?: Logger
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AbstractCreatable, CreatableParams } from '@xylabs/creatable';
|
|
2
|
-
import { BaseMongoSdk } from '@xylabs/mongo';
|
|
3
|
-
import { AsynchronousMap } from '@xyo-network/xl1-protocol-sdk';
|
|
4
|
-
import { Document } from 'mongodb';
|
|
5
|
-
export interface MongoMapParams<TData extends Document = Document> extends CreatableParams {
|
|
6
|
-
sdk: BaseMongoSdk<TData>;
|
|
7
|
-
}
|
|
8
|
-
export declare class MongoMap<K = string, V extends Document = Document> extends AbstractCreatable<MongoMapParams<V>> implements AsynchronousMap<K, V> {
|
|
9
|
-
get sdk(): BaseMongoSdk<V>;
|
|
10
|
-
clear(): Promise<void>;
|
|
11
|
-
delete(id: K): Promise<boolean>;
|
|
12
|
-
get(id: K): Promise<V | undefined>;
|
|
13
|
-
getMany(ids: K[]): Promise<V[]>;
|
|
14
|
-
has(id: K): Promise<boolean>;
|
|
15
|
-
set(id: K, data: V): Promise<void>;
|
|
16
|
-
startHandler(): Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=MongoMap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MongoMap.d.ts","sourceRoot":"","sources":["../../../../src/driver/mongo/MongoMap.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAAa,eAAe,EAC9C,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EACL,QAAQ,EACT,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,cAAc,CAAC,KAAK,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,eAAe;IACxF,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;CACzB;AAOD,qBACa,QAAQ,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,QAAQ,GAAG,QAAQ,CAC7D,SAAQ,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAC3C,YAAW,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAChC,IAAI,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAEzB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAM/B,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAMlC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAW/B,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAM5B,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/driver/mongo/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MongoMap.spec.d.ts","sourceRoot":"","sources":["../../../../../src/driver/mongo/spec/MongoMap.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import {
|
|
3
|
-
AbstractCreatable, creatable, CreatableParams,
|
|
4
|
-
} from '@xylabs/creatable'
|
|
5
|
-
import { BaseMongoSdk } from '@xylabs/mongo'
|
|
6
|
-
import { isNull } from '@xylabs/typeof'
|
|
7
|
-
import { AsynchronousMap } from '@xyo-network/xl1-protocol-sdk'
|
|
8
|
-
import {
|
|
9
|
-
Document, Filter, OptionalUnlessRequiredId, WithId,
|
|
10
|
-
} from 'mongodb'
|
|
11
|
-
|
|
12
|
-
export interface MongoMapParams<TData extends Document = Document> extends CreatableParams {
|
|
13
|
-
sdk: BaseMongoSdk<TData>
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function stripMongoId<V extends Document>(doc: WithId<V>): V {
|
|
17
|
-
const { _id, ...rest } = doc
|
|
18
|
-
return rest as unknown as V
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@creatable()
|
|
22
|
-
export class MongoMap<K = string, V extends Document = Document>
|
|
23
|
-
extends AbstractCreatable<MongoMapParams<V>>
|
|
24
|
-
implements AsynchronousMap<K, V> {
|
|
25
|
-
get sdk(): BaseMongoSdk<V> {
|
|
26
|
-
return assertEx(this.params.sdk, () => 'No sdk specified')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async clear(): Promise<void> {
|
|
30
|
-
await this.sdk.deleteMany({})
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async delete(id: K): Promise<boolean> {
|
|
34
|
-
const filter = { _id: id } as Filter<V>
|
|
35
|
-
const result = await this.sdk.deleteOne(filter)
|
|
36
|
-
return result.deletedCount > 0
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async get(id: K): Promise<V | undefined> {
|
|
40
|
-
const filter = { _id: id } as Filter<V>
|
|
41
|
-
const doc = await this.sdk.findOne(filter)
|
|
42
|
-
return isNull(doc) ? undefined : stripMongoId(doc)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async getMany(ids: K[]): Promise<V[]> {
|
|
46
|
-
const results: V[] = []
|
|
47
|
-
for (const id of ids) {
|
|
48
|
-
const value = await this.get(id)
|
|
49
|
-
if (value) {
|
|
50
|
-
results.push(value)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return results
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async has(id: K): Promise<boolean> {
|
|
57
|
-
const filter = { _id: id } as Filter<V>
|
|
58
|
-
const exists = await this.sdk.findOne(filter)
|
|
59
|
-
return isNull(exists) ? false : true
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async set(id: K, data: V): Promise<void> {
|
|
63
|
-
const filter = { _id: id } as Filter<V>
|
|
64
|
-
const value = { ...data, _id: id } as OptionalUnlessRequiredId<V>
|
|
65
|
-
await this.sdk.replaceOne(filter, value, { upsert: true })
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
override async startHandler(): Promise<void> {
|
|
69
|
-
await super.startHandler()
|
|
70
|
-
// TODO: Ensure index
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MongoMap.ts'
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { BaseMongoSdk } from '@xylabs/mongo'
|
|
2
|
-
import { getBaseMongoSdkPrivateConfig, hasMongoDBConfig } from '@xyo-network/module-abstract-mongodb'
|
|
3
|
-
import {
|
|
4
|
-
beforeAll, beforeEach, describe, expect, it,
|
|
5
|
-
} from 'vitest'
|
|
6
|
-
|
|
7
|
-
import { MongoMap } from '../MongoMap.ts'
|
|
8
|
-
|
|
9
|
-
describe.runIf(hasMongoDBConfig())('MongoMap', () => {
|
|
10
|
-
interface TestDoc {
|
|
11
|
-
name: string
|
|
12
|
-
value: number
|
|
13
|
-
}
|
|
14
|
-
const collection = 'test_mongo_map'
|
|
15
|
-
let sdk: BaseMongoSdk<TestDoc>
|
|
16
|
-
let map: MongoMap<string, TestDoc>
|
|
17
|
-
beforeAll(async () => {
|
|
18
|
-
const payloadSdkConfig = getBaseMongoSdkPrivateConfig()
|
|
19
|
-
sdk = new BaseMongoSdk<TestDoc>({ ...payloadSdkConfig, collection })
|
|
20
|
-
map = await MongoMap.create<MongoMap<string, TestDoc>>({ sdk })
|
|
21
|
-
await map.start()
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
beforeEach(async () => {
|
|
25
|
-
await map.clear()
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('can set and get a value', async () => {
|
|
29
|
-
await map.set('foo', { name: 'Test', value: 42 })
|
|
30
|
-
const result = await map.get('foo')
|
|
31
|
-
expect(result).toEqual({ name: 'Test', value: 42 })
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('returns undefined for missing key', async () => {
|
|
35
|
-
const result = await map.get('missing')
|
|
36
|
-
expect(result).toBeUndefined()
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('can detect if key exists', async () => {
|
|
40
|
-
await map.set('exists', { name: 'Check', value: 100 })
|
|
41
|
-
const hasExists = await map.has('exists')
|
|
42
|
-
const hasMissing = await map.has('does-not-exist')
|
|
43
|
-
expect(hasExists).toBe(true)
|
|
44
|
-
expect(hasMissing).toBe(false)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('can delete a key', async () => {
|
|
48
|
-
await map.set('delete-me', { name: 'ToDelete', value: 1 })
|
|
49
|
-
const deleted = await map.delete('delete-me')
|
|
50
|
-
const stillExists = await map.has('delete-me')
|
|
51
|
-
expect(deleted).toBe(true)
|
|
52
|
-
expect(stillExists).toBe(false)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it('delete returns false for non-existent key', async () => {
|
|
56
|
-
const deleted = await map.delete('non-existent')
|
|
57
|
-
expect(deleted).toBe(false)
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('can clear all entries', async () => {
|
|
61
|
-
await map.set('one', { name: 'A', value: 1 })
|
|
62
|
-
await map.set('two', { name: 'B', value: 2 })
|
|
63
|
-
await map.clear()
|
|
64
|
-
expect(await map.has('one')).toBe(false)
|
|
65
|
-
expect(await map.has('two')).toBe(false)
|
|
66
|
-
})
|
|
67
|
-
})
|