mongoose 7.8.10 → 7.8.11

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/gh-16033.ts DELETED
@@ -1,35 +0,0 @@
1
- import mongoose, { Schema, Model, PipelineStage } from 'mongoose';
2
-
3
- // Simple Item schema
4
- const itemSchema = new Schema({ text: String, published: Boolean });
5
- const Item: Model<any> = mongoose.model('Item', itemSchema);
6
-
7
- type UnionSubPipelineStage = Exclude<
8
- PipelineStage,
9
- PipelineStage.Out | PipelineStage.Merge
10
- >;
11
-
12
- function isUnionSubPipelineStage(stage: PipelineStage): stage is UnionSubPipelineStage {
13
- return !('$out' in stage) && !('$merge' in stage);
14
- }
15
-
16
- function toUnionSubPipeline(stages: PipelineStage[]): UnionSubPipelineStage[] {
17
- if (!stages.every(isUnionSubPipelineStage)) {
18
- throw new Error('unionWith pipeline cannot include $out or $merge');
19
- }
20
- return stages; // already narrowed, no `as`
21
- }
22
-
23
- // Create base pipeline using aggregate builder
24
- const basePipeline = Item.aggregate([
25
- { $match: { published: true } },
26
- { $out: 'test' }
27
- ]);
28
-
29
- // Try to reuse pipeline in unionWith - TypeScript error occurs here
30
- const result = Item.aggregate()
31
- .match({ text: 'example' })
32
- .unionWith({
33
- coll: 'other_items',
34
- pipeline: toUnionSubPipeline(basePipeline.pipeline()) // ❌ TypeScript error
35
- });
package/startmdb.mjs DELETED
@@ -1,19 +0,0 @@
1
- import { MongoMemoryReplSet } from 'mongodb-memory-server';
2
-
3
- const replSet = await MongoMemoryReplSet.create({
4
- binary: {
5
- systemBinary: '/home/v/libs/mongodb-linux-x86_64-enterprise-ubuntu2404-8.2.0/bin/mongod'
6
- },
7
- instanceOpts: [
8
- {
9
- port: 27017
10
- }
11
- ],
12
- replSet: {
13
- storageEngine: 'inMemory',
14
- count: 1
15
- }
16
- });
17
-
18
- const uri = replSet.getUri();
19
- console.log(uri);
package/step1.mjs DELETED
@@ -1,44 +0,0 @@
1
- import { tool } from 'ai';
2
- import { execFile } from 'node:child_process';
3
- import { promisify } from 'node:util';
4
- import { z } from 'zod';
5
-
6
- const execFileAsync = promisify(execFile);
7
-
8
- async function run(command, args) {
9
- const { stdout } = await execFileAsync(command, args);
10
- return stdout.trim();
11
- }
12
-
13
- function logToolCall(name, preview) {
14
- console.log(`\n> ${name} ${preview}`);
15
- }
16
-
17
- const git = tool({
18
- description: 'Run a git command like log or diff',
19
- inputSchema: z.object({
20
- subcommand: z.enum(['log', 'diff', 'show']),
21
- args: z.array(z.string()).default([])
22
- }),
23
- execute: async({ subcommand, args }) => {
24
- logToolCall('git', [subcommand, ...args].join(' '));
25
- return run('git', [subcommand, ...args]);
26
- }
27
- });
28
-
29
- import { generateText, stepCountIs } from 'ai';
30
- import { createGoogleGenerativeAI } from '@ai-sdk/google';
31
-
32
- const google = createGoogleGenerativeAI({
33
- apiKey: process.env.GEMINI_API_KEY
34
- });
35
-
36
- const result = await generateText({
37
- model: google('gemini-2.5-flash'),
38
- stopWhen: stepCountIs(10),
39
- system: 'Summarize recent git commits into a concise changelog entry. Focus on user-facing changes.',
40
- prompt: 'Summarize the last 20 commits',
41
- tools: { git }
42
- });
43
-
44
- console.log(result.text);