@rpcbase/db 0.37.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.
- package/dist/acl/mongooseAclPlugin.d.ts +2 -2
- package/dist/ensureMongooseConnection.d.ts +1 -1
- package/dist/index-SiSvd0kf.js +125 -0
- package/dist/index.browser.js +11 -112
- package/dist/index.js +23 -22
- package/dist/models/RBNotification.d.ts +2 -2
- package/dist/models/RBNotificationSettings.d.ts +2 -2
- package/dist/models/RBRtsChange.d.ts +2 -2
- package/dist/models/RBRtsCounter.d.ts +2 -2
- package/dist/models/RBTenant.d.ts +2 -2
- package/dist/models/RBTenantSubscription.d.ts +2 -4
- package/dist/models/RBTenantSubscription.d.ts.map +1 -1
- package/dist/models/RBTenantSubscriptionEvent.d.ts +2 -4
- package/dist/models/RBTenantSubscriptionEvent.d.ts.map +1 -1
- package/dist/models/RBUploadChunk.d.ts +2 -2
- package/dist/models/RBUploadSession.d.ts +2 -2
- package/dist/models/RBUser.d.ts +2 -2
- package/dist/modelsApi.d.ts +1 -1
- package/dist/mongoose/extendMongooseSchema.d.ts +1 -1
- package/dist/mongoose/index.d.ts +1 -1
- package/dist/mongoose/localizedStringField.d.ts +1 -1
- package/dist/pagination/compileMongoPagination.d.ts +1 -1
- package/dist/pagination/cursor.d.ts +1 -1
- package/dist/pagination/indexHint.d.ts +1 -1
- package/dist/pagination/materializePagination.d.ts +1 -1
- package/dist/pagination/mongoPaginationPlugin.d.ts +3 -3
- package/dist/pagination/normalizeSpec.d.ts +1 -1
- package/dist/pagination/paginateMongoQuery.d.ts +1 -1
- package/dist/registerModels.d.ts +1 -1
- package/dist/rtsChangeLogPlugin.d.ts +1 -1
- package/dist/tenantFilesystemDb.d.ts +1 -1
- package/dist/zod/e164Phone.d.ts +4 -0
- package/dist/zod/e164Phone.d.ts.map +1 -0
- package/dist/zod/extension.d.ts +2 -2
- package/dist/zod/extension.d.ts.map +1 -1
- package/dist/zod/index.d.ts +7 -2
- package/dist/zod/index.d.ts.map +1 -1
- package/dist/zod/localizedString.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as mongoose } from '
|
|
1
|
+
import { default as mongoose } from 'mongoose';
|
|
2
2
|
import { AclAction, AppAbility } from './types';
|
|
3
3
|
type StoredAcl = {
|
|
4
4
|
ability: AppAbility;
|
|
@@ -6,7 +6,7 @@ type StoredAcl = {
|
|
|
6
6
|
};
|
|
7
7
|
type PipelineStageLike = Record<string, unknown>;
|
|
8
8
|
declare const mongooseAclPluginBrand: unique symbol;
|
|
9
|
-
declare module
|
|
9
|
+
declare module "mongoose" {
|
|
10
10
|
interface QueryOptions<DocType = unknown> {
|
|
11
11
|
rbAcl?: StoredAcl;
|
|
12
12
|
[mongooseAclPluginBrand]?: DocType;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { default as mongoose } from '
|
|
1
|
+
import { default as mongoose } from 'mongoose';
|
|
2
2
|
export declare const ensureMongooseConnection: (dbName: string) => Promise<mongoose.Connection>;
|
|
3
3
|
//# sourceMappingURL=ensureMongooseConnection.d.ts.map
|
|
@@ -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
|
+
};
|
package/dist/index.browser.js
CHANGED
|
@@ -1,114 +1,13 @@
|
|
|
1
|
-
import { z } from "
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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.
|
|
9
|
-
import {
|
|
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(["
|
|
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
|
|
568
|
-
const
|
|
569
|
-
if (
|
|
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
|
|
595
|
-
if (Number.isNaN(
|
|
596
|
-
return
|
|
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((
|
|
831
|
-
seq:
|
|
832
|
-
modelName:
|
|
833
|
-
op:
|
|
834
|
-
docId:
|
|
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((
|
|
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
|
-
|
|
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
|
-
|
|
1280
|
-
|
|
1279
|
+
a as zE164Phone,
|
|
1280
|
+
d2 as zI18nString,
|
|
1281
|
+
c2 as zLocalizedString
|
|
1281
1282
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
import { AclPolicy } from '../acl';
|
|
4
4
|
export declare const ZRBNotification: z.ZodObject<{
|
|
5
5
|
userId: z.ZodString;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
import { AclPolicy } from '../acl';
|
|
4
4
|
export declare const ZRBNotificationDigestFrequency: z.ZodEnum<{
|
|
5
5
|
off: "off";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
export declare const ZRBRtsChangeOp: z.ZodEnum<{
|
|
4
4
|
delete: "delete";
|
|
5
5
|
reset_model: "reset_model";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
export declare const ZRBRtsCounter: z.ZodObject<{
|
|
4
4
|
_id: z.ZodString;
|
|
5
5
|
seq: z.ZodNumber;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
export declare const ZRBTenant: z.ZodObject<{
|
|
4
4
|
tenantId: z.ZodString;
|
|
5
5
|
parentTenantId: z.ZodOptional<z.ZodString>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
export declare const ZRBTenantSubscriptionStatus: z.ZodEnum<{
|
|
4
4
|
trialing: "trialing";
|
|
5
5
|
active: "active";
|
|
@@ -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
|
|
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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
export declare const ZRBTenantSubscriptionEventSource: z.ZodEnum<{
|
|
4
4
|
admin: "admin";
|
|
5
5
|
system: "system";
|
|
@@ -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
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
export declare const ZRBUploadChunk: z.ZodObject<{
|
|
4
4
|
uploadId: z.ZodString;
|
|
5
5
|
index: z.ZodNumber;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
import { AclPolicy } from '../acl';
|
|
4
4
|
export declare const ZRBUploadSessionStatus: z.ZodEnum<{
|
|
5
5
|
error: "error";
|
package/dist/models/RBUser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from '
|
|
2
|
-
import { z } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
export declare const ZRBUser: z.ZodObject<{
|
|
4
4
|
email: z.ZodOptional<z.ZodString>;
|
|
5
5
|
password: z.ZodString;
|
package/dist/modelsApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema } from '
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
2
|
type MongooseSchemaExtension = Parameters<Schema["add"]>[0];
|
|
3
3
|
export declare function extendMongooseSchema<TSchema extends Schema>(baseSchema: TSchema, ...extensions: MongooseSchemaExtension[]): TSchema;
|
|
4
4
|
export declare function omitMongooseSchemaPaths<TSchema extends Schema>(schema: TSchema, paths: string[]): TSchema;
|
package/dist/mongoose/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as mongoose, InferSchemaType } from '
|
|
1
|
+
import { default as mongoose, InferSchemaType } from 'mongoose';
|
|
2
2
|
declare const Schema: typeof mongoose.Schema, model: typeof mongoose.model;
|
|
3
3
|
export { Schema, model, mongoose, type InferSchemaType };
|
|
4
4
|
export * from './extendMongooseSchema';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SchemaTypeOptions } from '
|
|
1
|
+
import { SchemaTypeOptions } from 'mongoose';
|
|
2
2
|
import { LocalizedString } from '../zod/localizedString';
|
|
3
3
|
export declare function localizedStringField(options?: Omit<SchemaTypeOptions<LocalizedString>, "type" | "get">): SchemaTypeOptions<LocalizedString>;
|
|
4
4
|
//# sourceMappingURL=localizedStringField.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaginationSpec } from '
|
|
1
|
+
import { PaginationSpec } from '@rpcbase/api';
|
|
2
2
|
export type MongoIndexHint = Record<string, 1 | -1>;
|
|
3
3
|
export declare const getMongoPaginationIndexHint: (spec: PaginationSpec, baseFilter: Record<string, unknown>) => MongoIndexHint;
|
|
4
4
|
//# sourceMappingURL=indexHint.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaginationResponse } from '
|
|
1
|
+
import { PaginationResponse } from '@rpcbase/api';
|
|
2
2
|
import { PaginationCursorCodecOptions } from './cursor';
|
|
3
3
|
import { CompiledMongoPagination } from './compileMongoPagination';
|
|
4
4
|
export type MaterializePaginationOptions = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { default as mongoose } from '
|
|
2
|
-
import { PaginationResponse, PaginationSpec } from '
|
|
1
|
+
import { default as mongoose } from 'mongoose';
|
|
2
|
+
import { PaginationResponse, PaginationSpec } from '@rpcbase/api';
|
|
3
3
|
import { PaginationCursorCodecOptions } from './cursor';
|
|
4
4
|
declare const mongoPaginationPluginBrand: unique symbol;
|
|
5
5
|
export type MongoPaginationPluginOptions = {
|
|
6
6
|
cursor: PaginationCursorCodecOptions;
|
|
7
7
|
};
|
|
8
8
|
type QueryResultNode<TResult> = TResult extends Array<infer TNode> ? TNode : unknown;
|
|
9
|
-
declare module
|
|
9
|
+
declare module "mongoose" {
|
|
10
10
|
interface Query<ResultType, DocType, THelpers = {}, RawDocType = unknown, QueryOp = "find", TDocOverrides = Record<string, never>> {
|
|
11
11
|
[mongoPaginationPluginBrand]?: [DocType, THelpers, RawDocType, QueryOp, TDocOverrides];
|
|
12
12
|
paginate: (pagination?: PaginationSpec, options?: MongoPaginationPluginOptions) => Promise<PaginationResponse<QueryResultNode<ResultType>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaginationDirection, PaginationOrder, PaginationSpec } from '
|
|
1
|
+
import { PaginationDirection, PaginationOrder, PaginationSpec } from '@rpcbase/api';
|
|
2
2
|
export type NormalizedPaginationSpec = Omit<PaginationSpec, "direction" | "sort" | "limit"> & {
|
|
3
3
|
direction: PaginationDirection;
|
|
4
4
|
limit: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaginationResponse, PaginationSpec } from '
|
|
1
|
+
import { PaginationResponse, PaginationSpec } from '@rpcbase/api';
|
|
2
2
|
import { PaginationCursorCodecOptions } from './cursor';
|
|
3
3
|
type MongoPaginateQueryLike<TNode> = {
|
|
4
4
|
where: (delta: Record<string, unknown>) => unknown;
|
package/dist/registerModels.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as mongoose } from '
|
|
1
|
+
import { default as mongoose } from 'mongoose';
|
|
2
2
|
import { LoadModelCtx } from './modelsApi';
|
|
3
3
|
export declare const getTenantFilesystemDbName: (tenantId: string) => string;
|
|
4
4
|
export declare const getTenantFilesystemDb: (tenantId: string) => Promise<mongoose.Connection>;
|
|
@@ -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"}
|
package/dist/zod/extension.d.ts
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/zod/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { z, ZodError } from '
|
|
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
|
|
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
|
package/dist/zod/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|