@xyo-network/module-abstract-mongodb 2.82.0 → 2.84.0-rc.1
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/browser/Module.d.cts +50 -61
- package/dist/browser/Module.d.cts.map +1 -1
- package/dist/browser/Module.d.mts +50 -61
- package/dist/browser/Module.d.mts.map +1 -1
- package/dist/browser/Module.d.ts +50 -61
- package/dist/browser/Module.d.ts.map +1 -1
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/util/removeId.d.cts +2 -2
- package/dist/browser/util/removeId.d.cts.map +1 -1
- package/dist/browser/util/removeId.d.mts +2 -2
- package/dist/browser/util/removeId.d.mts.map +1 -1
- package/dist/browser/util/removeId.d.ts +2 -2
- package/dist/browser/util/removeId.d.ts.map +1 -1
- package/dist/node/Module.d.cts +50 -61
- package/dist/node/Module.d.cts.map +1 -1
- package/dist/node/Module.d.mts +50 -61
- package/dist/node/Module.d.mts.map +1 -1
- package/dist/node/Module.d.ts +50 -61
- package/dist/node/Module.d.ts.map +1 -1
- package/dist/node/{index.mjs → index.cjs} +65 -26
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.js +25 -64
- package/dist/node/index.js.map +1 -1
- package/dist/node/util/removeId.d.cts +2 -2
- package/dist/node/util/removeId.d.cts.map +1 -1
- package/dist/node/util/removeId.d.mts +2 -2
- package/dist/node/util/removeId.d.mts.map +1 -1
- package/dist/node/util/removeId.d.ts +2 -2
- package/dist/node/util/removeId.d.ts.map +1 -1
- package/package.json +20 -27
- package/src/Module.ts +6 -6
- package/dist/node/index.mjs.map +0 -1
package/dist/node/Module.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { Module } from '@xyo-network/module-model';
|
|
2
2
|
import { MongoDBModuleParams, MongoDBStorageClassLabels } from '@xyo-network/module-model-mongodb';
|
|
3
|
-
import {
|
|
3
|
+
import { BoundWitnessWithMongoMeta, PayloadWithMongoMeta } from '@xyo-network/payload-mongodb';
|
|
4
4
|
import { BaseMongoSdk, BaseMongoSdkConfig } from '@xyo-network/sdk-xyo-mongo-js';
|
|
5
5
|
export type AnyAbstractModule<TParams extends MongoDBModuleParams = MongoDBModuleParams> = abstract new (...args: any[]) => Module<TParams>;
|
|
6
|
-
export declare const MongoDBModuleMixin: <TParams extends import("@
|
|
6
|
+
export declare const MongoDBModuleMixin: <TParams extends import("@xylabs/object").BaseParamsFields & {
|
|
7
7
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
8
|
-
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
9
|
-
|
|
10
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
8
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
9
|
+
readonly archivist?: string | undefined;
|
|
11
10
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
12
11
|
readonly name?: string | undefined;
|
|
13
12
|
readonly paging?: Record<string, {
|
|
14
13
|
size?: number | undefined;
|
|
15
14
|
}> | undefined;
|
|
15
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
16
|
+
schema: "network.xyo.module.mongodb.config";
|
|
16
17
|
readonly security?: {
|
|
17
18
|
readonly allowAnonymous?: boolean | undefined;
|
|
18
19
|
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
@@ -21,14 +22,15 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
21
22
|
readonly sign?: boolean | undefined;
|
|
22
23
|
readonly storeQueries?: boolean | undefined;
|
|
23
24
|
readonly timestamp?: boolean | undefined;
|
|
24
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig &
|
|
25
|
-
|
|
26
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
25
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
26
|
+
readonly archivist?: string | undefined;
|
|
27
27
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
28
28
|
readonly name?: string | undefined;
|
|
29
29
|
readonly paging?: Record<string, {
|
|
30
30
|
size?: number | undefined;
|
|
31
31
|
}> | undefined;
|
|
32
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
33
|
+
schema: "network.xyo.module.mongodb.config";
|
|
32
34
|
readonly security?: {
|
|
33
35
|
readonly allowAnonymous?: boolean | undefined;
|
|
34
36
|
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
@@ -37,33 +39,29 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
37
39
|
readonly sign?: boolean | undefined;
|
|
38
40
|
readonly storeQueries?: boolean | undefined;
|
|
39
41
|
readonly timestamp?: boolean | undefined;
|
|
40
|
-
} &
|
|
42
|
+
} & {
|
|
41
43
|
boundWitnessSdkConfig?: Partial<import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPublicConfig> | undefined;
|
|
42
44
|
payloadSdkConfig?: Partial<import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPublicConfig> | undefined;
|
|
43
45
|
schema: "network.xyo.module.mongodb.config";
|
|
44
|
-
}, "schema"> & {
|
|
45
|
-
schema: "network.xyo.module.mongodb.config";
|
|
46
|
-
}, "schema"> & {
|
|
47
|
-
schema: string;
|
|
48
46
|
}, "schema"> & {
|
|
49
47
|
schema: string;
|
|
50
48
|
};
|
|
51
49
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
52
|
-
wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
|
|
53
50
|
} & {
|
|
54
51
|
boundWitnessSdkConfig?: (import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPrivateConfig & Partial<import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPublicConfig>) | undefined;
|
|
55
52
|
jobQueue?: import("@xyo-network/node-core-model").JobQueue | undefined;
|
|
56
53
|
payloadSdkConfig?: (import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPrivateConfig & Partial<import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPublicConfig>) | undefined;
|
|
57
|
-
} = import("@
|
|
54
|
+
} = import("@xylabs/object").BaseParamsFields & {
|
|
58
55
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
59
|
-
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
60
|
-
|
|
61
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
56
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
57
|
+
readonly archivist?: string | undefined;
|
|
62
58
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
63
59
|
readonly name?: string | undefined;
|
|
64
60
|
readonly paging?: Record<string, {
|
|
65
61
|
size?: number | undefined;
|
|
66
62
|
}> | undefined;
|
|
63
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
64
|
+
schema: "network.xyo.module.mongodb.config";
|
|
67
65
|
readonly security?: {
|
|
68
66
|
readonly allowAnonymous?: boolean | undefined;
|
|
69
67
|
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
@@ -72,14 +70,15 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
72
70
|
readonly sign?: boolean | undefined;
|
|
73
71
|
readonly storeQueries?: boolean | undefined;
|
|
74
72
|
readonly timestamp?: boolean | undefined;
|
|
75
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig &
|
|
76
|
-
|
|
77
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
73
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
74
|
+
readonly archivist?: string | undefined;
|
|
78
75
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
79
76
|
readonly name?: string | undefined;
|
|
80
77
|
readonly paging?: Record<string, {
|
|
81
78
|
size?: number | undefined;
|
|
82
79
|
}> | undefined;
|
|
80
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
81
|
+
schema: "network.xyo.module.mongodb.config";
|
|
83
82
|
readonly security?: {
|
|
84
83
|
readonly allowAnonymous?: boolean | undefined;
|
|
85
84
|
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
@@ -88,33 +87,26 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
88
87
|
readonly sign?: boolean | undefined;
|
|
89
88
|
readonly storeQueries?: boolean | undefined;
|
|
90
89
|
readonly timestamp?: boolean | undefined;
|
|
91
|
-
} &
|
|
90
|
+
} & {
|
|
92
91
|
boundWitnessSdkConfig?: Partial<import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPublicConfig> | undefined;
|
|
93
92
|
payloadSdkConfig?: Partial<import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPublicConfig> | undefined;
|
|
94
93
|
schema: "network.xyo.module.mongodb.config";
|
|
95
|
-
}, "schema"> & {
|
|
96
|
-
schema: "network.xyo.module.mongodb.config";
|
|
97
|
-
}, "schema"> & {
|
|
98
|
-
schema: string;
|
|
99
94
|
}, "schema"> & {
|
|
100
95
|
schema: string;
|
|
101
96
|
};
|
|
102
97
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
103
|
-
wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
|
|
104
98
|
} & {
|
|
105
99
|
boundWitnessSdkConfig?: (import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPrivateConfig & Partial<import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPublicConfig>) | undefined;
|
|
106
100
|
jobQueue?: import("@xyo-network/node-core-model").JobQueue | undefined;
|
|
107
101
|
payloadSdkConfig?: (import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPrivateConfig & Partial<import("@xyo-network/sdk-xyo-mongo-js").BaseMongoSdkPublicConfig>) | undefined;
|
|
108
102
|
}, TModule extends AnyAbstractModule<TParams> = AnyAbstractModule<TParams>>(ModuleBase: TModule) => ((abstract new (...args: any[]) => {
|
|
109
|
-
_boundWitnessSdk: BaseMongoSdk<
|
|
110
|
-
_payloadSdk: BaseMongoSdk<
|
|
103
|
+
_boundWitnessSdk: BaseMongoSdk<BoundWitnessWithMongoMeta> | undefined;
|
|
104
|
+
_payloadSdk: BaseMongoSdk<PayloadWithMongoMeta> | undefined;
|
|
111
105
|
readonly boundWitnessSdkConfig: BaseMongoSdkConfig;
|
|
112
|
-
readonly boundWitnesses: BaseMongoSdk<
|
|
106
|
+
readonly boundWitnesses: BaseMongoSdk<BoundWitnessWithMongoMeta>;
|
|
113
107
|
readonly jobQueue: import("@xyo-network/node-core-model").JobQueue;
|
|
114
108
|
readonly payloadSdkConfig: BaseMongoSdkConfig;
|
|
115
|
-
readonly payloads: BaseMongoSdk<
|
|
116
|
-
schema: string;
|
|
117
|
-
}>;
|
|
109
|
+
readonly payloads: BaseMongoSdk<PayloadWithMongoMeta>;
|
|
118
110
|
/**
|
|
119
111
|
* Ensures any indexes specified within the config are created. This method should be idempotent
|
|
120
112
|
* allowing for multiple calls without causing errors while ensuring the desired state.
|
|
@@ -122,29 +114,31 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
122
114
|
ensureIndexes(): Promise<void>;
|
|
123
115
|
address: string;
|
|
124
116
|
config: TParams["config"];
|
|
117
|
+
id: string;
|
|
125
118
|
params: TParams;
|
|
126
119
|
previousHash: () => import("@xylabs/promise").Promisable<string | undefined>;
|
|
127
120
|
queries: string[];
|
|
128
|
-
query: <T extends import("@xyo-network/payload-model").SchemaFields & Omit<import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
121
|
+
query: <T extends import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
129
122
|
query: string;
|
|
130
123
|
resultSet?: string | undefined;
|
|
131
124
|
schema: "network.xyo.boundwitness";
|
|
132
125
|
}, "schema"> & {
|
|
133
126
|
schema: "network.xyo.boundwitness";
|
|
134
|
-
} = import("@xyo-network/payload-model").SchemaFields & Omit<import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
127
|
+
} = import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
135
128
|
query: string;
|
|
136
129
|
resultSet?: string | undefined;
|
|
137
130
|
schema: "network.xyo.boundwitness";
|
|
138
131
|
}, "schema"> & {
|
|
139
132
|
schema: "network.xyo.boundwitness";
|
|
140
|
-
}, TConf extends import("@xyo-network/payload-model").SchemaFields & {
|
|
141
|
-
|
|
142
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
133
|
+
}, TConf extends import("@xyo-network/payload-model").SchemaFields & object & {
|
|
134
|
+
readonly archivist?: string | undefined;
|
|
143
135
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
144
136
|
readonly name?: string | undefined;
|
|
145
137
|
readonly paging?: Record<string, {
|
|
146
138
|
size?: number | undefined;
|
|
147
139
|
}> | undefined;
|
|
140
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
141
|
+
schema: "network.xyo.module.config";
|
|
148
142
|
readonly security?: {
|
|
149
143
|
readonly allowAnonymous?: boolean | undefined;
|
|
150
144
|
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
@@ -153,16 +147,15 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
153
147
|
readonly sign?: boolean | undefined;
|
|
154
148
|
readonly storeQueries?: boolean | undefined;
|
|
155
149
|
readonly timestamp?: boolean | undefined;
|
|
156
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
157
|
-
|
|
158
|
-
} = import("@xyo-network/payload-model").SchemaFields & {
|
|
159
|
-
accountDerivationPath?: string | undefined;
|
|
160
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
150
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig = import("@xyo-network/payload-model").SchemaFields & object & {
|
|
151
|
+
readonly archivist?: string | undefined;
|
|
161
152
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
162
153
|
readonly name?: string | undefined;
|
|
163
154
|
readonly paging?: Record<string, {
|
|
164
155
|
size?: number | undefined;
|
|
165
156
|
}> | undefined;
|
|
157
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
158
|
+
schema: "network.xyo.module.config";
|
|
166
159
|
readonly security?: {
|
|
167
160
|
readonly allowAnonymous?: boolean | undefined;
|
|
168
161
|
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
@@ -171,31 +164,30 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
171
164
|
readonly sign?: boolean | undefined;
|
|
172
165
|
readonly storeQueries?: boolean | undefined;
|
|
173
166
|
readonly timestamp?: boolean | undefined;
|
|
174
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig
|
|
175
|
-
schema: "network.xyo.module.config";
|
|
176
|
-
}>(query: T, payloads?: {
|
|
167
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig>(query: T, payloads?: ({
|
|
177
168
|
schema: string;
|
|
178
|
-
}[] | undefined, queryConfig?: TConf | undefined) => import("@xylabs/promise").Promisable<import("@xyo-network/module-model").ModuleQueryResult>;
|
|
179
|
-
queryable: <T_1 extends import("@xyo-network/payload-model").SchemaFields & Omit<import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
169
|
+
} & object)[] | undefined, queryConfig?: TConf | undefined) => import("@xylabs/promise").Promisable<import("@xyo-network/module-model").ModuleQueryResult>;
|
|
170
|
+
queryable: <T_1 extends import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
180
171
|
query: string;
|
|
181
172
|
resultSet?: string | undefined;
|
|
182
173
|
schema: "network.xyo.boundwitness";
|
|
183
174
|
}, "schema"> & {
|
|
184
175
|
schema: "network.xyo.boundwitness";
|
|
185
|
-
} = import("@xyo-network/payload-model").SchemaFields & Omit<import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
176
|
+
} = import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
186
177
|
query: string;
|
|
187
178
|
resultSet?: string | undefined;
|
|
188
179
|
schema: "network.xyo.boundwitness";
|
|
189
180
|
}, "schema"> & {
|
|
190
181
|
schema: "network.xyo.boundwitness";
|
|
191
|
-
}, TConf_1 extends import("@xyo-network/payload-model").SchemaFields & {
|
|
192
|
-
|
|
193
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
182
|
+
}, TConf_1 extends import("@xyo-network/payload-model").SchemaFields & object & {
|
|
183
|
+
readonly archivist?: string | undefined;
|
|
194
184
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
195
185
|
readonly name?: string | undefined;
|
|
196
186
|
readonly paging?: Record<string, {
|
|
197
187
|
size?: number | undefined;
|
|
198
188
|
}> | undefined;
|
|
189
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
190
|
+
schema: "network.xyo.module.config";
|
|
199
191
|
readonly security?: {
|
|
200
192
|
readonly allowAnonymous?: boolean | undefined;
|
|
201
193
|
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
@@ -204,16 +196,15 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
204
196
|
readonly sign?: boolean | undefined;
|
|
205
197
|
readonly storeQueries?: boolean | undefined;
|
|
206
198
|
readonly timestamp?: boolean | undefined;
|
|
207
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
208
|
-
|
|
209
|
-
} = import("@xyo-network/payload-model").SchemaFields & {
|
|
210
|
-
accountDerivationPath?: string | undefined;
|
|
211
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
199
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig = import("@xyo-network/payload-model").SchemaFields & object & {
|
|
200
|
+
readonly archivist?: string | undefined;
|
|
212
201
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
213
202
|
readonly name?: string | undefined;
|
|
214
203
|
readonly paging?: Record<string, {
|
|
215
204
|
size?: number | undefined;
|
|
216
205
|
}> | undefined;
|
|
206
|
+
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
207
|
+
schema: "network.xyo.module.config";
|
|
217
208
|
readonly security?: {
|
|
218
209
|
readonly allowAnonymous?: boolean | undefined;
|
|
219
210
|
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
@@ -222,11 +213,9 @@ export declare const MongoDBModuleMixin: <TParams extends import("@xyo-network/c
|
|
|
222
213
|
readonly sign?: boolean | undefined;
|
|
223
214
|
readonly storeQueries?: boolean | undefined;
|
|
224
215
|
readonly timestamp?: boolean | undefined;
|
|
225
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig
|
|
226
|
-
schema: "network.xyo.module.config";
|
|
227
|
-
}>(query: T_1, payloads?: {
|
|
216
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig>(query: T_1, payloads?: ({
|
|
228
217
|
schema: string;
|
|
229
|
-
}[] | undefined, queryConfig?: TConf_1 | undefined) => import("@xylabs/promise").Promisable<boolean>;
|
|
218
|
+
} & object)[] | undefined, queryConfig?: TConf_1 | undefined) => import("@xylabs/promise").Promisable<boolean>;
|
|
230
219
|
start?: (() => import("@xylabs/promise").Promisable<boolean>) | undefined;
|
|
231
220
|
stop?: (() => import("@xylabs/promise").Promisable<boolean>) | undefined;
|
|
232
221
|
eventData: import("@xyo-network/module-model").ModuleEventData<object>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Module.d.ts","sourceRoot":"","sources":["../../src/Module.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAiB,mBAAmB,EAAuB,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AACtI,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Module.d.ts","sourceRoot":"","sources":["../../src/Module.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAiB,mBAAmB,EAAuB,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AACtI,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAC9F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAQhF,MAAM,MAAM,iBAAiB,CAAC,OAAO,SAAS,mBAAmB,GAAG,mBAAmB,IAAI,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,CAAA;AAE3I,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6HAFmF,GAAG,EAAE;sBAWjG,aAAa,yBAAyB,CAAC,GAAG,SAAS;iBACxD,aAAa,oBAAoB,CAAC,GAAG,SAAS;;;;;;IA8B3D;;;OAGG;qBACoB,QAAQ,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAOvC,CAAA"}
|
|
@@ -1,11 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2
6
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
4
21
|
var __publicField = (obj, key, value) => {
|
|
5
22
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
23
|
return value;
|
|
7
24
|
};
|
|
8
25
|
|
|
26
|
+
// src/index.ts
|
|
27
|
+
var src_exports = {};
|
|
28
|
+
__export(src_exports, {
|
|
29
|
+
COLLECTIONS: () => COLLECTIONS,
|
|
30
|
+
DATABASES: () => DATABASES,
|
|
31
|
+
DefaultAggregateTimeoutMs: () => DefaultAggregateTimeoutMs,
|
|
32
|
+
DefaultLimit: () => DefaultLimit,
|
|
33
|
+
DefaultMaxTimeMS: () => DefaultMaxTimeMS,
|
|
34
|
+
DefaultOrder: () => DefaultOrder,
|
|
35
|
+
MongoDBModuleMixin: () => MongoDBModuleMixin,
|
|
36
|
+
escapeChar: () => escapeChar,
|
|
37
|
+
fromDbProperty: () => fromDbProperty,
|
|
38
|
+
getBaseMongoSdk: () => getBaseMongoSdk,
|
|
39
|
+
getBaseMongoSdkPrivateConfig: () => getBaseMongoSdkPrivateConfig,
|
|
40
|
+
getMongoDBConfig: () => getMongoDBConfig,
|
|
41
|
+
hasMongoDBConfig: () => hasMongoDBConfig,
|
|
42
|
+
removeId: () => removeId,
|
|
43
|
+
toDbProperty: () => toDbProperty
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(src_exports);
|
|
46
|
+
|
|
9
47
|
// src/Collections.ts
|
|
10
48
|
var COLLECTIONS = {
|
|
11
49
|
AddressInfo: "address_info",
|
|
@@ -17,8 +55,8 @@ var COLLECTIONS = {
|
|
|
17
55
|
};
|
|
18
56
|
|
|
19
57
|
// src/config/getBaseMongoSdk.ts
|
|
20
|
-
|
|
21
|
-
|
|
58
|
+
var import_assert = require("@xylabs/assert");
|
|
59
|
+
var import_sdk_xyo_mongo_js = require("@xyo-network/sdk-xyo-mongo-js");
|
|
22
60
|
|
|
23
61
|
// src/config/getMongoDBConfig.ts
|
|
24
62
|
var getMongoDBConfig = /* @__PURE__ */ __name(() => {
|
|
@@ -40,21 +78,21 @@ var getBaseMongoSdkPrivateConfig = /* @__PURE__ */ __name(() => {
|
|
|
40
78
|
const env = getMongoDBConfig();
|
|
41
79
|
return {
|
|
42
80
|
dbConnectionString: env.MONGO_CONNECTION_STRING,
|
|
43
|
-
dbDomain: assertEx(env.MONGO_DOMAIN, "Missing Mongo Domain"),
|
|
44
|
-
dbName: assertEx(env.MONGO_DATABASE, "Missing Mongo Database"),
|
|
45
|
-
dbPassword: assertEx(env.MONGO_PASSWORD, "Missing Mongo Password"),
|
|
46
|
-
dbUserName: assertEx(env.MONGO_USERNAME, "Missing Mongo Username")
|
|
81
|
+
dbDomain: (0, import_assert.assertEx)(env.MONGO_DOMAIN, "Missing Mongo Domain"),
|
|
82
|
+
dbName: (0, import_assert.assertEx)(env.MONGO_DATABASE, "Missing Mongo Database"),
|
|
83
|
+
dbPassword: (0, import_assert.assertEx)(env.MONGO_PASSWORD, "Missing Mongo Password"),
|
|
84
|
+
dbUserName: (0, import_assert.assertEx)(env.MONGO_USERNAME, "Missing Mongo Username")
|
|
47
85
|
};
|
|
48
86
|
}, "getBaseMongoSdkPrivateConfig");
|
|
49
87
|
var getBaseMongoSdk = /* @__PURE__ */ __name((collection) => {
|
|
50
|
-
return new BaseMongoSdk({
|
|
88
|
+
return new import_sdk_xyo_mongo_js.BaseMongoSdk({
|
|
51
89
|
...getBaseMongoSdkPrivateConfig(),
|
|
52
90
|
collection
|
|
53
91
|
});
|
|
54
92
|
}, "getBaseMongoSdk");
|
|
55
93
|
|
|
56
94
|
// src/config/hasMongoDBConfig.ts
|
|
57
|
-
|
|
95
|
+
var import_exists = require("@xylabs/exists");
|
|
58
96
|
var hasMongoDBConfig = /* @__PURE__ */ __name(() => {
|
|
59
97
|
const env = getMongoDBConfig();
|
|
60
98
|
const requiredValues = [
|
|
@@ -64,7 +102,7 @@ var hasMongoDBConfig = /* @__PURE__ */ __name(() => {
|
|
|
64
102
|
env.MONGO_PASSWORD,
|
|
65
103
|
env.MONGO_USERNAME
|
|
66
104
|
];
|
|
67
|
-
return requiredValues.every(exists);
|
|
105
|
+
return requiredValues.every(import_exists.exists);
|
|
68
106
|
}, "hasMongoDBConfig");
|
|
69
107
|
|
|
70
108
|
// src/Databases.ts
|
|
@@ -79,11 +117,11 @@ var DefaultMaxTimeMS = 2e3;
|
|
|
79
117
|
var DefaultOrder = "desc";
|
|
80
118
|
|
|
81
119
|
// src/Module.ts
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
120
|
+
var import_assert2 = require("@xylabs/assert");
|
|
121
|
+
var import_lodash = require("@xylabs/lodash");
|
|
122
|
+
var import_static_implements = require("@xylabs/static-implements");
|
|
123
|
+
var import_module_model_mongodb = require("@xyo-network/module-model-mongodb");
|
|
124
|
+
var import_sdk_xyo_mongo_js2 = require("@xyo-network/sdk-xyo-mongo-js");
|
|
87
125
|
function _ts_decorate(decorators, target, key, desc) {
|
|
88
126
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
89
127
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -106,16 +144,16 @@ var MongoDBModuleMixin = /* @__PURE__ */ __name((ModuleBase) => {
|
|
|
106
144
|
collection: COLLECTIONS.BoundWitnesses,
|
|
107
145
|
...getBaseMongoSdkPrivateConfig()
|
|
108
146
|
};
|
|
109
|
-
return merge(config, this.params.boundWitnessSdkConfig, this.config.boundWitnessSdkConfig, {
|
|
147
|
+
return (0, import_lodash.merge)(config, this.params.boundWitnessSdkConfig, this.config.boundWitnessSdkConfig, {
|
|
110
148
|
collection: ((_a2 = this.config.boundWitnessSdkConfig) == null ? void 0 : _a2.collection) ?? ((_b = this.params.boundWitnessSdkConfig) == null ? void 0 : _b.collection) ?? COLLECTIONS.BoundWitnesses
|
|
111
149
|
});
|
|
112
150
|
}
|
|
113
151
|
get boundWitnesses() {
|
|
114
|
-
this._boundWitnessSdk = this._boundWitnessSdk ?? new
|
|
115
|
-
return
|
|
152
|
+
this._boundWitnessSdk = this._boundWitnessSdk ?? new import_sdk_xyo_mongo_js2.BaseMongoSdk(this.boundWitnessSdkConfig);
|
|
153
|
+
return (0, import_assert2.assertEx)(this._boundWitnessSdk);
|
|
116
154
|
}
|
|
117
155
|
get jobQueue() {
|
|
118
|
-
return
|
|
156
|
+
return (0, import_assert2.assertEx)(this.params.jobQueue, "MongoDBModule Error: jobQueue required for this module but is not defined");
|
|
119
157
|
}
|
|
120
158
|
get payloadSdkConfig() {
|
|
121
159
|
var _a2, _b;
|
|
@@ -123,13 +161,13 @@ var MongoDBModuleMixin = /* @__PURE__ */ __name((ModuleBase) => {
|
|
|
123
161
|
collection: COLLECTIONS.Payloads,
|
|
124
162
|
...getBaseMongoSdkPrivateConfig()
|
|
125
163
|
};
|
|
126
|
-
return merge(config, this.params.payloadSdkConfig, this.config.payloadSdkConfig, {
|
|
164
|
+
return (0, import_lodash.merge)(config, this.params.payloadSdkConfig, this.config.payloadSdkConfig, {
|
|
127
165
|
collection: ((_a2 = this.config.payloadSdkConfig) == null ? void 0 : _a2.collection) ?? ((_b = this.params.payloadSdkConfig) == null ? void 0 : _b.collection) ?? COLLECTIONS.Payloads
|
|
128
166
|
});
|
|
129
167
|
}
|
|
130
168
|
get payloads() {
|
|
131
|
-
this._payloadSdk = this._payloadSdk ?? new
|
|
132
|
-
return
|
|
169
|
+
this._payloadSdk = this._payloadSdk ?? new import_sdk_xyo_mongo_js2.BaseMongoSdk(this.payloadSdkConfig);
|
|
170
|
+
return (0, import_assert2.assertEx)(this._payloadSdk);
|
|
133
171
|
}
|
|
134
172
|
/**
|
|
135
173
|
* Ensures any indexes specified within the config are created. This method should be idempotent
|
|
@@ -141,9 +179,9 @@ var MongoDBModuleMixin = /* @__PURE__ */ __name((ModuleBase) => {
|
|
|
141
179
|
await ensureIndexesExistOnCollection(this.boundWitnesses, configIndexes);
|
|
142
180
|
await ensureIndexesExistOnCollection(this.payloads, configIndexes);
|
|
143
181
|
}
|
|
144
|
-
}, __name(_a, "MongoModuleBase"), __publicField(_a, "labels", MongoDBStorageClassLabels), _a);
|
|
182
|
+
}, __name(_a, "MongoModuleBase"), __publicField(_a, "labels", import_module_model_mongodb.MongoDBStorageClassLabels), _a);
|
|
145
183
|
MongoModuleBase = _ts_decorate([
|
|
146
|
-
staticImplements()
|
|
184
|
+
(0, import_static_implements.staticImplements)()
|
|
147
185
|
], MongoModuleBase);
|
|
148
186
|
return MongoModuleBase;
|
|
149
187
|
}, "MongoDBModuleMixin");
|
|
@@ -184,7 +222,8 @@ var removeId = /* @__PURE__ */ __name((payload) => {
|
|
|
184
222
|
const { _id, ...withoutId } = payload;
|
|
185
223
|
return withoutId;
|
|
186
224
|
}, "removeId");
|
|
187
|
-
export
|
|
225
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
226
|
+
0 && (module.exports = {
|
|
188
227
|
COLLECTIONS,
|
|
189
228
|
DATABASES,
|
|
190
229
|
DefaultAggregateTimeoutMs,
|
|
@@ -200,5 +239,5 @@ export {
|
|
|
200
239
|
hasMongoDBConfig,
|
|
201
240
|
removeId,
|
|
202
241
|
toDbProperty
|
|
203
|
-
};
|
|
204
|
-
//# sourceMappingURL=index.
|
|
242
|
+
});
|
|
243
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/Collections.ts","../../src/config/getBaseMongoSdk.ts","../../src/config/getMongoDBConfig.ts","../../src/config/hasMongoDBConfig.ts","../../src/Databases.ts","../../src/Defaults.ts","../../src/Module.ts","../../src/util/dbProperty.ts","../../src/util/removeId.ts"],"sourcesContent":["export * from './Collections'\nexport * from './config'\nexport * from './Databases'\nexport * from './Defaults'\nexport * from './IndexDescription'\nexport * from './Indexes'\nexport * from './Module'\nexport * from './util'\n","// TODO: By DB\nexport const COLLECTIONS = {\n AddressInfo: 'address_info' as const,\n ArchivistStats: 'archivist_stats' as const,\n BoundWitnesses: 'bound_witnesses' as const,\n Payloads: 'payloads' as const,\n Thumbnails: 'thumbnails' as const,\n Users: 'users' as const,\n}\n","import { assertEx } from '@xylabs/assert'\nimport { BaseMongoSdk, BaseMongoSdkPrivateConfig } from '@xyo-network/sdk-xyo-mongo-js'\nimport { Document } from 'mongodb'\n\nimport { getMongoDBConfig } from './getMongoDBConfig'\n\nexport const getBaseMongoSdkPrivateConfig = (): BaseMongoSdkPrivateConfig => {\n const env = getMongoDBConfig()\n return {\n dbConnectionString: env.MONGO_CONNECTION_STRING,\n dbDomain: assertEx(env.MONGO_DOMAIN, 'Missing Mongo Domain'),\n dbName: assertEx(env.MONGO_DATABASE, 'Missing Mongo Database'),\n dbPassword: assertEx(env.MONGO_PASSWORD, 'Missing Mongo Password'),\n dbUserName: assertEx(env.MONGO_USERNAME, 'Missing Mongo Username'),\n }\n}\n\nexport const getBaseMongoSdk = <T extends Document>(collection: string) => {\n return new BaseMongoSdk<T>({ ...getBaseMongoSdkPrivateConfig(), collection })\n}\n","export type MongoDbConnectionStringEnvVar = 'MONGO_CONNECTION_STRING'\nexport type MongoDbEnvVars = 'MONGO_DATABASE' | 'MONGO_DOMAIN' | 'MONGO_PASSWORD' | 'MONGO_USERNAME'\n\nexport type MongoEnv = Record<MongoDbEnvVars | MongoDbConnectionStringEnvVar, string | undefined>\n\nexport const getMongoDBConfig = (): MongoEnv => {\n const env: MongoEnv = {} as MongoEnv\n if (process.env.MONGO_CONNECTION_STRING) {\n env.MONGO_CONNECTION_STRING = process.env.MONGO_CONNECTION_STRING\n }\n if (process.env.MONGO_DOMAIN) {\n env.MONGO_DATABASE = process.env.MONGO_DATABASE\n env.MONGO_DOMAIN = process.env.MONGO_DOMAIN\n env.MONGO_PASSWORD = process.env.MONGO_PASSWORD\n env.MONGO_USERNAME = process.env.MONGO_USERNAME\n }\n return env\n}\n","import { exists } from '@xylabs/exists'\n\nimport { getMongoDBConfig } from './getMongoDBConfig'\n\nexport const hasMongoDBConfig = (): boolean => {\n const env = getMongoDBConfig()\n const requiredValues = [env.MONGO_CONNECTION_STRING, env.MONGO_DATABASE, env.MONGO_DOMAIN, env.MONGO_PASSWORD, env.MONGO_USERNAME]\n return requiredValues.every(exists)\n}\n","export const DATABASES = {\n Archivist: 'archivist' as const,\n}\n","export const DefaultAggregateTimeoutMs = 10_000\nexport const DefaultLimit = 20\nexport const DefaultMaxTimeMS = 2000\nexport const DefaultOrder = 'desc'\n","import { assertEx } from '@xylabs/assert'\nimport { merge } from '@xylabs/lodash'\nimport { staticImplements } from '@xylabs/static-implements'\nimport { Module } from '@xyo-network/module-model'\nimport { MongoDBModule, MongoDBModuleParams, MongoDBModuleStatic, MongoDBStorageClassLabels } from '@xyo-network/module-model-mongodb'\nimport { BoundWitnessWithMongoMeta, PayloadWithMongoMeta } from '@xyo-network/payload-mongodb'\nimport { BaseMongoSdk, BaseMongoSdkConfig } from '@xyo-network/sdk-xyo-mongo-js'\nimport { MongoServerError } from 'mongodb'\n\nimport { COLLECTIONS } from './Collections'\nimport { getBaseMongoSdkPrivateConfig } from './config'\nimport { IndexDescription } from './IndexDescription'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyAbstractModule<TParams extends MongoDBModuleParams = MongoDBModuleParams> = abstract new (...args: any[]) => Module<TParams>\n\nexport const MongoDBModuleMixin = <\n TParams extends MongoDBModuleParams = MongoDBModuleParams,\n TModule extends AnyAbstractModule<TParams> = AnyAbstractModule<TParams>,\n>(\n ModuleBase: TModule,\n) => {\n @staticImplements<MongoDBModuleStatic>()\n abstract class MongoModuleBase extends ModuleBase implements MongoDBModule {\n static labels = MongoDBStorageClassLabels\n _boundWitnessSdk: BaseMongoSdk<BoundWitnessWithMongoMeta> | undefined\n _payloadSdk: BaseMongoSdk<PayloadWithMongoMeta> | undefined\n\n get boundWitnessSdkConfig(): BaseMongoSdkConfig {\n const config = { collection: COLLECTIONS.BoundWitnesses, ...getBaseMongoSdkPrivateConfig() }\n return merge(config, this.params.boundWitnessSdkConfig, this.config.boundWitnessSdkConfig, {\n collection: this.config.boundWitnessSdkConfig?.collection ?? this.params.boundWitnessSdkConfig?.collection ?? COLLECTIONS.BoundWitnesses,\n })\n }\n\n get boundWitnesses() {\n this._boundWitnessSdk = this._boundWitnessSdk ?? new BaseMongoSdk<BoundWitnessWithMongoMeta>(this.boundWitnessSdkConfig)\n return assertEx(this._boundWitnessSdk)\n }\n\n get jobQueue() {\n return assertEx(this.params.jobQueue, 'MongoDBModule Error: jobQueue required for this module but is not defined')\n }\n\n get payloadSdkConfig(): BaseMongoSdkConfig {\n const config = { collection: COLLECTIONS.Payloads, ...getBaseMongoSdkPrivateConfig() }\n return merge(config, this.params.payloadSdkConfig, this.config.payloadSdkConfig, {\n collection: this.config.payloadSdkConfig?.collection ?? this.params.payloadSdkConfig?.collection ?? COLLECTIONS.Payloads,\n })\n }\n\n get payloads() {\n this._payloadSdk = this._payloadSdk ?? new BaseMongoSdk<PayloadWithMongoMeta>(this.payloadSdkConfig)\n return assertEx(this._payloadSdk)\n }\n\n /**\n * Ensures any indexes specified within the config are created. This method should be idempotent\n * allowing for multiple calls without causing errors while ensuring the desired state.\n */\n async ensureIndexes(): Promise<void> {\n const configIndexes = (this.config as { storage?: { indexes?: IndexDescription[] } })?.storage?.indexes ?? []\n await ensureIndexesExistOnCollection(this.boundWitnesses, configIndexes)\n await ensureIndexesExistOnCollection(this.payloads, configIndexes)\n }\n }\n return MongoModuleBase\n}\n\n/**\n * Ensures the specified indexes exist on the collection\n * @param sdk The sdk to use for the collection\n * @param configIndexes The indexes to ensure exist on the collection\n */\nconst ensureIndexesExistOnCollection = async (\n sdk: BaseMongoSdk<PayloadWithMongoMeta> | BaseMongoSdk<BoundWitnessWithMongoMeta>,\n configIndexes: IndexDescription[],\n) => {\n await sdk.useCollection(async (collection) => {\n const collectionName = collection.collectionName.toLowerCase()\n const indexes = configIndexes.filter((ix) => ix?.name?.toLowerCase().startsWith(collectionName))\n if (indexes.length === 0) return\n for (const ix of indexes) {\n try {\n await collection.createIndexes([ix])\n } catch (error) {\n const mongoServerError = error as MongoServerError\n const { codeName } = mongoServerError\n if (codeName === 'IndexKeySpecsConflict' || codeName === 'IndexOptionsConflict') {\n // Index already exists which is fine OR index exists with another name which is fine\n // TODO: For the latter case (IndexOptionsConflict) we could get into this case\n // if we change the TTL an existing index. We currently don't support TTLs so\n // we'll need to revisit this assumption if we do.\n continue\n }\n console.error(`Error creating index ${ix.name} for collection ${collectionName}: ${error}`)\n throw error\n }\n }\n })\n}\n","export const escapeChar = '#'\n\nexport const toDbProperty = (value: string) => value.replaceAll('.', escapeChar)\n\nexport const fromDbProperty = (value: string) => value.replaceAll(escapeChar, '.')\n","import { Payload } from '@xyo-network/payload-model'\nimport { OptionalId, WithId, WithoutId } from 'mongodb'\n\nexport const removeId = <T extends Payload = Payload>(payload: T | WithId<T> | WithoutId<T> | OptionalId<T>): WithoutId<T> => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { _id, ...withoutId } = payload as OptionalId<T>\n return withoutId as WithoutId<T>\n}\n"],"mappings":"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","names":["COLLECTIONS","AddressInfo","ArchivistStats","BoundWitnesses","Payloads","Thumbnails","Users","getMongoDBConfig","env","process","MONGO_CONNECTION_STRING","MONGO_DOMAIN","MONGO_DATABASE","MONGO_PASSWORD","MONGO_USERNAME","getBaseMongoSdkPrivateConfig","env","getMongoDBConfig","dbConnectionString","MONGO_CONNECTION_STRING","dbDomain","assertEx","MONGO_DOMAIN","dbName","MONGO_DATABASE","dbPassword","MONGO_PASSWORD","dbUserName","MONGO_USERNAME","getBaseMongoSdk","collection","BaseMongoSdk","hasMongoDBConfig","env","getMongoDBConfig","requiredValues","MONGO_CONNECTION_STRING","MONGO_DATABASE","MONGO_DOMAIN","MONGO_PASSWORD","MONGO_USERNAME","every","exists","DATABASES","Archivist","DefaultAggregateTimeoutMs","DefaultLimit","DefaultMaxTimeMS","DefaultOrder","import_assert","import_sdk_xyo_mongo_js","MongoDBModuleMixin","ModuleBase","MongoModuleBase","_boundWitnessSdk","_payloadSdk","boundWitnessSdkConfig","config","collection","COLLECTIONS","BoundWitnesses","getBaseMongoSdkPrivateConfig","merge","params","_a","boundWitnesses","BaseMongoSdk","assertEx","jobQueue","payloadSdkConfig","Payloads","payloads","ensureIndexes","configIndexes","storage","indexes","ensureIndexesExistOnCollection","labels","MongoDBStorageClassLabels","staticImplements","sdk","useCollection","collectionName","toLowerCase","filter","ix","name","startsWith","length","createIndexes","error","mongoServerError","codeName","console","escapeChar","toDbProperty","value","replaceAll","fromDbProperty","removeId","payload","_id","withoutId"]}
|