@jaypie/mcp 0.1.9 → 0.2.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/datadog.d.ts +212 -0
- package/dist/index.js +1461 -6
- package/dist/index.js.map +1 -1
- package/package.json +10 -7
- package/prompts/Development_Process.md +57 -35
- package/prompts/Jaypie_CDK_Constructs_and_Patterns.md +143 -19
- package/prompts/Jaypie_Express_Package.md +408 -0
- package/prompts/Jaypie_Init_Express_on_Lambda.md +66 -38
- package/prompts/Jaypie_Init_Lambda_Package.md +202 -83
- package/prompts/Jaypie_Init_Project_Subpackage.md +21 -26
- package/prompts/Jaypie_Legacy_Patterns.md +4 -0
- package/prompts/Templates_CDK_Subpackage.md +113 -0
- package/prompts/Templates_Express_Subpackage.md +183 -0
- package/prompts/Templates_Project_Monorepo.md +326 -0
- package/prompts/Templates_Project_Subpackage.md +93 -0
- package/LICENSE.txt +0 -21
- package/prompts/Jaypie_Mongoose_Models_Package.md +0 -231
- package/prompts/Jaypie_Mongoose_with_Express_CRUD.md +0 -1000
- package/prompts/templates/cdk-subpackage/bin/cdk.ts +0 -11
- package/prompts/templates/cdk-subpackage/cdk.json +0 -19
- package/prompts/templates/cdk-subpackage/lib/cdk-app.ts +0 -41
- package/prompts/templates/cdk-subpackage/lib/cdk-infrastructure.ts +0 -15
- package/prompts/templates/express-subpackage/index.ts +0 -8
- package/prompts/templates/express-subpackage/src/app.ts +0 -18
- package/prompts/templates/express-subpackage/src/handler.config.ts +0 -44
- package/prompts/templates/express-subpackage/src/routes/resource/__tests__/resourceGet.route.spec.ts +0 -29
- package/prompts/templates/express-subpackage/src/routes/resource/resourceGet.route.ts +0 -22
- package/prompts/templates/express-subpackage/src/routes/resource.router.ts +0 -11
- package/prompts/templates/express-subpackage/src/types/express.ts +0 -9
- package/prompts/templates/project-monorepo/.vscode/settings.json +0 -72
- package/prompts/templates/project-monorepo/eslint.config.mjs +0 -1
- package/prompts/templates/project-monorepo/gitignore +0 -11
- package/prompts/templates/project-monorepo/package.json +0 -20
- package/prompts/templates/project-monorepo/tsconfig.base.json +0 -18
- package/prompts/templates/project-monorepo/tsconfig.json +0 -6
- package/prompts/templates/project-monorepo/vitest.workspace.js +0 -3
- package/prompts/templates/project-subpackage/package.json +0 -16
- package/prompts/templates/project-subpackage/tsconfig.json +0 -11
- package/prompts/templates/project-subpackage/vite.config.ts +0 -21
- package/prompts/templates/project-subpackage/vitest.config.ts +0 -7
- package/prompts/templates/project-subpackage/vitest.setup.ts +0 -6
package/LICENSE.txt
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Finlayson Studio, LLC
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Document describes a Jaypie pattern repeated in many projects but not yet offered as a package within Jaypie
|
|
3
|
-
globs: packages/models/**
|
|
4
|
-
status: Work in Progress
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Jaypie Mongoose Models Package
|
|
8
|
-
|
|
9
|
-
Create reusable MongoDB models with rich relationship management using Mongoose and Jaypie.
|
|
10
|
-
|
|
11
|
-
## Goal
|
|
12
|
-
|
|
13
|
-
Define document schemas with bidirectional relationships and consistent utilities for mongoose models.
|
|
14
|
-
|
|
15
|
-
## Guidelines
|
|
16
|
-
|
|
17
|
-
- Uses ES modules with `.js` extensions (`"type": "module"`)
|
|
18
|
-
- Requires mongoose and jaypie as dependencies
|
|
19
|
-
- Follows schema organization pattern: definition → hooks → methods → statics → export
|
|
20
|
-
- Every schema should use `projectSchema.plugin.js` for relationship methods
|
|
21
|
-
- Every document has `uuid` field for external references
|
|
22
|
-
|
|
23
|
-
## Process
|
|
24
|
-
|
|
25
|
-
### Package Setup
|
|
26
|
-
|
|
27
|
-
1. Create package structure:
|
|
28
|
-
```
|
|
29
|
-
models/
|
|
30
|
-
├── package.json
|
|
31
|
-
├── src/
|
|
32
|
-
│ ├── constants.js
|
|
33
|
-
│ ├── index.js
|
|
34
|
-
│ ├── user.schema.js
|
|
35
|
-
│ ├── projectSchema.plugin.js
|
|
36
|
-
│ └── __tests__/
|
|
37
|
-
│ ├── constants.spec.js
|
|
38
|
-
│ ├── index.spec.js
|
|
39
|
-
│ ├── user.schema.spec.js
|
|
40
|
-
│ └── projectSchema.plugin.spec.js
|
|
41
|
-
├── testSetup.js
|
|
42
|
-
└── vite.config.js
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
2. Configure package.json:
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"name": "@yournamespace/models",
|
|
49
|
-
"type": "module",
|
|
50
|
-
"exports": {
|
|
51
|
-
".": {
|
|
52
|
-
"default": {
|
|
53
|
-
"require": "./dist/module.cjs.js",
|
|
54
|
-
"default": "./src/index.js"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"main": "src/index.js",
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"jaypie": "^1.1.0",
|
|
61
|
-
"mongoose": "^7.0.0"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Core Files Implementation
|
|
67
|
-
|
|
68
|
-
1. projectSchema.plugin.js
|
|
69
|
-
- Plugin providing relationship management methods
|
|
70
|
-
- Key functions: allLeanByIds, allLeanByUuids, createWithRelationships, deleteWithRelationships, toJsonWithRelationships, updateWithRelationships
|
|
71
|
-
- Utility functions: idsToUuids, uuidsToIds, oneByUuid, oneByXid
|
|
72
|
-
|
|
73
|
-
2. constants.ts
|
|
74
|
-
```typescript
|
|
75
|
-
import { v5 as uuidv5 } from "uuid";
|
|
76
|
-
|
|
77
|
-
const NAMESPACE_ROOT = "your-namespace-uuid";
|
|
78
|
-
export const NAMESPACE = {
|
|
79
|
-
USER: uuidv5("USER", NAMESPACE_ROOT),
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const SCHEMA = {
|
|
83
|
-
USER: "user",
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default {
|
|
87
|
-
NAMESPACE,
|
|
88
|
-
SCHEMA,
|
|
89
|
-
};
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
3. user.schema.ts
|
|
93
|
-
```typescript
|
|
94
|
-
import { Schema } from "mongoose";
|
|
95
|
-
import projectSchema from "./projectSchema.plugin.js";
|
|
96
|
-
|
|
97
|
-
const schema = new Schema(
|
|
98
|
-
{
|
|
99
|
-
deletedAt: {
|
|
100
|
-
type: Schema.Types.Date,
|
|
101
|
-
},
|
|
102
|
-
name: {
|
|
103
|
-
type: Schema.Types.String,
|
|
104
|
-
},
|
|
105
|
-
uuid: {
|
|
106
|
-
index: true,
|
|
107
|
-
type: Schema.Types.String,
|
|
108
|
-
},
|
|
109
|
-
xid: {
|
|
110
|
-
index: true,
|
|
111
|
-
type: Schema.Types.String,
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{ timestamps: true },
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
schema.plugin(projectSchema);
|
|
118
|
-
|
|
119
|
-
export default schema;
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
4. index.ts
|
|
123
|
-
```typescript
|
|
124
|
-
import { connect, disconnect, envsKey, log } from "jaypie";
|
|
125
|
-
import mongoose, { Model, Schema } from "mongoose";
|
|
126
|
-
import { SCHEMA } from "./constants.js";
|
|
127
|
-
import userSchema from "./user.schema.js";
|
|
128
|
-
|
|
129
|
-
let instantiatedModel: Record<string, Model<any>> | null;
|
|
130
|
-
const { model } = mongoose;
|
|
131
|
-
|
|
132
|
-
function getModel(name: string, schema: Schema): Model<any> {
|
|
133
|
-
if (!instantiatedModel) {
|
|
134
|
-
log.warn("[@yournamespace/models] Models have not been instantiated");
|
|
135
|
-
instantiatedModel = {};
|
|
136
|
-
}
|
|
137
|
-
return instantiatedModel[name] || (instantiatedModel[name] = model(name, schema));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export default {
|
|
141
|
-
connect: async (uri: string = envsKey("MONGODB_URI")) => {
|
|
142
|
-
if (instantiatedModel) {
|
|
143
|
-
log.warn("[@yournamespace/models] Models already instantiated");
|
|
144
|
-
} else {
|
|
145
|
-
instantiatedModel = {};
|
|
146
|
-
}
|
|
147
|
-
return uri ? mongoose.connect(uri) : connect();
|
|
148
|
-
},
|
|
149
|
-
disconnect: () => {
|
|
150
|
-
instantiatedModel = null;
|
|
151
|
-
return disconnect();
|
|
152
|
-
},
|
|
153
|
-
get User() {
|
|
154
|
-
return getModel(SCHEMA.USER, userSchema);
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
export { default as MODEL } from "./constants.js";
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Testing
|
|
162
|
-
|
|
163
|
-
1. vite.config.ts
|
|
164
|
-
```typescript
|
|
165
|
-
import { defineConfig } from "vite";
|
|
166
|
-
|
|
167
|
-
export default defineConfig({
|
|
168
|
-
test: {
|
|
169
|
-
globals: false,
|
|
170
|
-
setupFiles: ["./testSetup.ts"],
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
2. testSetup.ts
|
|
176
|
-
```typescript
|
|
177
|
-
import { beforeEach, vi } from "vitest";
|
|
178
|
-
import mongoose from "mongoose";
|
|
179
|
-
|
|
180
|
-
// Mock mongoose methods
|
|
181
|
-
vi.mock("mongoose", async () => {
|
|
182
|
-
const actual = await vi.importActual("mongoose");
|
|
183
|
-
return {
|
|
184
|
-
...actual,
|
|
185
|
-
connect: vi.fn().mockResolvedValue({}),
|
|
186
|
-
disconnect: vi.fn().mockResolvedValue({}),
|
|
187
|
-
};
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// Reset mocks before each test
|
|
191
|
-
beforeEach(() => {
|
|
192
|
-
vi.clearAllMocks();
|
|
193
|
-
});
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Usage
|
|
197
|
-
|
|
198
|
-
1. Connect to database:
|
|
199
|
-
```typescript
|
|
200
|
-
import Model from "@yournamespace/models";
|
|
201
|
-
|
|
202
|
-
await Model.connect();
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
2. Create document:
|
|
206
|
-
```typescript
|
|
207
|
-
const user = await Model.User.createWithRelationships({
|
|
208
|
-
uuid: "user-uuid",
|
|
209
|
-
values: { name: "Test User" },
|
|
210
|
-
});
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
3. Find document:
|
|
214
|
-
```typescript
|
|
215
|
-
const user = await Model.User.oneByUuid("user-uuid");
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
4. Update with relationships:
|
|
219
|
-
```typescript
|
|
220
|
-
await Model.User.updateWithRelationships({
|
|
221
|
-
uuid: "user-uuid",
|
|
222
|
-
values: { name: "Updated Name" },
|
|
223
|
-
});
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
5. Delete with relationships:
|
|
227
|
-
```typescript
|
|
228
|
-
await Model.User.deleteWithRelationships({
|
|
229
|
-
uuid: "user-uuid",
|
|
230
|
-
});
|
|
231
|
-
```
|