@rpcbase/db 0.38.0 → 0.39.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.
@@ -0,0 +1,125 @@
1
+ import { z as z$1 } from "zod";
2
+ const LANGUAGE_CODE_REGEX = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/;
3
+ const LOCALIZED_STRING_PROXY_CACHE = /* @__PURE__ */ new WeakMap();
4
+ function normalizeLocale(locale) {
5
+ const trimmed = locale.trim();
6
+ if (!trimmed) return "";
7
+ const getCanonicalLocales = Intl?.getCanonicalLocales;
8
+ if (typeof getCanonicalLocales !== "function") return trimmed;
9
+ try {
10
+ return getCanonicalLocales(trimmed)[0] ?? trimmed;
11
+ } catch {
12
+ return trimmed;
13
+ }
14
+ }
15
+ function buildLocaleFallbackChain(locale, fallbacks) {
16
+ const base = locale.trim();
17
+ const canonical = normalizeLocale(base);
18
+ const extra = typeof fallbacks === "string" ? [fallbacks] : fallbacks ?? [];
19
+ const output = [];
20
+ const seen = /* @__PURE__ */ new Set();
21
+ const push = (value) => {
22
+ if (!value) return;
23
+ if (seen.has(value)) return;
24
+ seen.add(value);
25
+ output.push(value);
26
+ };
27
+ const addChain = (value) => {
28
+ if (!value) return;
29
+ const parts = value.split("-").filter(Boolean);
30
+ while (parts.length > 0) {
31
+ push(parts.join("-"));
32
+ parts.pop();
33
+ }
34
+ };
35
+ addChain(base);
36
+ addChain(canonical);
37
+ for (const fallback of extra) addChain(normalizeLocale(fallback));
38
+ return output;
39
+ }
40
+ function resolveLocalizedString(value, locale, options) {
41
+ if (!value) return void 0;
42
+ const chain = buildLocaleFallbackChain(locale, options?.fallbacks);
43
+ if (chain.length === 0) return void 0;
44
+ const record = value;
45
+ for (const key of chain) {
46
+ if (!Object.prototype.hasOwnProperty.call(record, key)) continue;
47
+ return record[key];
48
+ }
49
+ return void 0;
50
+ }
51
+ function withLocalizedStringFallback(value) {
52
+ if (!value || typeof value !== "object" || Array.isArray(value)) return value;
53
+ if (value instanceof Map) return value;
54
+ const cached = LOCALIZED_STRING_PROXY_CACHE.get(value);
55
+ if (cached) return cached;
56
+ const proxy = withFallbackRecord(value);
57
+ LOCALIZED_STRING_PROXY_CACHE.set(value, proxy);
58
+ return proxy;
59
+ }
60
+ function withFallbackRecord(record) {
61
+ const getExact = (key) => record[key];
62
+ const hasExact = (key) => Object.prototype.hasOwnProperty.call(record, key);
63
+ return new Proxy(record, {
64
+ get(target, prop) {
65
+ if (prop === "getExact") return getExact;
66
+ if (prop === "hasExact") return hasExact;
67
+ if (prop === "get") return (key) => resolveLocalizedString(record, key);
68
+ if (typeof prop === "string" && !(prop in target)) {
69
+ return resolveLocalizedString(record, prop);
70
+ }
71
+ return target[prop];
72
+ },
73
+ set(target, prop, next) {
74
+ target[prop] = next;
75
+ return true;
76
+ }
77
+ });
78
+ }
79
+ const zLocalizedString = () => {
80
+ const schema = z$1.record(
81
+ z$1.string().regex(LANGUAGE_CODE_REGEX, { message: "Expected a language code (BCP 47, e.g. en or fr-FR)." }),
82
+ z$1.string()
83
+ );
84
+ return schema;
85
+ };
86
+ const zI18nString = zLocalizedString;
87
+ const E164_PHONE_REGEX = /^\+[1-9]\d{1,14}$/;
88
+ const zE164Phone = () => z$1.string().trim().regex(E164_PHONE_REGEX, {
89
+ message: "Expected a phone number in E.164 format (e.g. +33608707197)."
90
+ });
91
+ let zodPrototypesExtended = false;
92
+ function extendZod(zod) {
93
+ if (Object.isExtensible(zod) && typeof zod.e164Phone !== "function") {
94
+ zod.e164Phone = () => zod.string().trim().regex(E164_PHONE_REGEX, {
95
+ message: "Expected a phone number in E.164 format (e.g. +33608707197)."
96
+ });
97
+ }
98
+ if (zodPrototypesExtended) return;
99
+ zodPrototypesExtended = true;
100
+ const supported = [zod.ZodString, zod.ZodNumber, zod.ZodDate];
101
+ for (const type of supported) {
102
+ const proto = type?.prototype;
103
+ if (!proto) continue;
104
+ proto.unique = function unique(_flag = true) {
105
+ return this;
106
+ };
107
+ proto.sparse = function sparse(_flag = true) {
108
+ return this;
109
+ };
110
+ }
111
+ }
112
+ const z = Object.create(z$1);
113
+ extendZod(z);
114
+ export {
115
+ E164_PHONE_REGEX as E,
116
+ LANGUAGE_CODE_REGEX as L,
117
+ zE164Phone as a,
118
+ buildLocaleFallbackChain as b,
119
+ zLocalizedString as c,
120
+ zI18nString as d,
121
+ extendZod as e,
122
+ resolveLocalizedString as r,
123
+ withLocalizedStringFallback as w,
124
+ z
125
+ };
@@ -1,114 +1,13 @@
1
- import { z } from "zod";
2
- import { z as z2 } from "zod";
3
- const LANGUAGE_CODE_REGEX = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/;
4
- const 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
- if (!value) return void 0;
43
- const chain = buildLocaleFallbackChain(locale, options?.fallbacks);
44
- if (chain.length === 0) return void 0;
45
- const record = value;
46
- for (const key of chain) {
47
- if (!Object.prototype.hasOwnProperty.call(record, key)) continue;
48
- return record[key];
49
- }
50
- return void 0;
51
- }
52
- function withLocalizedStringFallback(value) {
53
- if (!value || typeof value !== "object" || Array.isArray(value)) return value;
54
- if (value instanceof Map) return value;
55
- const cached = LOCALIZED_STRING_PROXY_CACHE.get(value);
56
- if (cached) return cached;
57
- const proxy = withFallbackRecord(value);
58
- LOCALIZED_STRING_PROXY_CACHE.set(value, proxy);
59
- return proxy;
60
- }
61
- function withFallbackRecord(record) {
62
- const getExact = (key) => record[key];
63
- const hasExact = (key) => Object.prototype.hasOwnProperty.call(record, key);
64
- return new Proxy(record, {
65
- get(target, prop) {
66
- if (prop === "getExact") return getExact;
67
- if (prop === "hasExact") return hasExact;
68
- if (prop === "get") return (key) => resolveLocalizedString(record, key);
69
- if (typeof prop === "string" && !(prop in target)) {
70
- return resolveLocalizedString(record, prop);
71
- }
72
- return target[prop];
73
- },
74
- set(target, prop, next) {
75
- target[prop] = next;
76
- return true;
77
- }
78
- });
79
- }
80
- const zLocalizedString = () => {
81
- const schema = z.record(
82
- z.string().regex(LANGUAGE_CODE_REGEX, { message: "Expected a language code (BCP 47, e.g. en or fr-FR)." }),
83
- z.string()
84
- );
85
- return schema;
86
- };
87
- const zI18nString = zLocalizedString;
88
- let zodExtended = false;
89
- function extendZod(zod) {
90
- if (zodExtended) return;
91
- zodExtended = true;
92
- const supported = [zod.ZodString, zod.ZodNumber, zod.ZodDate];
93
- for (const type of supported) {
94
- const proto = type?.prototype;
95
- if (!proto) continue;
96
- proto.unique = function unique(_flag = true) {
97
- return this;
98
- };
99
- proto.sparse = function sparse(_flag = true) {
100
- return this;
101
- };
102
- }
103
- }
104
- extendZod(z);
1
+ import { E, L, b, e, r, w, z, a, d, c } from "./index-SiSvd0kf.js";
105
2
  export {
106
- LANGUAGE_CODE_REGEX,
107
- buildLocaleFallbackChain,
108
- extendZod,
109
- resolveLocalizedString,
110
- withLocalizedStringFallback,
111
- z2 as z,
112
- zI18nString,
113
- zLocalizedString
3
+ E as E164_PHONE_REGEX,
4
+ L as LANGUAGE_CODE_REGEX,
5
+ b as buildLocaleFallbackChain,
6
+ e as extendZod,
7
+ r as resolveLocalizedString,
8
+ w as withLocalizedStringFallback,
9
+ z,
10
+ a as zE164Phone,
11
+ d as zI18nString,
12
+ c as zLocalizedString
114
13
  };
package/dist/index.js CHANGED
@@ -3,10 +3,9 @@ import { b, d, f, e, g, c, r } from "./can-urGFf45M.js";
3
3
  import mongoose, { Schema as Schema$1, Types } from "mongoose";
4
4
  import { default as default2 } from "mongoose";
5
5
  import { z } from "zod";
6
- import { z as z2 } from "zod";
7
6
  import { timingSafeEqual, createHmac } from "node:crypto";
8
- import { withLocalizedStringFallback } from "./index.browser.js";
9
- import { LANGUAGE_CODE_REGEX, buildLocaleFallbackChain, extendZod, resolveLocalizedString, zI18nString, zLocalizedString } from "./index.browser.js";
7
+ import { w as withLocalizedStringFallback } from "./index-SiSvd0kf.js";
8
+ import { E, L, b as b2, e as e2, r as r2, z as z2, a, d as d2, c as c2 } from "./index-SiSvd0kf.js";
10
9
  import assert from "assert";
11
10
  import { accessibleBy, accessibleRecordsPlugin } from "@casl/mongoose";
12
11
  import "@casl/ability";
@@ -48,7 +47,7 @@ const ZRBTenantSubscriptionStatus = z.enum([
48
47
  "canceled",
49
48
  "expired"
50
49
  ]);
51
- const ZRBTenantSubscriptionIntervalUnit = z.enum(["day", "month", "year"]);
50
+ const ZRBTenantSubscriptionIntervalUnit = z.enum(["month", "year"]);
52
51
  const ZRBTenantSubscriptionType = z.enum(["primary", "addon"]);
53
52
  const ZRBTenantSubscriptionScope = z.enum(["tenant", "shop", "custom"]);
54
53
  const ZRBTenantSubscription = z.object({
@@ -564,9 +563,9 @@ const signCursorPayloadB64 = (payloadB64, secret) => {
564
563
  };
565
564
  const verifyCursorSignature = (payloadB64, sigB64, secret) => {
566
565
  const expectedSigB64 = signCursorPayloadB64(payloadB64, secret);
567
- const a = Buffer.from(sigB64, "utf8");
568
- const b2 = Buffer.from(expectedSigB64, "utf8");
569
- if (a.length !== b2.length || !timingSafeEqual(a, b2)) {
566
+ const a2 = Buffer.from(sigB64, "utf8");
567
+ const b3 = Buffer.from(expectedSigB64, "utf8");
568
+ if (a2.length !== b3.length || !timingSafeEqual(a2, b3)) {
570
569
  throw new PaginationValidationError("Invalid pagination cursor signature");
571
570
  }
572
571
  };
@@ -591,9 +590,9 @@ const decodeCursorValue = (field, value) => {
591
590
  if (!value || typeof value !== "object") throw new PaginationValidationError(`Invalid pagination cursor value for field: ${field}`);
592
591
  if ("$date" in value) {
593
592
  if (typeof value.$date !== "string") throw new PaginationValidationError(`Invalid pagination cursor date for field: ${field}`);
594
- const d2 = new Date(value.$date);
595
- if (Number.isNaN(d2.getTime())) throw new PaginationValidationError(`Invalid pagination cursor date for field: ${field}`);
596
- return d2;
593
+ const d3 = new Date(value.$date);
594
+ if (Number.isNaN(d3.getTime())) throw new PaginationValidationError(`Invalid pagination cursor date for field: ${field}`);
595
+ return d3;
597
596
  }
598
597
  if ("$oid" in value) {
599
598
  if (typeof value.$oid !== "string" || !Types.ObjectId.isValid(value.$oid)) {
@@ -827,11 +826,11 @@ const insertChanges = async (db, changes) => {
827
826
  if (!changes.length) return;
828
827
  const { RtsChange } = getRtsModels(db);
829
828
  const ts = /* @__PURE__ */ new Date();
830
- await RtsChange.insertMany(changes.map((c2) => ({
831
- seq: c2.seq,
832
- modelName: c2.modelName,
833
- op: c2.op,
834
- docId: c2.docId ?? void 0,
829
+ await RtsChange.insertMany(changes.map((c3) => ({
830
+ seq: c3.seq,
831
+ modelName: c3.modelName,
832
+ op: c3.op,
833
+ docId: c3.docId ?? void 0,
835
834
  ts
836
835
  })));
837
836
  };
@@ -862,7 +861,7 @@ const captureDeleteMeta = async (query, mode) => {
862
861
  findQuery.limit(maxDeleteIds + 1);
863
862
  }
864
863
  const docs = await findQuery;
865
- const ids = Array.isArray(docs) ? docs.map((d2) => normalizeId(d2?._id)).filter((id) => Boolean(id)) : [];
864
+ const ids = Array.isArray(docs) ? docs.map((d3) => normalizeId(d3?._id)).filter((id) => Boolean(id)) : [];
866
865
  const reset = mode === "many" && ids.length > maxDeleteIds;
867
866
  const trimmedIds = reset ? [] : ids;
868
867
  const meta = {
@@ -1215,7 +1214,8 @@ const getTenantFilesystemDbFromCtx = async (ctx) => {
1215
1214
  return getTenantFilesystemDb(tenantId);
1216
1215
  };
1217
1216
  export {
1218
- LANGUAGE_CODE_REGEX,
1217
+ E as E164_PHONE_REGEX,
1218
+ L as LANGUAGE_CODE_REGEX,
1219
1219
  PaginationValidationError,
1220
1220
  RBNotificationPolicy,
1221
1221
  RBNotificationSchema,
@@ -1253,11 +1253,11 @@ export {
1253
1253
  ZRBUser,
1254
1254
  b as buildAbility,
1255
1255
  d as buildAbilityFromSession,
1256
- buildLocaleFallbackChain,
1256
+ b2 as buildLocaleFallbackChain,
1257
1257
  f as can,
1258
1258
  createModels,
1259
1259
  extendMongooseSchema,
1260
- extendZod,
1260
+ e2 as extendZod,
1261
1261
  e as getAccessibleByQuery,
1262
1262
  g as getRegisteredPolicies,
1263
1263
  getTenantFilesystemDb,
@@ -1273,9 +1273,10 @@ export {
1273
1273
  omitMongooseSchemaPaths,
1274
1274
  registerPoliciesFromModules,
1275
1275
  r as registerPolicy,
1276
- resolveLocalizedString,
1276
+ r2 as resolveLocalizedString,
1277
1277
  withLocalizedStringFallback,
1278
1278
  z2 as z,
1279
- zI18nString,
1280
- zLocalizedString
1279
+ a as zE164Phone,
1280
+ d2 as zI18nString,
1281
+ c2 as zLocalizedString
1281
1282
  };
@@ -9,7 +9,6 @@ export declare const ZRBTenantSubscriptionStatus: z.ZodEnum<{
9
9
  expired: "expired";
10
10
  }>;
11
11
  export declare const ZRBTenantSubscriptionIntervalUnit: z.ZodEnum<{
12
- day: "day";
13
12
  month: "month";
14
13
  year: "year";
15
14
  }>;
@@ -46,7 +45,6 @@ export declare const ZRBTenantSubscription: z.ZodObject<{
46
45
  expired: "expired";
47
46
  }>;
48
47
  intervalUnit: z.ZodEnum<{
49
- day: "day";
50
48
  month: "month";
51
49
  year: "year";
52
50
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"RBTenantSubscription.d.ts","sourceRoot":"","sources":["../../src/models/RBTenantSubscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,2BAA2B;;;;;;;EAOtC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;EAAmC,CAAA;AAEjF,eAAO,MAAM,yBAAyB;;;EAA+B,CAAA;AAErE,eAAO,MAAM,0BAA0B;;;;EAAuC,CAAA;AAE9E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBhC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,eAAO,MAAM,0BAA0B,EAAE,MA6BxC,CAAA"}
1
+ {"version":3,"file":"RBTenantSubscription.d.ts","sourceRoot":"","sources":["../../src/models/RBTenantSubscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,2BAA2B;;;;;;;EAOtC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;EAA4B,CAAA;AAE1E,eAAO,MAAM,yBAAyB;;;EAA+B,CAAA;AAErE,eAAO,MAAM,0BAA0B;;;;EAAuC,CAAA;AAE9E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBhC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,eAAO,MAAM,0BAA0B,EAAE,MA6BxC,CAAA"}
@@ -38,12 +38,10 @@ export declare const ZRBTenantSubscriptionEvent: z.ZodObject<{
38
38
  fromModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
39
39
  toModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
40
  fromIntervalUnit: z.ZodOptional<z.ZodEnum<{
41
- day: "day";
42
41
  month: "month";
43
42
  year: "year";
44
43
  }>>;
45
44
  toIntervalUnit: z.ZodOptional<z.ZodEnum<{
46
- day: "day";
47
45
  month: "month";
48
46
  year: "year";
49
47
  }>>;
@@ -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;AAQvB,eAAO,MAAM,gCAAgC;;;;;EAK3C,CAAA;AAEF,eAAO,MAAM,oCAAoC;;;;EAI/C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBrC,CAAA;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEnF,eAAO,MAAM,+BAA+B,EAAE,MA6B7C,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;AAQvB,eAAO,MAAM,gCAAgC;;;;;EAK3C,CAAA;AAEF,eAAO,MAAM,oCAAoC;;;;EAI/C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBrC,CAAA;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEnF,eAAO,MAAM,+BAA+B,EAAE,MA6B7C,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const E164_PHONE_REGEX: RegExp;
3
+ export declare const zE164Phone: () => z.ZodString;
4
+ //# sourceMappingURL=e164Phone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e164Phone.d.ts","sourceRoot":"","sources":["../../src/zod/e164Phone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,gBAAgB,QAAsB,CAAA;AAEnD,eAAO,MAAM,UAAU,mBAGnB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/zod/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,SAAS;QACjB,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;IAED,UAAU,SAAS;QACjB,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;IAED,UAAU,OAAO;QACf,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;CAEF;AAID,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,QAiBtC"}
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/zod/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,SAAS;QACjB,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;IAED,UAAU,SAAS;QACjB,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;IAED,UAAU,OAAO;QACf,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;CAEF;AAID,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,QAwBtC"}
@@ -1,5 +1,10 @@
1
- import { z, ZodError } from 'zod';
1
+ import { z as baseZ, ZodError, ZodString } from 'zod';
2
2
  import { extendZod } from './extension';
3
+ export * from './e164Phone';
3
4
  export * from './localizedString';
4
- export { extendZod, z, ZodError };
5
+ export type RpcbaseZod = typeof baseZ & {
6
+ e164Phone: () => ZodString;
7
+ };
8
+ export declare const z: RpcbaseZod;
9
+ export { extendZod, ZodError };
5
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,cAAc,mBAAmB,CAAA;AAKjC,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,IAAI,KAAK,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AAEjC,MAAM,MAAM,UAAU,GAAG,OAAO,KAAK,GAAG;IACtC,SAAS,EAAE,MAAM,SAAS,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,CAAC,EAA2B,UAAU,CAAA;AAGnD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/db",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"