@prisma-next/mongo-schema-ir 0.13.0-dev.4 → 0.13.0-dev.40
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/exports/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IRNodeBase } from "@prisma-next/framework-components/ir";
|
|
2
2
|
import { MongoIndexKey } from "@prisma-next/mongo-contract";
|
|
3
|
+
import { CollationOptions } from "@prisma-next/mongo-value/mongodb-types";
|
|
3
4
|
|
|
4
5
|
//#region src/canonicalize.d.ts
|
|
5
6
|
declare function canonicalize(obj: unknown): string;
|
|
@@ -15,7 +16,7 @@ interface MongoSchemaCollectionOptionsInput {
|
|
|
15
16
|
metaField?: string;
|
|
16
17
|
granularity?: 'seconds' | 'minutes' | 'hours';
|
|
17
18
|
};
|
|
18
|
-
readonly collation?:
|
|
19
|
+
readonly collation?: CollationOptions;
|
|
19
20
|
readonly changeStreamPreAndPostImages?: {
|
|
20
21
|
enabled: boolean;
|
|
21
22
|
};
|
|
@@ -34,7 +35,7 @@ declare class MongoSchemaCollectionOptions extends MongoSchemaIRNode {
|
|
|
34
35
|
metaField?: string;
|
|
35
36
|
granularity?: 'seconds' | 'minutes' | 'hours';
|
|
36
37
|
} | undefined;
|
|
37
|
-
readonly collation?:
|
|
38
|
+
readonly collation?: CollationOptions | undefined;
|
|
38
39
|
readonly changeStreamPreAndPostImages?: {
|
|
39
40
|
enabled: boolean;
|
|
40
41
|
} | undefined;
|
|
@@ -110,7 +111,7 @@ interface MongoSchemaIndexOptions {
|
|
|
110
111
|
readonly expireAfterSeconds?: number | undefined;
|
|
111
112
|
readonly partialFilterExpression?: Record<string, unknown> | undefined;
|
|
112
113
|
readonly wildcardProjection?: Record<string, 0 | 1> | undefined;
|
|
113
|
-
readonly collation?:
|
|
114
|
+
readonly collation?: CollationOptions | undefined;
|
|
114
115
|
readonly weights?: Record<string, number> | undefined;
|
|
115
116
|
readonly default_language?: string | undefined;
|
|
116
117
|
readonly language_override?: string | undefined;
|
|
@@ -123,7 +124,7 @@ declare class MongoSchemaIndex extends MongoSchemaIRNode {
|
|
|
123
124
|
readonly expireAfterSeconds?: number | undefined;
|
|
124
125
|
readonly partialFilterExpression?: Record<string, unknown> | undefined;
|
|
125
126
|
readonly wildcardProjection?: Record<string, 0 | 1> | undefined;
|
|
126
|
-
readonly collation?:
|
|
127
|
+
readonly collation?: CollationOptions | undefined;
|
|
127
128
|
readonly weights?: Record<string, number> | undefined;
|
|
128
129
|
readonly default_language?: string | undefined;
|
|
129
130
|
readonly language_override?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/canonicalize.ts","../../src/schema-collection-options.ts","../../src/schema-validator.ts","../../src/schema-collection.ts","../../src/schema-ir.ts","../../src/visitor.ts","../../src/schema-node.ts","../../src/schema-index.ts","../../src/index-equivalence.ts","../../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/canonicalize.ts","../../src/schema-collection-options.ts","../../src/schema-validator.ts","../../src/schema-collection.ts","../../src/schema-ir.ts","../../src/visitor.ts","../../src/schema-node.ts","../../src/schema-index.ts","../../src/index-equivalence.ts","../../src/types.ts"],"mappings":";;;;;iBAAgB,YAAA,CAAa,GAAY;;;UCKxB,iCAAA;EAAA,SACN,MAAA;IAAW,IAAA;IAAc,GAAA;EAAA;EAAA,SACzB,UAAA;IACP,SAAA;IACA,SAAA;IACA,WAAA;EAAA;EAAA,SAEO,SAAA,GAAY,gBAAgB;EAAA,SAC5B,4BAAA;IAAiC,OAAA;EAAA;EAAA,SACjC,cAAA;IAAmB,IAAA;EAAA;AAAA;AAAA,cAGjB,4BAAA,SAAqC,iBAAA;EAAA,SACvC,IAAA;EAAA,SACA,MAAA;IAAW,IAAA;IAAc,GAAA;EAAA;EAAA,SACzB,UAAA;IACH,SAAA;IAAmB,SAAA;IAAoB,WAA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A,GACA,oBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/canonicalize.ts","../../src/index-equivalence.ts","../../src/schema-node.ts","../../src/schema-collection.ts","../../src/schema-collection-options.ts","../../src/schema-index.ts","../../src/schema-ir.ts","../../src/schema-validator.ts"],"sourcesContent":["export function canonicalize(obj: unknown): string {\n if (obj === null) return 'null';\n if (obj === undefined) return 'undefined';\n if (typeof obj !== 'object') return JSON.stringify(obj);\n if (Array.isArray(obj)) return `[${obj.map(canonicalize).join(',')}]`;\n const record = obj as Record<string, unknown>;\n const sorted = Object.keys(record).sort();\n const entries = sorted.map((k) => `${JSON.stringify(k)}:${canonicalize(record[k])}`);\n return `{${entries.join(',')}}`;\n}\n","import { canonicalize } from './canonicalize';\nimport type { MongoSchemaIndex } from './schema-index';\n\n/**\n * Key-order-sensitive structural comparison. For key-order-independent\n * comparison (e.g. lookup key construction), use {@link canonicalize}.\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a === undefined || b === undefined) return false;\n if (typeof a !== typeof b) return false;\n\n if (Array.isArray(a)) {\n if (!Array.isArray(b)) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) return false;\n }\n return true;\n }\n\n if (typeof a === 'object' && typeof b === 'object') {\n const aObj = a as Record<string, unknown>;\n const bObj = b as Record<string, unknown>;\n const aKeys = Object.keys(aObj);\n const bKeys = Object.keys(bObj);\n if (aKeys.length !== bKeys.length) return false;\n for (let i = 0; i < aKeys.length; i++) {\n if (aKeys[i] !== bKeys[i]) return false;\n const key = aKeys[i] as string;\n if (!deepEqual(aObj[key], bObj[key])) return false;\n }\n return true;\n }\n\n return false;\n}\n\nexport function indexesEquivalent(a: MongoSchemaIndex, b: MongoSchemaIndex): boolean {\n if (a.keys.length !== b.keys.length) return false;\n for (let i = 0; i < a.keys.length; i++) {\n const aKey = a.keys[i];\n const bKey = b.keys[i];\n if (!aKey || !bKey) return false;\n if (aKey.field !== bKey.field) return false;\n if (aKey.direction !== bKey.direction) return false;\n }\n if (a.unique !== b.unique) return false;\n if (a.sparse !== b.sparse) return false;\n if (a.expireAfterSeconds !== b.expireAfterSeconds) return false;\n if (canonicalize(a.partialFilterExpression) !== canonicalize(b.partialFilterExpression))\n return false;\n if (canonicalize(a.wildcardProjection) !== canonicalize(b.wildcardProjection)) return false;\n if (canonicalize(a.collation) !== canonicalize(b.collation)) return false;\n if (canonicalize(a.weights) !== canonicalize(b.weights)) return false;\n if (a.default_language !== b.default_language) return false;\n if (a.language_override !== b.language_override) return false;\n return true;\n}\n","import { IRNodeBase } from '@prisma-next/framework-components/ir';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport abstract class MongoSchemaIRNode extends IRNodeBase {\n abstract accept<R>(visitor: MongoSchemaVisitor<R>): R;\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport type { MongoSchemaCollectionOptions } from './schema-collection-options';\nimport type { MongoSchemaIndex } from './schema-index';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaValidator } from './schema-validator';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport interface MongoSchemaCollectionCtorOptions {\n readonly name: string;\n readonly indexes?: ReadonlyArray<MongoSchemaIndex>;\n readonly validator?: MongoSchemaValidator;\n readonly options?: MongoSchemaCollectionOptions;\n}\n\nexport class MongoSchemaCollection extends MongoSchemaIRNode {\n readonly kind = 'collection' as const;\n readonly name: string;\n readonly indexes: ReadonlyArray<MongoSchemaIndex>;\n readonly validator?: MongoSchemaValidator | undefined;\n readonly options?: MongoSchemaCollectionOptions | undefined;\n\n constructor(options: MongoSchemaCollectionCtorOptions) {\n super();\n this.name = options.name;\n this.indexes = options.indexes ?? [];\n this.validator = options.validator;\n this.options = options.options;\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.collection(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport interface MongoSchemaCollectionOptionsInput {\n readonly capped?: { size: number; max?: number };\n readonly timeseries?: {\n timeField: string;\n metaField?: string;\n granularity?: 'seconds' | 'minutes' | 'hours';\n };\n readonly collation?: Record<string, unknown>;\n readonly changeStreamPreAndPostImages?: { enabled: boolean };\n readonly clusteredIndex?: { name?: string };\n}\n\nexport class MongoSchemaCollectionOptions extends MongoSchemaIRNode {\n readonly kind = 'collectionOptions' as const;\n readonly capped?: { size: number; max?: number } | undefined;\n readonly timeseries?:\n | { timeField: string; metaField?: string; granularity?: 'seconds' | 'minutes' | 'hours' }\n | undefined;\n readonly collation?: Record<string, unknown> | undefined;\n readonly changeStreamPreAndPostImages?: { enabled: boolean } | undefined;\n readonly clusteredIndex?: { name?: string } | undefined;\n\n constructor(options: MongoSchemaCollectionOptionsInput) {\n super();\n this.capped = options.capped;\n this.timeseries = options.timeseries;\n this.collation = options.collation;\n this.changeStreamPreAndPostImages = options.changeStreamPreAndPostImages;\n this.clusteredIndex = options.clusteredIndex;\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.collectionOptions(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport type { MongoIndexKey } from '@prisma-next/mongo-contract';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport interface MongoSchemaIndexOptions {\n readonly keys: ReadonlyArray<MongoIndexKey>;\n readonly unique?: boolean | undefined;\n readonly sparse?: boolean | undefined;\n readonly expireAfterSeconds?: number | undefined;\n readonly partialFilterExpression?: Record<string, unknown> | undefined;\n readonly wildcardProjection?: Record<string, 0 | 1> | undefined;\n readonly collation?: Record<string, unknown> | undefined;\n readonly weights?: Record<string, number> | undefined;\n readonly default_language?: string | undefined;\n readonly language_override?: string | undefined;\n}\n\nexport class MongoSchemaIndex extends MongoSchemaIRNode {\n readonly kind = 'index' as const;\n readonly keys: ReadonlyArray<MongoIndexKey>;\n readonly unique: boolean;\n readonly sparse?: boolean | undefined;\n readonly expireAfterSeconds?: number | undefined;\n readonly partialFilterExpression?: Record<string, unknown> | undefined;\n readonly wildcardProjection?: Record<string, 0 | 1> | undefined;\n readonly collation?: Record<string, unknown> | undefined;\n readonly weights?: Record<string, number> | undefined;\n readonly default_language?: string | undefined;\n readonly language_override?: string | undefined;\n\n constructor(options: MongoSchemaIndexOptions) {\n super();\n this.keys = options.keys;\n this.unique = options.unique ?? false;\n this.sparse = options.sparse;\n this.expireAfterSeconds = options.expireAfterSeconds;\n this.partialFilterExpression = options.partialFilterExpression;\n this.wildcardProjection = options.wildcardProjection;\n this.collation = options.collation;\n this.weights = options.weights;\n this.default_language = options.default_language;\n this.language_override = options.language_override;\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.index(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport type { MongoSchemaCollection } from './schema-collection';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport class MongoSchemaIR extends MongoSchemaIRNode {\n readonly kind = 'schema' as const;\n readonly collections: ReadonlyArray<MongoSchemaCollection>;\n readonly collectionNames: ReadonlyArray<string>;\n\n private readonly _byName: Map<string, MongoSchemaCollection>;\n\n constructor(collections: ReadonlyArray<MongoSchemaCollection>) {\n super();\n const sorted = [...collections].sort((a, b) => a.name.localeCompare(b.name));\n this.collections = sorted;\n this._byName = new Map(sorted.map((c) => [c.name, c]));\n this.collectionNames = sorted.map((c) => c.name);\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.schema(this);\n }\n\n collection(name: string): MongoSchemaCollection | undefined {\n return this._byName.get(name);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport interface MongoSchemaValidatorOptions {\n readonly jsonSchema: Record<string, unknown>;\n readonly validationLevel: 'strict' | 'moderate';\n readonly validationAction: 'error' | 'warn';\n}\n\nexport class MongoSchemaValidator extends MongoSchemaIRNode {\n readonly kind = 'validator' as const;\n readonly jsonSchema: Record<string, unknown>;\n readonly validationLevel: 'strict' | 'moderate';\n readonly validationAction: 'error' | 'warn';\n\n constructor(options: MongoSchemaValidatorOptions) {\n super();\n this.jsonSchema = options.jsonSchema;\n this.validationLevel = options.validationLevel;\n this.validationAction = options.validationAction;\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.validator(this);\n }\n}\n"],"mappings":";;AAAA,SAAgB,aAAa,KAAsB;CACjD,IAAI,QAAQ,MAAM,OAAO;CACzB,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,IAAI,OAAO,QAAQ,UAAU,OAAO,KAAK,UAAU,GAAG;CACtD,IAAI,MAAM,QAAQ,GAAG,GAAG,OAAO,IAAI,IAAI,IAAI,YAAY,CAAC,CAAC,KAAK,GAAG,EAAE;CACnE,MAAM,SAAS;CAGf,OAAO,IAFQ,OAAO,KAAK,MAAM,CAAC,CAAC,KACd,CAAC,CAAC,KAAK,MAAM,GAAG,KAAK,UAAU,CAAC,EAAE,GAAG,aAAa,OAAO,EAAE,GAC/D,CAAC,CAAC,KAAK,GAAG,EAAE;AAC/B;;;;;;;ACFA,SAAgB,UAAU,GAAY,GAAqB;CACzD,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,MAAM,QAAQ,MAAM,MAAM,OAAO;CACrC,IAAI,MAAM,KAAA,KAAa,MAAM,KAAA,GAAW,OAAO;CAC/C,IAAI,OAAO,MAAM,OAAO,GAAG,OAAO;CAElC,IAAI,MAAM,QAAQ,CAAC,GAAG;EACpB,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,OAAO;EAC9B,IAAI,EAAE,WAAW,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;EACvB,KAAK,mBAAmB,QAAQ;EAChC,KAAK,oBAAoB,QAAQ;EACjC,WAAW,IAAI;CACjB;CAEA,OAAU,SAAmC;EAC3C,OAAO,QAAQ,MAAM,IAAI;CAC3B;AACF;;;AC5CA,IAAa,gBAAb,cAAmC,kBAAkB;CACnD,OAAgB;CAChB;CACA;CAEA;CAEA,YAAY,aAAmD;EAC7D,MAAM;EACN,MAAM,SAAS,CAAC,GAAG,WAAW,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;EAC3E,KAAK,cAAc;EACnB,KAAK,UAAU,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;EACrD,KAAK,kBAAkB,OAAO,KAAK,MAAM,EAAE,IAAI;EAC/C,WAAW,IAAI;CACjB;CAEA,OAAU,SAAmC;EAC3C,OAAO,QAAQ,OAAO,IAAI;CAC5B;CAEA,WAAW,MAAiD;EAC1D,OAAO,KAAK,QAAQ,IAAI,IAAI;CAC9B;AACF;;;AClBA,IAAa,uBAAb,cAA0C,kBAAkB;CAC1D,OAAgB;CAChB;CACA;CACA;CAEA,YAAY,SAAsC;EAChD,MAAM;EACN,KAAK,aAAa,QAAQ;EAC1B,KAAK,kBAAkB,QAAQ;EAC/B,KAAK,mBAAmB,QAAQ;EAChC,WAAW,IAAI;CACjB;CAEA,OAAU,SAAmC;EAC3C,OAAO,QAAQ,UAAU,IAAI;CAC/B;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/canonicalize.ts","../../src/index-equivalence.ts","../../src/schema-node.ts","../../src/schema-collection.ts","../../src/schema-collection-options.ts","../../src/schema-index.ts","../../src/schema-ir.ts","../../src/schema-validator.ts"],"sourcesContent":["export function canonicalize(obj: unknown): string {\n if (obj === null) return 'null';\n if (obj === undefined) return 'undefined';\n if (typeof obj !== 'object') return JSON.stringify(obj);\n if (Array.isArray(obj)) return `[${obj.map(canonicalize).join(',')}]`;\n const record = obj as Record<string, unknown>;\n const sorted = Object.keys(record).sort();\n const entries = sorted.map((k) => `${JSON.stringify(k)}:${canonicalize(record[k])}`);\n return `{${entries.join(',')}}`;\n}\n","import { canonicalize } from './canonicalize';\nimport type { MongoSchemaIndex } from './schema-index';\n\n/**\n * Key-order-sensitive structural comparison. For key-order-independent\n * comparison (e.g. lookup key construction), use {@link canonicalize}.\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a === undefined || b === undefined) return false;\n if (typeof a !== typeof b) return false;\n\n if (Array.isArray(a)) {\n if (!Array.isArray(b)) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) return false;\n }\n return true;\n }\n\n if (typeof a === 'object' && typeof b === 'object') {\n const aObj = a as Record<string, unknown>;\n const bObj = b as Record<string, unknown>;\n const aKeys = Object.keys(aObj);\n const bKeys = Object.keys(bObj);\n if (aKeys.length !== bKeys.length) return false;\n for (let i = 0; i < aKeys.length; i++) {\n if (aKeys[i] !== bKeys[i]) return false;\n const key = aKeys[i] as string;\n if (!deepEqual(aObj[key], bObj[key])) return false;\n }\n return true;\n }\n\n return false;\n}\n\nexport function indexesEquivalent(a: MongoSchemaIndex, b: MongoSchemaIndex): boolean {\n if (a.keys.length !== b.keys.length) return false;\n for (let i = 0; i < a.keys.length; i++) {\n const aKey = a.keys[i];\n const bKey = b.keys[i];\n if (!aKey || !bKey) return false;\n if (aKey.field !== bKey.field) return false;\n if (aKey.direction !== bKey.direction) return false;\n }\n if (a.unique !== b.unique) return false;\n if (a.sparse !== b.sparse) return false;\n if (a.expireAfterSeconds !== b.expireAfterSeconds) return false;\n if (canonicalize(a.partialFilterExpression) !== canonicalize(b.partialFilterExpression))\n return false;\n if (canonicalize(a.wildcardProjection) !== canonicalize(b.wildcardProjection)) return false;\n if (canonicalize(a.collation) !== canonicalize(b.collation)) return false;\n if (canonicalize(a.weights) !== canonicalize(b.weights)) return false;\n if (a.default_language !== b.default_language) return false;\n if (a.language_override !== b.language_override) return false;\n return true;\n}\n","import { IRNodeBase } from '@prisma-next/framework-components/ir';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport abstract class MongoSchemaIRNode extends IRNodeBase {\n abstract accept<R>(visitor: MongoSchemaVisitor<R>): R;\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport type { MongoSchemaCollectionOptions } from './schema-collection-options';\nimport type { MongoSchemaIndex } from './schema-index';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaValidator } from './schema-validator';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport interface MongoSchemaCollectionCtorOptions {\n readonly name: string;\n readonly indexes?: ReadonlyArray<MongoSchemaIndex>;\n readonly validator?: MongoSchemaValidator;\n readonly options?: MongoSchemaCollectionOptions;\n}\n\nexport class MongoSchemaCollection extends MongoSchemaIRNode {\n readonly kind = 'collection' as const;\n readonly name: string;\n readonly indexes: ReadonlyArray<MongoSchemaIndex>;\n readonly validator?: MongoSchemaValidator | undefined;\n readonly options?: MongoSchemaCollectionOptions | undefined;\n\n constructor(options: MongoSchemaCollectionCtorOptions) {\n super();\n this.name = options.name;\n this.indexes = options.indexes ?? [];\n this.validator = options.validator;\n this.options = options.options;\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.collection(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport type { CollationOptions } from '@prisma-next/mongo-value/mongodb-types';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport interface MongoSchemaCollectionOptionsInput {\n readonly capped?: { size: number; max?: number };\n readonly timeseries?: {\n timeField: string;\n metaField?: string;\n granularity?: 'seconds' | 'minutes' | 'hours';\n };\n readonly collation?: CollationOptions;\n readonly changeStreamPreAndPostImages?: { enabled: boolean };\n readonly clusteredIndex?: { name?: string };\n}\n\nexport class MongoSchemaCollectionOptions extends MongoSchemaIRNode {\n readonly kind = 'collectionOptions' as const;\n readonly capped?: { size: number; max?: number } | undefined;\n readonly timeseries?:\n | { timeField: string; metaField?: string; granularity?: 'seconds' | 'minutes' | 'hours' }\n | undefined;\n readonly collation?: CollationOptions | undefined;\n readonly changeStreamPreAndPostImages?: { enabled: boolean } | undefined;\n readonly clusteredIndex?: { name?: string } | undefined;\n\n constructor(options: MongoSchemaCollectionOptionsInput) {\n super();\n this.capped = options.capped;\n this.timeseries = options.timeseries;\n this.collation = options.collation;\n this.changeStreamPreAndPostImages = options.changeStreamPreAndPostImages;\n this.clusteredIndex = options.clusteredIndex;\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.collectionOptions(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport type { MongoIndexKey } from '@prisma-next/mongo-contract';\nimport type { CollationOptions } from '@prisma-next/mongo-value/mongodb-types';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport interface MongoSchemaIndexOptions {\n readonly keys: ReadonlyArray<MongoIndexKey>;\n readonly unique?: boolean | undefined;\n readonly sparse?: boolean | undefined;\n readonly expireAfterSeconds?: number | undefined;\n readonly partialFilterExpression?: Record<string, unknown> | undefined;\n readonly wildcardProjection?: Record<string, 0 | 1> | undefined;\n readonly collation?: CollationOptions | undefined;\n readonly weights?: Record<string, number> | undefined;\n readonly default_language?: string | undefined;\n readonly language_override?: string | undefined;\n}\n\nexport class MongoSchemaIndex extends MongoSchemaIRNode {\n readonly kind = 'index' as const;\n readonly keys: ReadonlyArray<MongoIndexKey>;\n readonly unique: boolean;\n readonly sparse?: boolean | undefined;\n readonly expireAfterSeconds?: number | undefined;\n readonly partialFilterExpression?: Record<string, unknown> | undefined;\n readonly wildcardProjection?: Record<string, 0 | 1> | undefined;\n readonly collation?: CollationOptions | undefined;\n readonly weights?: Record<string, number> | undefined;\n readonly default_language?: string | undefined;\n readonly language_override?: string | undefined;\n\n constructor(options: MongoSchemaIndexOptions) {\n super();\n this.keys = options.keys;\n this.unique = options.unique ?? false;\n this.sparse = options.sparse;\n this.expireAfterSeconds = options.expireAfterSeconds;\n this.partialFilterExpression = options.partialFilterExpression;\n this.wildcardProjection = options.wildcardProjection;\n this.collation = options.collation;\n this.weights = options.weights;\n this.default_language = options.default_language;\n this.language_override = options.language_override;\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.index(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport type { MongoSchemaCollection } from './schema-collection';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport class MongoSchemaIR extends MongoSchemaIRNode {\n readonly kind = 'schema' as const;\n readonly collections: ReadonlyArray<MongoSchemaCollection>;\n readonly collectionNames: ReadonlyArray<string>;\n\n private readonly _byName: Map<string, MongoSchemaCollection>;\n\n constructor(collections: ReadonlyArray<MongoSchemaCollection>) {\n super();\n const sorted = [...collections].sort((a, b) => a.name.localeCompare(b.name));\n this.collections = sorted;\n this._byName = new Map(sorted.map((c) => [c.name, c]));\n this.collectionNames = sorted.map((c) => c.name);\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.schema(this);\n }\n\n collection(name: string): MongoSchemaCollection | undefined {\n return this._byName.get(name);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { MongoSchemaIRNode } from './schema-node';\nimport type { MongoSchemaVisitor } from './visitor';\n\nexport interface MongoSchemaValidatorOptions {\n readonly jsonSchema: Record<string, unknown>;\n readonly validationLevel: 'strict' | 'moderate';\n readonly validationAction: 'error' | 'warn';\n}\n\nexport class MongoSchemaValidator extends MongoSchemaIRNode {\n readonly kind = 'validator' as const;\n readonly jsonSchema: Record<string, unknown>;\n readonly validationLevel: 'strict' | 'moderate';\n readonly validationAction: 'error' | 'warn';\n\n constructor(options: MongoSchemaValidatorOptions) {\n super();\n this.jsonSchema = options.jsonSchema;\n this.validationLevel = options.validationLevel;\n this.validationAction = options.validationAction;\n freezeNode(this);\n }\n\n accept<R>(visitor: MongoSchemaVisitor<R>): R {\n return visitor.validator(this);\n }\n}\n"],"mappings":";;AAAA,SAAgB,aAAa,KAAsB;CACjD,IAAI,QAAQ,MAAM,OAAO;CACzB,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,IAAI,OAAO,QAAQ,UAAU,OAAO,KAAK,UAAU,GAAG;CACtD,IAAI,MAAM,QAAQ,GAAG,GAAG,OAAO,IAAI,IAAI,IAAI,YAAY,CAAC,CAAC,KAAK,GAAG,EAAE;CACnE,MAAM,SAAS;CAGf,OAAO,IAFQ,OAAO,KAAK,MAAM,CAAC,CAAC,KACd,CAAC,CAAC,KAAK,MAAM,GAAG,KAAK,UAAU,CAAC,EAAE,GAAG,aAAa,OAAO,EAAE,GAC/D,CAAC,CAAC,KAAK,GAAG,EAAE;AAC/B;;;;;;;ACFA,SAAgB,UAAU,GAAY,GAAqB;CACzD,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,MAAM,QAAQ,MAAM,MAAM,OAAO;CACrC,IAAI,MAAM,KAAA,KAAa,MAAM,KAAA,GAAW,OAAO;CAC/C,IAAI,OAAO,MAAM,OAAO,GAAG,OAAO;CAElC,IAAI,MAAM,QAAQ,CAAC,GAAG;EACpB,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,OAAO;EAC9B,IAAI,EAAE,WAAW,EAAE,QAAQ,OAAO;EAClC,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAC5B,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO;EAErC,OAAO;CACT;CAEA,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;EAClD,MAAM,OAAO;EACb,MAAM,OAAO;EACb,MAAM,QAAQ,OAAO,KAAK,IAAI;EAC9B,MA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AW,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;EAC3E,KAAK,cAAc;EACnB,KAAK,UAAU,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;EACrD,KAAK,kBAAkB,OAAO,KAAK,MAAM,EAAE,IAAI;EAC/C,WAAW,IAAI;CACjB;CAEA,OAAU,SAAmC;EAC3C,OAAO,QAAQ,OAAO,IAAI;CAC5B;CAEA,WAAW,MAAiD;EAC1D,OAAO,KAAK,QAAQ,IAAI,IAAI;CAC9B;AACF;;;AClBA,IAAa,uBAAb,cAA0C,kBAAkB;CAC1D,OAAgB;CAChB;CACA;CACA;CAEA,YAAY,SAAsC;EAChD,MAAM;EACN,KAAK,aAAa,QAAQ;EAC1B,KAAK,kBAAkB,QAAQ;EAC/B,KAAK,mBAAmB,QAAQ;EAChC,WAAW,IAAI;CACjB;CAEA,OAAU,SAAmC;EAC3C,OAAO,QAAQ,UAAU,IAAI;CAC/B;AACF"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/mongo-schema-ir",
|
|
3
|
-
"version": "0.13.0-dev.
|
|
3
|
+
"version": "0.13.0-dev.40",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"description": "MongoDB schema IR AST for migration diffing",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/framework-components": "0.13.0-dev.
|
|
10
|
-
"@prisma-next/mongo-contract": "0.13.0-dev.
|
|
9
|
+
"@prisma-next/framework-components": "0.13.0-dev.40",
|
|
10
|
+
"@prisma-next/mongo-contract": "0.13.0-dev.40",
|
|
11
|
+
"@prisma-next/mongo-value": "0.13.0-dev.40",
|
|
12
|
+
"mongodb": "^7.2.0"
|
|
11
13
|
},
|
|
12
14
|
"devDependencies": {
|
|
13
|
-
"@prisma-next/test-utils": "0.13.0-dev.
|
|
14
|
-
"@prisma-next/tsconfig": "0.13.0-dev.
|
|
15
|
-
"@prisma-next/tsdown": "0.13.0-dev.
|
|
15
|
+
"@prisma-next/test-utils": "0.13.0-dev.40",
|
|
16
|
+
"@prisma-next/tsconfig": "0.13.0-dev.40",
|
|
17
|
+
"@prisma-next/tsdown": "0.13.0-dev.40",
|
|
16
18
|
"tsdown": "0.22.1",
|
|
17
19
|
"typescript": "5.9.3",
|
|
18
20
|
"vitest": "4.1.8"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { freezeNode } from '@prisma-next/framework-components/ir';
|
|
2
|
+
import type { CollationOptions } from '@prisma-next/mongo-value/mongodb-types';
|
|
2
3
|
import { MongoSchemaIRNode } from './schema-node';
|
|
3
4
|
import type { MongoSchemaVisitor } from './visitor';
|
|
4
5
|
|
|
@@ -9,7 +10,7 @@ export interface MongoSchemaCollectionOptionsInput {
|
|
|
9
10
|
metaField?: string;
|
|
10
11
|
granularity?: 'seconds' | 'minutes' | 'hours';
|
|
11
12
|
};
|
|
12
|
-
readonly collation?:
|
|
13
|
+
readonly collation?: CollationOptions;
|
|
13
14
|
readonly changeStreamPreAndPostImages?: { enabled: boolean };
|
|
14
15
|
readonly clusteredIndex?: { name?: string };
|
|
15
16
|
}
|
|
@@ -20,7 +21,7 @@ export class MongoSchemaCollectionOptions extends MongoSchemaIRNode {
|
|
|
20
21
|
readonly timeseries?:
|
|
21
22
|
| { timeField: string; metaField?: string; granularity?: 'seconds' | 'minutes' | 'hours' }
|
|
22
23
|
| undefined;
|
|
23
|
-
readonly collation?:
|
|
24
|
+
readonly collation?: CollationOptions | undefined;
|
|
24
25
|
readonly changeStreamPreAndPostImages?: { enabled: boolean } | undefined;
|
|
25
26
|
readonly clusteredIndex?: { name?: string } | undefined;
|
|
26
27
|
|
package/src/schema-index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { freezeNode } from '@prisma-next/framework-components/ir';
|
|
2
2
|
import type { MongoIndexKey } from '@prisma-next/mongo-contract';
|
|
3
|
+
import type { CollationOptions } from '@prisma-next/mongo-value/mongodb-types';
|
|
3
4
|
import { MongoSchemaIRNode } from './schema-node';
|
|
4
5
|
import type { MongoSchemaVisitor } from './visitor';
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ export interface MongoSchemaIndexOptions {
|
|
|
10
11
|
readonly expireAfterSeconds?: number | undefined;
|
|
11
12
|
readonly partialFilterExpression?: Record<string, unknown> | undefined;
|
|
12
13
|
readonly wildcardProjection?: Record<string, 0 | 1> | undefined;
|
|
13
|
-
readonly collation?:
|
|
14
|
+
readonly collation?: CollationOptions | undefined;
|
|
14
15
|
readonly weights?: Record<string, number> | undefined;
|
|
15
16
|
readonly default_language?: string | undefined;
|
|
16
17
|
readonly language_override?: string | undefined;
|
|
@@ -24,7 +25,7 @@ export class MongoSchemaIndex extends MongoSchemaIRNode {
|
|
|
24
25
|
readonly expireAfterSeconds?: number | undefined;
|
|
25
26
|
readonly partialFilterExpression?: Record<string, unknown> | undefined;
|
|
26
27
|
readonly wildcardProjection?: Record<string, 0 | 1> | undefined;
|
|
27
|
-
readonly collation?:
|
|
28
|
+
readonly collation?: CollationOptions | undefined;
|
|
28
29
|
readonly weights?: Record<string, number> | undefined;
|
|
29
30
|
readonly default_language?: string | undefined;
|
|
30
31
|
readonly language_override?: string | undefined;
|