@rpcbase/db 0.122.0 → 0.124.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.
package/dist/model.js CHANGED
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=model.js.map
@@ -41,49 +41,361 @@ export declare const ZRBTenantSubscriptionChangeDirection: z.ZodEnum<{
41
41
  downgrade: "downgrade";
42
42
  lateral: "lateral";
43
43
  }>;
44
- export declare const ZRBTenantSubscriptionEvent: z.ZodObject<{
44
+ export declare const ZRBTenantSubscriptionEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
45
45
  tenantId: z.ZodString;
46
46
  subscriptionId: z.ZodString;
47
- type: z.ZodEnum<{
47
+ occurredAt: z.ZodDate;
48
+ effectiveAt: z.ZodDate;
49
+ subscriptionType: z.ZodEnum<{
50
+ primary: "primary";
51
+ addon: "addon";
52
+ }>;
53
+ parentSubscriptionId: z.ZodOptional<z.ZodString>;
54
+ scope: z.ZodEnum<{
55
+ custom: "custom";
56
+ tenant: "tenant";
57
+ workspace: "workspace";
58
+ shop: "shop";
59
+ }>;
60
+ scopeId: z.ZodOptional<z.ZodString>;
61
+ fromPlanKey: z.ZodOptional<z.ZodString>;
62
+ fromStatus: z.ZodOptional<z.ZodEnum<{
63
+ trialing: "trialing";
64
+ active: "active";
65
+ past_due: "past_due";
66
+ paused: "paused";
67
+ canceled: "canceled";
68
+ expired: "expired";
69
+ }>>;
70
+ fromModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
+ fromIntervalUnit: z.ZodOptional<z.ZodEnum<{
72
+ month: "month";
73
+ year: "year";
74
+ }>>;
75
+ fromIntervalCount: z.ZodOptional<z.ZodNumber>;
76
+ fromPriceId: z.ZodOptional<z.ZodString>;
77
+ toPriceId: z.ZodOptional<z.ZodString>;
78
+ supersedesEventId: z.ZodOptional<z.ZodString>;
79
+ idempotencyKey: z.ZodString;
80
+ direction: z.ZodOptional<z.ZodEnum<{
81
+ upgrade: "upgrade";
82
+ downgrade: "downgrade";
83
+ lateral: "lateral";
84
+ }>>;
85
+ actorUserId: z.ZodOptional<z.ZodString>;
86
+ source: z.ZodOptional<z.ZodEnum<{
87
+ admin: "admin";
88
+ user: "user";
89
+ system: "system";
90
+ webhook: "webhook";
91
+ }>>;
92
+ reason: z.ZodOptional<z.ZodString>;
93
+ provider: z.ZodOptional<z.ZodString>;
94
+ providerEventId: z.ZodOptional<z.ZodString>;
95
+ providerPayload: z.ZodOptional<z.ZodUnknown>;
96
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
97
+ type: z.ZodLiteral<"created">;
98
+ toPlanKey: z.ZodString;
99
+ toStatus: z.ZodEnum<{
100
+ trialing: "trialing";
101
+ active: "active";
102
+ past_due: "past_due";
103
+ paused: "paused";
48
104
  canceled: "canceled";
49
- created: "created";
50
- plan_changed: "plan_changed";
51
- status_changed: "status_changed";
52
- resumed: "resumed";
53
- renewed: "renewed";
105
+ expired: "expired";
54
106
  }>;
107
+ toModules: z.ZodArray<z.ZodString>;
108
+ toIntervalUnit: z.ZodEnum<{
109
+ month: "month";
110
+ year: "year";
111
+ }>;
112
+ toIntervalCount: z.ZodNumber;
113
+ billingAnchor: z.ZodDate;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ tenantId: z.ZodString;
116
+ subscriptionId: z.ZodString;
55
117
  occurredAt: z.ZodDate;
56
118
  effectiveAt: z.ZodDate;
57
- subscriptionType: z.ZodOptional<z.ZodEnum<{
119
+ subscriptionType: z.ZodEnum<{
58
120
  primary: "primary";
59
121
  addon: "addon";
60
- }>>;
122
+ }>;
61
123
  parentSubscriptionId: z.ZodOptional<z.ZodString>;
62
- scope: z.ZodOptional<z.ZodEnum<{
124
+ scope: z.ZodEnum<{
63
125
  custom: "custom";
64
126
  tenant: "tenant";
65
127
  workspace: "workspace";
66
128
  shop: "shop";
129
+ }>;
130
+ scopeId: z.ZodOptional<z.ZodString>;
131
+ fromStatus: z.ZodOptional<z.ZodEnum<{
132
+ trialing: "trialing";
133
+ active: "active";
134
+ past_due: "past_due";
135
+ paused: "paused";
136
+ canceled: "canceled";
137
+ expired: "expired";
67
138
  }>>;
139
+ toStatus: z.ZodOptional<z.ZodEnum<{
140
+ trialing: "trialing";
141
+ active: "active";
142
+ past_due: "past_due";
143
+ paused: "paused";
144
+ canceled: "canceled";
145
+ expired: "expired";
146
+ }>>;
147
+ fromPriceId: z.ZodOptional<z.ZodString>;
148
+ toPriceId: z.ZodOptional<z.ZodString>;
149
+ billingAnchor: z.ZodOptional<z.ZodDate>;
150
+ supersedesEventId: z.ZodOptional<z.ZodString>;
151
+ idempotencyKey: z.ZodString;
152
+ direction: z.ZodOptional<z.ZodEnum<{
153
+ upgrade: "upgrade";
154
+ downgrade: "downgrade";
155
+ lateral: "lateral";
156
+ }>>;
157
+ actorUserId: z.ZodOptional<z.ZodString>;
158
+ source: z.ZodOptional<z.ZodEnum<{
159
+ admin: "admin";
160
+ user: "user";
161
+ system: "system";
162
+ webhook: "webhook";
163
+ }>>;
164
+ reason: z.ZodOptional<z.ZodString>;
165
+ provider: z.ZodOptional<z.ZodString>;
166
+ providerEventId: z.ZodOptional<z.ZodString>;
167
+ providerPayload: z.ZodOptional<z.ZodUnknown>;
168
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
169
+ type: z.ZodLiteral<"plan_changed">;
170
+ fromPlanKey: z.ZodString;
171
+ toPlanKey: z.ZodString;
172
+ fromModules: z.ZodArray<z.ZodString>;
173
+ toModules: z.ZodArray<z.ZodString>;
174
+ fromIntervalUnit: z.ZodEnum<{
175
+ month: "month";
176
+ year: "year";
177
+ }>;
178
+ toIntervalUnit: z.ZodEnum<{
179
+ month: "month";
180
+ year: "year";
181
+ }>;
182
+ fromIntervalCount: z.ZodNumber;
183
+ toIntervalCount: z.ZodNumber;
184
+ }, z.core.$strip>, z.ZodObject<{
185
+ tenantId: z.ZodString;
186
+ subscriptionId: z.ZodString;
187
+ occurredAt: z.ZodDate;
188
+ effectiveAt: z.ZodDate;
189
+ subscriptionType: z.ZodEnum<{
190
+ primary: "primary";
191
+ addon: "addon";
192
+ }>;
193
+ parentSubscriptionId: z.ZodOptional<z.ZodString>;
194
+ scope: z.ZodEnum<{
195
+ custom: "custom";
196
+ tenant: "tenant";
197
+ workspace: "workspace";
198
+ shop: "shop";
199
+ }>;
68
200
  scopeId: z.ZodOptional<z.ZodString>;
69
201
  fromPlanKey: z.ZodOptional<z.ZodString>;
70
202
  toPlanKey: z.ZodOptional<z.ZodString>;
71
- fromStatus: z.ZodOptional<z.ZodEnum<{
203
+ fromModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
+ toModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
205
+ fromIntervalUnit: z.ZodOptional<z.ZodEnum<{
206
+ month: "month";
207
+ year: "year";
208
+ }>>;
209
+ toIntervalUnit: z.ZodOptional<z.ZodEnum<{
210
+ month: "month";
211
+ year: "year";
212
+ }>>;
213
+ fromIntervalCount: z.ZodOptional<z.ZodNumber>;
214
+ toIntervalCount: z.ZodOptional<z.ZodNumber>;
215
+ fromPriceId: z.ZodOptional<z.ZodString>;
216
+ toPriceId: z.ZodOptional<z.ZodString>;
217
+ billingAnchor: z.ZodOptional<z.ZodDate>;
218
+ supersedesEventId: z.ZodOptional<z.ZodString>;
219
+ idempotencyKey: z.ZodString;
220
+ direction: z.ZodOptional<z.ZodEnum<{
221
+ upgrade: "upgrade";
222
+ downgrade: "downgrade";
223
+ lateral: "lateral";
224
+ }>>;
225
+ actorUserId: z.ZodOptional<z.ZodString>;
226
+ source: z.ZodOptional<z.ZodEnum<{
227
+ admin: "admin";
228
+ user: "user";
229
+ system: "system";
230
+ webhook: "webhook";
231
+ }>>;
232
+ reason: z.ZodOptional<z.ZodString>;
233
+ provider: z.ZodOptional<z.ZodString>;
234
+ providerEventId: z.ZodOptional<z.ZodString>;
235
+ providerPayload: z.ZodOptional<z.ZodUnknown>;
236
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
237
+ type: z.ZodLiteral<"status_changed">;
238
+ fromStatus: z.ZodEnum<{
239
+ trialing: "trialing";
240
+ active: "active";
241
+ past_due: "past_due";
242
+ paused: "paused";
243
+ canceled: "canceled";
244
+ expired: "expired";
245
+ }>;
246
+ toStatus: z.ZodEnum<{
72
247
  trialing: "trialing";
73
248
  active: "active";
74
249
  past_due: "past_due";
75
250
  paused: "paused";
76
251
  canceled: "canceled";
77
252
  expired: "expired";
253
+ }>;
254
+ }, z.core.$strip>, z.ZodObject<{
255
+ tenantId: z.ZodString;
256
+ subscriptionId: z.ZodString;
257
+ occurredAt: z.ZodDate;
258
+ effectiveAt: z.ZodDate;
259
+ subscriptionType: z.ZodEnum<{
260
+ primary: "primary";
261
+ addon: "addon";
262
+ }>;
263
+ parentSubscriptionId: z.ZodOptional<z.ZodString>;
264
+ scope: z.ZodEnum<{
265
+ custom: "custom";
266
+ tenant: "tenant";
267
+ workspace: "workspace";
268
+ shop: "shop";
269
+ }>;
270
+ scopeId: z.ZodOptional<z.ZodString>;
271
+ fromPlanKey: z.ZodOptional<z.ZodString>;
272
+ toPlanKey: z.ZodOptional<z.ZodString>;
273
+ fromModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
274
+ toModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
275
+ fromIntervalUnit: z.ZodOptional<z.ZodEnum<{
276
+ month: "month";
277
+ year: "year";
78
278
  }>>;
79
- toStatus: z.ZodOptional<z.ZodEnum<{
279
+ toIntervalUnit: z.ZodOptional<z.ZodEnum<{
280
+ month: "month";
281
+ year: "year";
282
+ }>>;
283
+ fromIntervalCount: z.ZodOptional<z.ZodNumber>;
284
+ toIntervalCount: z.ZodOptional<z.ZodNumber>;
285
+ fromPriceId: z.ZodOptional<z.ZodString>;
286
+ toPriceId: z.ZodOptional<z.ZodString>;
287
+ billingAnchor: z.ZodOptional<z.ZodDate>;
288
+ supersedesEventId: z.ZodOptional<z.ZodString>;
289
+ idempotencyKey: z.ZodString;
290
+ direction: z.ZodOptional<z.ZodEnum<{
291
+ upgrade: "upgrade";
292
+ downgrade: "downgrade";
293
+ lateral: "lateral";
294
+ }>>;
295
+ actorUserId: z.ZodOptional<z.ZodString>;
296
+ source: z.ZodOptional<z.ZodEnum<{
297
+ admin: "admin";
298
+ user: "user";
299
+ system: "system";
300
+ webhook: "webhook";
301
+ }>>;
302
+ reason: z.ZodOptional<z.ZodString>;
303
+ provider: z.ZodOptional<z.ZodString>;
304
+ providerEventId: z.ZodOptional<z.ZodString>;
305
+ providerPayload: z.ZodOptional<z.ZodUnknown>;
306
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
307
+ type: z.ZodLiteral<"resumed">;
308
+ fromStatus: z.ZodEnum<{
80
309
  trialing: "trialing";
81
310
  active: "active";
82
311
  past_due: "past_due";
83
312
  paused: "paused";
84
313
  canceled: "canceled";
85
314
  expired: "expired";
315
+ }>;
316
+ toStatus: z.ZodLiteral<"active">;
317
+ }, z.core.$strip>, z.ZodObject<{
318
+ tenantId: z.ZodString;
319
+ subscriptionId: z.ZodString;
320
+ occurredAt: z.ZodDate;
321
+ effectiveAt: z.ZodDate;
322
+ subscriptionType: z.ZodEnum<{
323
+ primary: "primary";
324
+ addon: "addon";
325
+ }>;
326
+ parentSubscriptionId: z.ZodOptional<z.ZodString>;
327
+ scope: z.ZodEnum<{
328
+ custom: "custom";
329
+ tenant: "tenant";
330
+ workspace: "workspace";
331
+ shop: "shop";
332
+ }>;
333
+ scopeId: z.ZodOptional<z.ZodString>;
334
+ fromPlanKey: z.ZodOptional<z.ZodString>;
335
+ toPlanKey: z.ZodOptional<z.ZodString>;
336
+ fromModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
337
+ toModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
338
+ fromIntervalUnit: z.ZodOptional<z.ZodEnum<{
339
+ month: "month";
340
+ year: "year";
86
341
  }>>;
342
+ toIntervalUnit: z.ZodOptional<z.ZodEnum<{
343
+ month: "month";
344
+ year: "year";
345
+ }>>;
346
+ fromIntervalCount: z.ZodOptional<z.ZodNumber>;
347
+ toIntervalCount: z.ZodOptional<z.ZodNumber>;
348
+ fromPriceId: z.ZodOptional<z.ZodString>;
349
+ toPriceId: z.ZodOptional<z.ZodString>;
350
+ billingAnchor: z.ZodOptional<z.ZodDate>;
351
+ supersedesEventId: z.ZodOptional<z.ZodString>;
352
+ idempotencyKey: z.ZodString;
353
+ direction: z.ZodOptional<z.ZodEnum<{
354
+ upgrade: "upgrade";
355
+ downgrade: "downgrade";
356
+ lateral: "lateral";
357
+ }>>;
358
+ actorUserId: z.ZodOptional<z.ZodString>;
359
+ source: z.ZodOptional<z.ZodEnum<{
360
+ admin: "admin";
361
+ user: "user";
362
+ system: "system";
363
+ webhook: "webhook";
364
+ }>>;
365
+ reason: z.ZodOptional<z.ZodString>;
366
+ provider: z.ZodOptional<z.ZodString>;
367
+ providerEventId: z.ZodOptional<z.ZodString>;
368
+ providerPayload: z.ZodOptional<z.ZodUnknown>;
369
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
370
+ type: z.ZodLiteral<"canceled">;
371
+ fromStatus: z.ZodEnum<{
372
+ trialing: "trialing";
373
+ active: "active";
374
+ past_due: "past_due";
375
+ paused: "paused";
376
+ canceled: "canceled";
377
+ expired: "expired";
378
+ }>;
379
+ toStatus: z.ZodLiteral<"canceled">;
380
+ }, z.core.$strip>, z.ZodObject<{
381
+ tenantId: z.ZodString;
382
+ subscriptionId: z.ZodString;
383
+ occurredAt: z.ZodDate;
384
+ effectiveAt: z.ZodDate;
385
+ subscriptionType: z.ZodEnum<{
386
+ primary: "primary";
387
+ addon: "addon";
388
+ }>;
389
+ parentSubscriptionId: z.ZodOptional<z.ZodString>;
390
+ scope: z.ZodEnum<{
391
+ custom: "custom";
392
+ tenant: "tenant";
393
+ workspace: "workspace";
394
+ shop: "shop";
395
+ }>;
396
+ scopeId: z.ZodOptional<z.ZodString>;
397
+ fromPlanKey: z.ZodOptional<z.ZodString>;
398
+ toPlanKey: z.ZodOptional<z.ZodString>;
87
399
  fromModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
400
  toModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
89
401
  fromIntervalUnit: z.ZodOptional<z.ZodEnum<{
@@ -100,7 +412,7 @@ export declare const ZRBTenantSubscriptionEvent: z.ZodObject<{
100
412
  toPriceId: z.ZodOptional<z.ZodString>;
101
413
  billingAnchor: z.ZodOptional<z.ZodDate>;
102
414
  supersedesEventId: z.ZodOptional<z.ZodString>;
103
- idempotencyKey: z.ZodOptional<z.ZodString>;
415
+ idempotencyKey: z.ZodString;
104
416
  direction: z.ZodOptional<z.ZodEnum<{
105
417
  upgrade: "upgrade";
106
418
  downgrade: "downgrade";
@@ -118,7 +430,24 @@ export declare const ZRBTenantSubscriptionEvent: z.ZodObject<{
118
430
  providerEventId: z.ZodOptional<z.ZodString>;
119
431
  providerPayload: z.ZodOptional<z.ZodUnknown>;
120
432
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
121
- }, z.core.$strip>;
433
+ type: z.ZodLiteral<"renewed">;
434
+ fromStatus: z.ZodEnum<{
435
+ trialing: "trialing";
436
+ active: "active";
437
+ past_due: "past_due";
438
+ paused: "paused";
439
+ canceled: "canceled";
440
+ expired: "expired";
441
+ }>;
442
+ toStatus: z.ZodEnum<{
443
+ trialing: "trialing";
444
+ active: "active";
445
+ past_due: "past_due";
446
+ paused: "paused";
447
+ canceled: "canceled";
448
+ expired: "expired";
449
+ }>;
450
+ }, z.core.$strip>], "type">;
122
451
  export type IRBTenantSubscriptionEvent = z.infer<typeof ZRBTenantSubscriptionEvent>;
123
452
  export declare const RBTenantSubscriptionEventSchema: Schema;
124
453
  //# sourceMappingURL=RBTenantSubscriptionEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RBTenantSubscriptionEvent.d.ts","sourceRoot":"","sources":["../../src/models/RBTenantSubscriptionEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,2BAA2B;;;;;;;EAAgC,CAAA;AAExE,eAAO,MAAM,iCAAiC;;;EAAsC,CAAA;AAEpF,eAAO,MAAM,yBAAyB;;;EAA6B,CAAA;AAEnE,eAAO,MAAM,0BAA0B;;;;;EAA8B,CAAA;AAErE,eAAO,MAAM,8BAA8B;;;;;;;EAAmC,CAAA;AAG9E,eAAO,MAAM,gCAAgC;;;;;EAK3C,CAAA;AAEF,eAAO,MAAM,oCAAoC;;;;EAI/C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiCrC,CAAA;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEnF,eAAO,MAAM,+BAA+B,EAAE,MAmC7C,CAAA"}
1
+ {"version":3,"file":"RBTenantSubscriptionEvent.d.ts","sourceRoot":"","sources":["../../src/models/RBTenantSubscriptionEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,eAAO,MAAM,2BAA2B;;;;;;;EAAgC,CAAA;AAExE,eAAO,MAAM,iCAAiC;;;EAAsC,CAAA;AAEpF,eAAO,MAAM,yBAAyB;;;EAA6B,CAAA;AAEnE,eAAO,MAAM,0BAA0B;;;;;EAA8B,CAAA;AAErE,eAAO,MAAM,8BAA8B;;;;;;;EAAmC,CAAA;AAG9E,eAAO,MAAM,gCAAgC;;;;;EAK3C,CAAA;AAEF,eAAO,MAAM,oCAAoC;;;;EAAyC,CAAA;AAkF1F,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAsBrC,CAAA;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAanF,eAAO,MAAM,+BAA+B,EAAE,MA6D7C,CAAA"}
package/dist/mongo.js CHANGED
@@ -1,24 +1,36 @@
1
- const parseMongoDirectConnectionOverride = (env = process.env) => {
2
- const rawValue = env.RB_MONGO_DIRECT_CONNECTION ?? env.MONGO_DIRECT_CONNECTION;
3
- if (typeof rawValue !== "string") return null;
4
- const value = rawValue.trim().toLowerCase();
5
- if (["1", "true", "yes", "on"].includes(value)) return true;
6
- if (["0", "false", "no", "off"].includes(value)) return false;
7
- return null;
1
+ //#region src/getMongoUrl.ts
2
+ var parseMongoDirectConnectionOverride = (env = process.env) => {
3
+ const rawValue = env.RB_MONGO_DIRECT_CONNECTION ?? env.MONGO_DIRECT_CONNECTION;
4
+ if (typeof rawValue !== "string") return null;
5
+ const value = rawValue.trim().toLowerCase();
6
+ if ([
7
+ "1",
8
+ "true",
9
+ "yes",
10
+ "on"
11
+ ].includes(value)) return true;
12
+ if ([
13
+ "0",
14
+ "false",
15
+ "no",
16
+ "off"
17
+ ].includes(value)) return false;
18
+ return null;
8
19
  };
9
- const getMongoDirectConnection = (env = process.env) => parseMongoDirectConnectionOverride(env) ?? ["", "localhost", "127.0.0.1", "::1"].includes((env.DB_HOST ?? "").trim().toLowerCase());
10
- const getMongoUrl = (env = process.env, options = {}) => {
11
- const port = env.DB_PORT?.trim();
12
- if (!port) {
13
- throw new Error("Missing DB_PORT (required to build MongoDB connection URL)");
14
- }
15
- const host = env.DB_HOST?.trim() || "localhost";
16
- const baseUrl = `mongodb://${host}:${port}`;
17
- const dbName = options.dbName?.trim();
18
- return dbName ? `${baseUrl}/${dbName}` : baseUrl;
20
+ var getMongoDirectConnection = (env = process.env) => parseMongoDirectConnectionOverride(env) ?? [
21
+ "",
22
+ "localhost",
23
+ "127.0.0.1",
24
+ "::1"
25
+ ].includes((env.DB_HOST ?? "").trim().toLowerCase());
26
+ var getMongoUrl = (env = process.env, options = {}) => {
27
+ const port = env.DB_PORT?.trim();
28
+ if (!port) throw new Error("Missing DB_PORT (required to build MongoDB connection URL)");
29
+ const baseUrl = `mongodb://${env.DB_HOST?.trim() || "localhost"}:${port}`;
30
+ const dbName = options.dbName?.trim();
31
+ return dbName ? `${baseUrl}/${dbName}` : baseUrl;
19
32
  };
20
- export {
21
- getMongoDirectConnection,
22
- getMongoUrl
23
- };
24
- //# sourceMappingURL=mongo.js.map
33
+ //#endregion
34
+ export { getMongoDirectConnection, getMongoUrl };
35
+
36
+ //# sourceMappingURL=mongo.js.map
package/dist/mongo.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mongo.js","sources":["../src/getMongoUrl.ts"],"sourcesContent":["type EnvRecord = { [key: string]: string | undefined }\n\ntype MongoUrlOptions = {\n dbName?: string\n}\n\nconst parseMongoDirectConnectionOverride = (env: EnvRecord = process.env): boolean | null => {\n const rawValue = env.RB_MONGO_DIRECT_CONNECTION ?? env.MONGO_DIRECT_CONNECTION\n if (typeof rawValue !== \"string\") return null\n\n const value = rawValue.trim().toLowerCase()\n if ([\"1\", \"true\", \"yes\", \"on\"].includes(value)) return true\n if ([\"0\", \"false\", \"no\", \"off\"].includes(value)) return false\n return null\n}\n\nexport const getMongoDirectConnection = (env: EnvRecord = process.env): boolean =>\n parseMongoDirectConnectionOverride(env) ??\n [\"\", \"localhost\", \"127.0.0.1\", \"::1\"].includes((env.DB_HOST ?? \"\").trim().toLowerCase())\n\nexport const getMongoUrl = (env: EnvRecord = process.env, options: MongoUrlOptions = {}): string => {\n const port = env.DB_PORT?.trim()\n if (!port) {\n throw new Error(\"Missing DB_PORT (required to build MongoDB connection URL)\")\n }\n\n const host = env.DB_HOST?.trim() || \"localhost\"\n const baseUrl = `mongodb://${host}:${port}`\n const dbName = options.dbName?.trim()\n\n return dbName ? `${baseUrl}/${dbName}` : baseUrl\n}\n"],"names":["parseMongoDirectConnectionOverride","env","process","rawValue","RB_MONGO_DIRECT_CONNECTION","MONGO_DIRECT_CONNECTION","value","trim","toLowerCase","includes","getMongoDirectConnection","DB_HOST","getMongoUrl","options","port","DB_PORT","Error","host","baseUrl","dbName"],"mappings":"AAMA,MAAMA,qCAAqCA,CAACC,MAAiBC,QAAQD,QAAwB;AAC3F,QAAME,WAAWF,IAAIG,8BAA8BH,IAAII;AACvD,MAAI,OAAOF,aAAa,SAAU,QAAO;AAEzC,QAAMG,QAAQH,SAASI,KAAAA,EAAOC,YAAAA;AAC9B,MAAI,CAAC,KAAK,QAAQ,OAAO,IAAI,EAAEC,SAASH,KAAK,EAAG,QAAO;AACvD,MAAI,CAAC,KAAK,SAAS,MAAM,KAAK,EAAEG,SAASH,KAAK,EAAG,QAAO;AACxD,SAAO;AACT;AAEO,MAAMI,2BAA2BA,CAACT,MAAiBC,QAAQD,QAChED,mCAAmCC,GAAG,KACtC,CAAC,IAAI,aAAa,aAAa,KAAK,EAAEQ,UAAUR,IAAIU,WAAW,IAAIJ,KAAAA,EAAOC,YAAAA,CAAa;AAElF,MAAMI,cAAcA,CAACX,MAAiBC,QAAQD,KAAKY,UAA2B,CAAA,MAAe;AAClG,QAAMC,OAAOb,IAAIc,SAASR,KAAAA;AAC1B,MAAI,CAACO,MAAM;AACT,UAAM,IAAIE,MAAM,4DAA4D;AAAA,EAC9E;AAEA,QAAMC,OAAOhB,IAAIU,SAASJ,KAAAA,KAAU;AACpC,QAAMW,UAAU,aAAaD,IAAI,IAAIH,IAAI;AACzC,QAAMK,SAASN,QAAQM,QAAQZ,KAAAA;AAE/B,SAAOY,SAAS,GAAGD,OAAO,IAAIC,MAAM,KAAKD;AAC3C;"}
1
+ {"version":3,"file":"mongo.js","names":["EnvRecord","key","MongoUrlOptions","dbName","parseMongoDirectConnectionOverride","env","process","rawValue","RB_MONGO_DIRECT_CONNECTION","MONGO_DIRECT_CONNECTION","value","trim","toLowerCase","includes","getMongoDirectConnection","DB_HOST","getMongoUrl","options","port","DB_PORT","Error","host","baseUrl"],"sources":["../src/getMongoUrl.ts"],"sourcesContent":["type EnvRecord = { [key: string]: string | undefined }\n\ntype MongoUrlOptions = {\n dbName?: string\n}\n\nconst parseMongoDirectConnectionOverride = (env: EnvRecord = process.env): boolean | null => {\n const rawValue = env.RB_MONGO_DIRECT_CONNECTION ?? env.MONGO_DIRECT_CONNECTION\n if (typeof rawValue !== \"string\") return null\n\n const value = rawValue.trim().toLowerCase()\n if ([\"1\", \"true\", \"yes\", \"on\"].includes(value)) return true\n if ([\"0\", \"false\", \"no\", \"off\"].includes(value)) return false\n return null\n}\n\nexport const getMongoDirectConnection = (env: EnvRecord = process.env): boolean =>\n parseMongoDirectConnectionOverride(env) ??\n [\"\", \"localhost\", \"127.0.0.1\", \"::1\"].includes((env.DB_HOST ?? \"\").trim().toLowerCase())\n\nexport const getMongoUrl = (env: EnvRecord = process.env, options: MongoUrlOptions = {}): string => {\n const port = env.DB_PORT?.trim()\n if (!port) {\n throw new Error(\"Missing DB_PORT (required to build MongoDB connection URL)\")\n }\n\n const host = env.DB_HOST?.trim() || \"localhost\"\n const baseUrl = `mongodb://${host}:${port}`\n const dbName = options.dbName?.trim()\n\n return dbName ? `${baseUrl}/${dbName}` : baseUrl\n}\n"],"mappings":";AAMA,IAAMI,sCAAsCC,MAAiBC,QAAQD,QAAwB;CAC3F,MAAME,WAAWF,IAAIG,8BAA8BH,IAAII;CACvD,IAAI,OAAOF,aAAa,UAAU,OAAO;CAEzC,MAAMG,QAAQH,SAASI,KAAK,CAAC,CAACC,YAAY;CAC1C,IAAI;EAAC;EAAK;EAAQ;EAAO;CAAI,CAAC,CAACC,SAASH,KAAK,GAAG,OAAO;CACvD,IAAI;EAAC;EAAK;EAAS;EAAM;CAAK,CAAC,CAACG,SAASH,KAAK,GAAG,OAAO;CACxD,OAAO;AACT;AAEA,IAAaI,4BAA4BT,MAAiBC,QAAQD,QAChED,mCAAmCC,GAAG,KACtC;CAAC;CAAI;CAAa;CAAa;AAAK,CAAC,CAACQ,UAAUR,IAAIU,WAAW,GAAA,CAAIJ,KAAK,CAAC,CAACC,YAAY,CAAC;AAEzF,IAAaI,eAAeX,MAAiBC,QAAQD,KAAKY,UAA2B,CAAC,MAAc;CAClG,MAAMC,OAAOb,IAAIc,SAASR,KAAK;CAC/B,IAAI,CAACO,MACH,MAAM,IAAIE,MAAM,4DAA4D;CAI9E,MAAME,UAAU,aADHjB,IAAIU,SAASJ,KAAK,KAAK,YACH,GAAIO;CACrC,MAAMf,SAASc,QAAQd,QAAQQ,KAAK;CAEpC,OAAOR,SAAS,GAAGmB,QAAO,GAAInB,WAAWmB;AAC3C"}
@@ -0,0 +1,132 @@
1
+ import { z } from "zod";
2
+ //#region src/zod/localizedString.ts
3
+ var LANGUAGE_CODE_REGEX = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/;
4
+ var LOCALIZED_STRING_PROXY_CACHE = /* @__PURE__ */ new WeakMap();
5
+ function normalizeLocale(locale) {
6
+ const trimmed = locale.trim();
7
+ if (!trimmed) return "";
8
+ const getCanonicalLocales = Intl.getCanonicalLocales;
9
+ if (typeof getCanonicalLocales !== "function") return trimmed;
10
+ try {
11
+ return getCanonicalLocales(trimmed)[0] ?? trimmed;
12
+ } catch {
13
+ return trimmed;
14
+ }
15
+ }
16
+ function buildLocaleFallbackChain(locale, fallbacks) {
17
+ const base = locale.trim();
18
+ const canonical = normalizeLocale(base);
19
+ const extra = typeof fallbacks === "string" ? [fallbacks] : fallbacks ?? [];
20
+ const output = [];
21
+ const seen = /* @__PURE__ */ new Set();
22
+ const push = (value) => {
23
+ if (!value) return;
24
+ if (seen.has(value)) return;
25
+ seen.add(value);
26
+ output.push(value);
27
+ };
28
+ const addChain = (value) => {
29
+ if (!value) return;
30
+ const parts = value.split("-").filter(Boolean);
31
+ while (parts.length > 0) {
32
+ push(parts.join("-"));
33
+ parts.pop();
34
+ }
35
+ };
36
+ addChain(base);
37
+ addChain(canonical);
38
+ for (const fallback of extra) addChain(normalizeLocale(fallback));
39
+ return output;
40
+ }
41
+ function resolveLocalizedString(value, locale, options) {
42
+ return resolveLocalizedStringEntry(value, locale, options)?.value;
43
+ }
44
+ function resolveLocalizedStringEntry(value, locale, options) {
45
+ if (!value) return void 0;
46
+ const chain = buildLocaleFallbackChain(locale, options?.fallbacks);
47
+ if (chain.length === 0) return void 0;
48
+ const record = value;
49
+ for (const key of chain) {
50
+ if (!Object.prototype.hasOwnProperty.call(record, key)) continue;
51
+ return record[key];
52
+ }
53
+ }
54
+ function withLocalizedStringFallback(value) {
55
+ if (!value || typeof value !== "object" || Array.isArray(value)) return value;
56
+ if (value instanceof Map) return value;
57
+ const cached = LOCALIZED_STRING_PROXY_CACHE.get(value);
58
+ if (cached) return cached;
59
+ const proxy = withFallbackRecord(value);
60
+ LOCALIZED_STRING_PROXY_CACHE.set(value, proxy);
61
+ return proxy;
62
+ }
63
+ function withFallbackRecord(record) {
64
+ const getExact = (key) => {
65
+ if (!hasExact(key)) return void 0;
66
+ return record[key];
67
+ };
68
+ const hasExact = (key) => Object.prototype.hasOwnProperty.call(record, key);
69
+ return new Proxy(record, {
70
+ get(target, prop) {
71
+ if (prop === "getExact") return getExact;
72
+ if (prop === "hasExact") return hasExact;
73
+ if (prop === "get") return (key) => resolveLocalizedStringEntry(target, key);
74
+ if (typeof prop === "string" && !(prop in target)) return resolveLocalizedStringEntry(target, prop);
75
+ return Reflect.get(target, prop);
76
+ },
77
+ set(target, prop, next) {
78
+ return Reflect.set(target, prop, next);
79
+ }
80
+ });
81
+ }
82
+ var zLocalizedString = () => {
83
+ const languageCodeSchema = z.string().regex(LANGUAGE_CODE_REGEX, { message: "Expected a language code (BCP 47, e.g. en or fr-FR)." });
84
+ const entrySchema = z.object({
85
+ value: z.string(),
86
+ updatedAt: z.date(),
87
+ autoTranslated: z.boolean().optional()
88
+ }).passthrough();
89
+ return z.record(languageCodeSchema, entrySchema);
90
+ };
91
+ var zI18nString = zLocalizedString;
92
+ //#endregion
93
+ //#region src/zod/e164Phone.ts
94
+ var E164_PHONE_REGEX = /^\+[1-9]\d{1,14}$/;
95
+ var E164_PHONE_OR_EMPTY_REGEX = /^(?:\+[1-9]\d{1,14})?$/;
96
+ var makeZE164Phone = (zod, options) => {
97
+ const allowEmpty = options?.allowEmpty ?? false;
98
+ return zod.string().trim().regex(allowEmpty ? E164_PHONE_OR_EMPTY_REGEX : E164_PHONE_REGEX, { message: allowEmpty ? "Expected an empty string or a phone number in E.164 format (e.g. +33608707197)." : "Expected a phone number in E.164 format (e.g. +33608707197)." });
99
+ };
100
+ var zE164Phone = (options) => makeZE164Phone(z, options);
101
+ //#endregion
102
+ //#region src/zod/extension.ts
103
+ var zodPrototypesExtended = false;
104
+ function extendZod(zod) {
105
+ const zodWithExtension = zod;
106
+ if (Object.isExtensible(zodWithExtension) && typeof zodWithExtension.e164Phone !== "function") zodWithExtension.e164Phone = (options) => makeZE164Phone(zod, options);
107
+ if (zodPrototypesExtended) return;
108
+ zodPrototypesExtended = true;
109
+ const supported = [
110
+ zod.ZodString,
111
+ zod.ZodNumber,
112
+ zod.ZodDate
113
+ ];
114
+ for (const type of supported) {
115
+ const proto = type?.prototype;
116
+ if (!proto) continue;
117
+ proto.unique = function unique(_flag = true) {
118
+ return this;
119
+ };
120
+ proto.sparse = function sparse(_flag = true) {
121
+ return this;
122
+ };
123
+ }
124
+ }
125
+ //#endregion
126
+ //#region src/zod/index.ts
127
+ var z$1 = Object.create(z);
128
+ extendZod(z$1);
129
+ //#endregion
130
+ export { makeZE164Phone as a, buildLocaleFallbackChain as c, zI18nString as d, zLocalizedString as f, E164_PHONE_REGEX as i, resolveLocalizedString as l, extendZod as n, zE164Phone as o, E164_PHONE_OR_EMPTY_REGEX as r, LANGUAGE_CODE_REGEX as s, z$1 as t, withLocalizedStringFallback as u };
131
+
132
+ //# sourceMappingURL=zod-DSnhyNso.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-DSnhyNso.js","names":["z","LanguageCode","LocalizedStringEntry","Record","value","updatedAt","Date","autoTranslated","TExtra","LocalizedString","I18nStringRecord","I18nString","LocalizedStringWithFallback","get","key","getExact","hasExact","LANGUAGE_CODE_REGEX","LOCALIZED_STRING_PROXY_CACHE","WeakMap","normalizeLocale","locale","trimmed","trim","getCanonicalLocales","Intl","locales","buildLocaleFallbackChain","fallbacks","base","canonical","extra","output","seen","Set","push","has","add","addChain","parts","split","filter","Boolean","length","join","pop","fallback","resolveLocalizedString","options","resolveLocalizedStringEntry","undefined","chain","record","Object","prototype","hasOwnProperty","call","withLocalizedStringFallback","T","Array","isArray","Map","cached","proxy","withFallbackRecord","set","Proxy","target","prop","Reflect","next","zLocalizedString","languageCodeSchema","string","regex","message","entrySchema","object","date","boolean","optional","passthrough","schema","zI18nString","z","E164_PHONE_REGEX","E164_PHONE_OR_EMPTY_REGEX","E164PhoneOptions","allowEmpty","makeZE164Phone","zod","options","string","trim","regex","message","zE164Phone","z","E164PhoneOptions","makeZE164Phone","RpcbaseZodExtension","e164Phone","options","ZodString","ExtendableZodPrototype","unique","this","arg","sparse","ZodNumber","ZodDate","zodPrototypesExtended","extendZod","zod","zodWithExtension","Object","isExtensible","supported","const","type","proto","prototype","_flag","z","baseZ","ZodError","ZodString","ZodType","extendZod","RpcbaseZod","e164Phone","options","E164PhoneOptions","Object","create","infer","T","input","output","TypeOf","Infer"],"sources":["../src/zod/localizedString.ts","../src/zod/e164Phone.ts","../src/zod/extension.ts","../src/zod/index.ts"],"sourcesContent":["import { z } from \"zod\"\n\n\nexport type LanguageCode = string\n\nexport type LocalizedStringEntry<TExtra extends Record<string, unknown> = Record<string, unknown>> = {\n value: string\n updatedAt: Date\n autoTranslated?: boolean\n} & TExtra\n\nexport type LocalizedString<TExtra extends Record<string, unknown> = Record<string, unknown>> = Record<\n LanguageCode,\n LocalizedStringEntry<TExtra>\n>\n\nexport type I18nStringRecord = LocalizedString\n\nexport type I18nString = LocalizedString\n\nexport type LocalizedStringWithFallback = LocalizedString & {\n get: (key: string) => LocalizedStringEntry | undefined\n getExact: (key: string) => LocalizedStringEntry | undefined\n hasExact: (key: string) => boolean\n}\n\nexport const LANGUAGE_CODE_REGEX = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/\n\nconst LOCALIZED_STRING_PROXY_CACHE = new WeakMap<object, unknown>()\n\nfunction normalizeLocale(locale: string): string {\n const trimmed = locale.trim()\n if (!trimmed) return \"\"\n const getCanonicalLocales = (Intl as typeof Intl & {\n getCanonicalLocales?: (locales: string | readonly string[]) => string[]\n }).getCanonicalLocales\n if (typeof getCanonicalLocales !== \"function\") return trimmed\n try {\n return getCanonicalLocales(trimmed)[0] ?? trimmed\n } catch {\n return trimmed\n }\n}\n\nexport function buildLocaleFallbackChain(locale: string, fallbacks?: string | string[]): string[] {\n const base = locale.trim()\n const canonical = normalizeLocale(base)\n const extra = typeof fallbacks === \"string\" ? [fallbacks] : (fallbacks ?? [])\n\n const output: string[] = []\n const seen = new Set<string>()\n\n const push = (value: string) => {\n if (!value) return\n if (seen.has(value)) return\n seen.add(value)\n output.push(value)\n }\n\n const addChain = (value: string) => {\n if (!value) return\n const parts = value.split(\"-\").filter(Boolean)\n while (parts.length > 0) {\n push(parts.join(\"-\"))\n parts.pop()\n }\n }\n\n addChain(base)\n addChain(canonical)\n for (const fallback of extra) addChain(normalizeLocale(fallback))\n\n return output\n}\n\nexport function resolveLocalizedString(\n value: LocalizedString | null | undefined,\n locale: string,\n options?: { fallbacks?: string | string[] }\n): string | undefined {\n return resolveLocalizedStringEntry(value, locale, options)?.value\n}\n\nfunction resolveLocalizedStringEntry(\n value: LocalizedString | null | undefined,\n locale: string,\n options?: { fallbacks?: string | string[] }\n): LocalizedStringEntry | undefined {\n if (!value) return undefined\n const chain = buildLocaleFallbackChain(locale, options?.fallbacks)\n if (chain.length === 0) return undefined\n\n const record = value\n for (const key of chain) {\n if (!Object.prototype.hasOwnProperty.call(record, key)) continue\n return record[key] as LocalizedStringEntry\n }\n return undefined\n}\n\nexport function withLocalizedStringFallback<T>(value: T): T {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return value\n if (value instanceof Map) return value\n const cached = LOCALIZED_STRING_PROXY_CACHE.get(value)\n if (cached) return cached as T\n\n const proxy = withFallbackRecord(value as Record<string, unknown>)\n LOCALIZED_STRING_PROXY_CACHE.set(value, proxy)\n return proxy as T\n}\n\nfunction withFallbackRecord(record: Record<string, unknown>): LocalizedStringWithFallback {\n const getExact = (key: string): LocalizedStringEntry | undefined => {\n if (!hasExact(key)) return undefined\n return record[key] as LocalizedStringEntry\n }\n const hasExact = (key: string) => Object.prototype.hasOwnProperty.call(record, key)\n\n return new Proxy(record, {\n get(target, prop) {\n if (prop === \"getExact\") return getExact\n if (prop === \"hasExact\") return hasExact\n if (prop === \"get\") return (key: string) => resolveLocalizedStringEntry(target as LocalizedString, key)\n if (typeof prop === \"string\" && !(prop in target)) {\n return resolveLocalizedStringEntry(target as LocalizedString, prop)\n }\n\n return Reflect.get(target, prop)\n },\n set(target, prop, next) {\n return Reflect.set(target, prop, next)\n },\n }) as LocalizedStringWithFallback\n}\n\nexport const zLocalizedString = () => {\n const languageCodeSchema = z\n .string()\n .regex(LANGUAGE_CODE_REGEX, { message: \"Expected a language code (BCP 47, e.g. en or fr-FR).\" })\n const entrySchema = z.object({\n value: z.string(),\n updatedAt: z.date(),\n autoTranslated: z.boolean().optional(),\n }).passthrough()\n const schema = z.record(\n languageCodeSchema,\n entrySchema,\n )\n\n return schema\n}\n\nexport const zI18nString = zLocalizedString\n","import { z } from \"zod\"\n\n\nexport const E164_PHONE_REGEX = /^\\+[1-9]\\d{1,14}$/\nexport const E164_PHONE_OR_EMPTY_REGEX = /^(?:\\+[1-9]\\d{1,14})?$/\n\nexport type E164PhoneOptions = {\n allowEmpty?: boolean\n}\n\nexport const makeZE164Phone = (zod: typeof z, options?: E164PhoneOptions) => {\n const allowEmpty = options?.allowEmpty ?? false\n return zod.string().trim().regex(allowEmpty ? E164_PHONE_OR_EMPTY_REGEX : E164_PHONE_REGEX, {\n message: allowEmpty\n ? \"Expected an empty string or a phone number in E.164 format (e.g. +33608707197).\"\n : \"Expected a phone number in E.164 format (e.g. +33608707197).\",\n })\n}\n\nexport const zE164Phone = (options?: E164PhoneOptions) => makeZE164Phone(z, options)\n","import { z } from \"zod\"\n\nimport { type E164PhoneOptions, makeZE164Phone } from \"./e164Phone\"\n\n\ntype RpcbaseZodExtension = typeof z & {\n e164Phone?: (options?: E164PhoneOptions) => z.ZodString\n}\n\ntype ExtendableZodPrototype = {\n unique?: (this: unknown, arg?: boolean) => unknown\n sparse?: (this: unknown, arg?: boolean) => unknown\n}\n\ndeclare module \"zod\" {\n interface ZodString {\n unique(arg?: boolean): this\n sparse(arg?: boolean): this\n }\n\n interface ZodNumber {\n unique(arg?: boolean): this\n sparse(arg?: boolean): this\n }\n\n interface ZodDate {\n unique(arg?: boolean): this\n sparse(arg?: boolean): this\n }\n\n}\n\nlet zodPrototypesExtended = false\n\nexport function extendZod(zod: typeof z) {\n const zodWithExtension = zod as RpcbaseZodExtension\n if (Object.isExtensible(zodWithExtension) && typeof zodWithExtension.e164Phone !== \"function\") {\n zodWithExtension.e164Phone = (options?: E164PhoneOptions) => makeZE164Phone(zod, options)\n }\n\n if (zodPrototypesExtended) return\n zodPrototypesExtended = true\n\n const supported = [zod.ZodString, zod.ZodNumber, zod.ZodDate] as const\n for (const type of supported) {\n const proto = type?.prototype as ExtendableZodPrototype | undefined\n if (!proto) continue\n\n proto.unique = function unique(this: unknown, _flag = true) {\n return this\n }\n\n proto.sparse = function sparse(this: unknown, _flag = true) {\n return this\n }\n }\n}\n","import { z as baseZ, type ZodError, type ZodString, type ZodType } from \"zod\"\n\nimport { extendZod } from \"./extension\"\n\n\nexport * from \"./e164Phone\"\nexport * from \"./localizedString\"\n\nexport type RpcbaseZod = typeof baseZ & {\n e164Phone: (options?: import(\"./e164Phone\").E164PhoneOptions) => ZodString\n}\n\nexport const z = Object.create(baseZ) as RpcbaseZod\nextendZod(z)\n\nexport namespace z {\n export type infer<T> = import(\"zod\").infer<T>\n export type input<T> = import(\"zod\").input<T>\n export type output<T> = import(\"zod\").output<T>\n export type TypeOf<T> = import(\"zod\").TypeOf<T>\n export type Infer<T> = import(\"zod\").Infer<T>\n}\n\nexport { extendZod, ZodError, ZodType }\n"],"mappings":";;AA0BA,IAAaiB,sBAAsB;AAEnC,IAAMC,+CAA+B,IAAIC,QAAyB;AAElE,SAASC,gBAAgBC,QAAwB;CAC/C,MAAMC,UAAUD,OAAOE,KAAK;CAC5B,IAAI,CAACD,SAAS,OAAO;CACrB,MAAME,sBAAuBC,KAE1BD;CACH,IAAI,OAAOA,wBAAwB,YAAY,OAAOF;CACtD,IAAI;EACF,OAAOE,oBAAoBF,OAAO,CAAC,CAAC,MAAMA;CAC5C,QAAQ;EACN,OAAOA;CACT;AACF;AAEA,SAAgBK,yBAAyBN,QAAgBO,WAAyC;CAChG,MAAMC,OAAOR,OAAOE,KAAK;CACzB,MAAMO,YAAYV,gBAAgBS,IAAI;CACtC,MAAME,QAAQ,OAAOH,cAAc,WAAW,CAACA,SAAS,IAAK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