@terreno/api 0.0.18 → 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/README.md +73 -3
- package/dist/api.d.ts +96 -3
- package/dist/api.js +159 -11
- package/dist/api.test.js +906 -2
- package/dist/auth.js +3 -1
- package/dist/betterAuth.d.ts +91 -0
- package/dist/betterAuth.js +8 -0
- package/dist/betterAuth.test.d.ts +1 -0
- package/dist/betterAuth.test.js +181 -0
- package/dist/betterAuthApp.d.ts +22 -0
- package/dist/betterAuthApp.js +38 -0
- package/dist/betterAuthApp.test.d.ts +1 -0
- package/dist/betterAuthApp.test.js +242 -0
- package/dist/betterAuthSetup.d.ts +60 -0
- package/dist/betterAuthSetup.js +278 -0
- package/dist/betterAuthSetup.test.d.ts +1 -0
- package/dist/betterAuthSetup.test.js +684 -0
- package/dist/errors.js +14 -11
- package/dist/example.js +7 -7
- package/dist/expressServer.js +2 -2
- package/dist/githubAuth.test.js +3 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/openApi.test.js +8 -5
- package/dist/openApiBuilder.d.ts +69 -1
- package/dist/openApiBuilder.js +109 -5
- package/dist/openApiValidator.d.ts +296 -0
- package/dist/openApiValidator.js +698 -0
- package/dist/openApiValidator.test.d.ts +1 -0
- package/dist/openApiValidator.test.js +346 -0
- package/dist/plugins.test.js +3 -3
- package/dist/terrenoApp.d.ts +189 -0
- package/dist/terrenoApp.js +352 -0
- package/dist/terrenoApp.test.d.ts +1 -0
- package/dist/terrenoApp.test.js +264 -0
- package/dist/terrenoPlugin.d.ts +38 -0
- package/dist/terrenoPlugin.js +2 -0
- package/dist/tests.js +34 -24
- package/package.json +8 -2
- package/src/__snapshots__/openApi.test.ts.snap +399 -0
- package/src/__snapshots__/openApiBuilder.test.ts.snap +108 -0
- package/src/api.test.ts +743 -2
- package/src/api.ts +270 -6
- package/src/auth.ts +3 -1
- package/src/betterAuth.test.ts +160 -0
- package/src/betterAuth.ts +104 -0
- package/src/betterAuthApp.test.ts +114 -0
- package/src/betterAuthApp.ts +60 -0
- package/src/betterAuthSetup.test.ts +485 -0
- package/src/betterAuthSetup.ts +251 -0
- package/src/errors.ts +14 -11
- package/src/example.ts +7 -7
- package/src/expressServer.ts +4 -5
- package/src/githubAuth.test.ts +3 -3
- package/src/index.ts +6 -0
- package/src/openApi.test.ts +8 -5
- package/src/openApiBuilder.ts +188 -15
- package/src/openApiValidator.test.ts +241 -0
- package/src/openApiValidator.ts +860 -0
- package/src/plugins.test.ts +3 -3
- package/src/terrenoApp.test.ts +201 -0
- package/src/terrenoApp.ts +347 -0
- package/src/terrenoPlugin.ts +39 -0
- package/src/tests.ts +34 -24
- package/.cursorrules +0 -107
- package/.windsurfrules +0 -107
- package/AGENTS.md +0 -313
- package/dist/response.d.ts +0 -0
- package/dist/response.js +0 -1
- package/index.ts +0 -1
- package/src/response.ts +0 -0
package/dist/tests.js
CHANGED
|
@@ -99,10 +99,10 @@ var supertest_1 = __importDefault(require("supertest"));
|
|
|
99
99
|
var logger_1 = require("./logger");
|
|
100
100
|
var plugins_1 = require("./plugins");
|
|
101
101
|
var userSchema = new mongoose_1.Schema({
|
|
102
|
-
admin: { default: false, type: Boolean },
|
|
103
|
-
age: Number,
|
|
104
|
-
name: String,
|
|
105
|
-
username: String,
|
|
102
|
+
admin: { default: false, description: "Whether the user has admin privileges", type: Boolean },
|
|
103
|
+
age: { description: "The user's age", type: Number },
|
|
104
|
+
name: { description: "The user's display name", type: String },
|
|
105
|
+
username: { description: "The user's username", type: String },
|
|
106
106
|
});
|
|
107
107
|
userSchema.plugin(passport_local_mongoose_1.default, {
|
|
108
108
|
attemptsField: "attempts",
|
|
@@ -126,55 +126,65 @@ userSchema.methods.postCreate = function (body) {
|
|
|
126
126
|
};
|
|
127
127
|
exports.UserModel = (0, mongoose_1.model)("User", userSchema);
|
|
128
128
|
var superUserSchema = new mongoose_1.Schema({
|
|
129
|
-
superTitle: { required: true, type: String },
|
|
129
|
+
superTitle: { description: "The super user's title", required: true, type: String },
|
|
130
130
|
});
|
|
131
131
|
exports.SuperUserModel = exports.UserModel.discriminator("SuperUser", superUserSchema);
|
|
132
132
|
var staffUserSchema = new mongoose_1.Schema({
|
|
133
|
-
department: {
|
|
133
|
+
department: {
|
|
134
|
+
description: "The department the staff member belongs to",
|
|
135
|
+
required: true,
|
|
136
|
+
type: String,
|
|
137
|
+
},
|
|
134
138
|
});
|
|
135
139
|
exports.StaffUserModel = exports.UserModel.discriminator("Staff", staffUserSchema);
|
|
136
140
|
var foodCategorySchema = new mongoose_1.Schema({
|
|
137
|
-
name: String,
|
|
138
|
-
show: Boolean,
|
|
141
|
+
name: { description: "The name of the food category", type: String },
|
|
142
|
+
show: { description: "Whether this category is visible", type: Boolean },
|
|
139
143
|
}, { timestamps: { createdAt: "created", updatedAt: "updated" } });
|
|
140
144
|
var likesSchema = new mongoose_1.Schema({
|
|
141
|
-
likes: Boolean,
|
|
142
|
-
userId: { ref: "User", type: "ObjectId" },
|
|
145
|
+
likes: { description: "Whether the user liked the item", type: Boolean },
|
|
146
|
+
userId: { description: "The user who liked the item", ref: "User", type: "ObjectId" },
|
|
143
147
|
});
|
|
144
148
|
var foodSchema = new mongoose_1.Schema({
|
|
145
|
-
calories: Number,
|
|
146
|
-
categories: [foodCategorySchema],
|
|
147
|
-
created: Date,
|
|
149
|
+
calories: { description: "Number of calories in the food", type: Number },
|
|
150
|
+
categories: { description: "Categories this food belongs to", type: [foodCategorySchema] },
|
|
151
|
+
created: { description: "When this food was created", type: Date },
|
|
148
152
|
eatenBy: [
|
|
149
153
|
{
|
|
154
|
+
description: "Users who have eaten this food",
|
|
150
155
|
ref: "User",
|
|
151
156
|
required: true,
|
|
152
157
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
153
158
|
},
|
|
154
159
|
],
|
|
155
|
-
expiration: plugins_1.DateOnly,
|
|
156
|
-
hidden: {
|
|
160
|
+
expiration: { description: "Expiration date of the food", type: plugins_1.DateOnly },
|
|
161
|
+
hidden: {
|
|
162
|
+
default: false,
|
|
163
|
+
description: "Whether this food is hidden from listings",
|
|
164
|
+
type: Boolean,
|
|
165
|
+
},
|
|
157
166
|
lastEatenWith: {
|
|
167
|
+
description: "Map of user names to dates they last ate this food with",
|
|
158
168
|
of: Date,
|
|
159
169
|
type: Map,
|
|
160
170
|
},
|
|
161
|
-
likesIds: { required: true, type: [likesSchema] },
|
|
162
|
-
name: String,
|
|
163
|
-
ownerId: { ref: "User", type: "ObjectId" },
|
|
171
|
+
likesIds: { description: "User likes for this food", required: true, type: [likesSchema] },
|
|
172
|
+
name: { description: "The name of the food", type: String },
|
|
173
|
+
ownerId: { description: "The user who owns this food entry", ref: "User", type: "ObjectId" },
|
|
164
174
|
source: {
|
|
165
|
-
dateAdded: String,
|
|
166
|
-
href: String,
|
|
167
|
-
name: String,
|
|
175
|
+
dateAdded: { description: "When the source was added", type: String },
|
|
176
|
+
href: { description: "URL of the source", type: String },
|
|
177
|
+
name: { description: "Name of the source", type: String },
|
|
168
178
|
},
|
|
169
|
-
tags: [String],
|
|
179
|
+
tags: { description: "Tags associated with this food", type: [String] },
|
|
170
180
|
}, { strict: "throw", toJSON: { virtuals: true }, toObject: { virtuals: true } });
|
|
171
181
|
foodSchema.virtual("description").get(function () {
|
|
172
182
|
return "".concat(this.name, " has ").concat(this.calories, " calories");
|
|
173
183
|
});
|
|
174
184
|
exports.FoodModel = (0, mongoose_1.model)("Food", foodSchema);
|
|
175
185
|
var requiredSchema = new mongoose_1.Schema({
|
|
176
|
-
about: String,
|
|
177
|
-
name: { required: true, type: String },
|
|
186
|
+
about: { description: "Information about the item", type: String },
|
|
187
|
+
name: { description: "The name of the item", required: true, type: String },
|
|
178
188
|
});
|
|
179
189
|
exports.RequiredModel = (0, mongoose_1.model)("Required", requiredSchema);
|
|
180
190
|
function getBaseServer() {
|
package/package.json
CHANGED
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@sentry/bun": "^10.25.0",
|
|
8
|
+
"better-auth": "^1.2.8",
|
|
8
9
|
"@sentry/profiling-node": "^10.25.0",
|
|
9
10
|
"@types/qs": "^6.14.0",
|
|
10
11
|
"@wesleytodd/openapi": "^1.1.0",
|
|
12
|
+
"ajv": "8.18.0",
|
|
13
|
+
"ajv-formats": "^3.0.1",
|
|
11
14
|
"axios": "^1.13.2",
|
|
12
15
|
"cors": "^2.8.5",
|
|
13
16
|
"cron": "^4.3.4",
|
|
@@ -15,7 +18,7 @@
|
|
|
15
18
|
"express": "^4.21.2",
|
|
16
19
|
"generaterr": "^1.5.0",
|
|
17
20
|
"jsonwebtoken": "^9.0.2",
|
|
18
|
-
"lodash": "^4.17.
|
|
21
|
+
"lodash": "^4.17.23",
|
|
19
22
|
"luxon": "^3.7.2",
|
|
20
23
|
"mongoose": "8.18.1",
|
|
21
24
|
"mongoose-to-swagger": "^1.4.0",
|
|
@@ -41,6 +44,7 @@
|
|
|
41
44
|
"@types/express": "^4.17.21",
|
|
42
45
|
"@types/jsonwebtoken": "^9.0.9",
|
|
43
46
|
"@types/lodash": "^4.17.15",
|
|
47
|
+
"@types/mongodb": "^4.0.7",
|
|
44
48
|
"@types/node": "^22.13.5",
|
|
45
49
|
"@types/on-finished": "^2.3.4",
|
|
46
50
|
"@types/passport": "^1.0.17",
|
|
@@ -50,6 +54,7 @@
|
|
|
50
54
|
"@types/passport-local": "^1.0.38",
|
|
51
55
|
"@types/sinon": "^17.0.4",
|
|
52
56
|
"@types/supertest": "^6.0.2",
|
|
57
|
+
"mongodb-memory-server": "^11.0.1",
|
|
53
58
|
"sinon": "^19.0.2",
|
|
54
59
|
"supertest": "^7.0.0",
|
|
55
60
|
"typedoc": "~0.27.9",
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
},
|
|
78
83
|
"scripts": {
|
|
79
84
|
"compile": "bun tsc",
|
|
85
|
+
"compile:watch": "bun tsc -w",
|
|
80
86
|
"dev": "bun tsc -w",
|
|
81
87
|
"docs": "typedoc --out docs src/index.ts",
|
|
82
88
|
"lint": "biome check ./src",
|
|
@@ -87,5 +93,5 @@
|
|
|
87
93
|
"updateSnapshot": "bun test --update-snapshots"
|
|
88
94
|
},
|
|
89
95
|
"types": "dist/index.d.ts",
|
|
90
|
-
"version": "0.0
|
|
96
|
+
"version": "0.2.0"
|
|
91
97
|
}
|