assai 0.0.1 → 0.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assai",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "repository": {
5
5
  "url": "https://github.com/TimeLord2010/assai",
6
6
  "type": "git"
@@ -15,6 +15,10 @@
15
15
  "mongodb",
16
16
  "orm"
17
17
  ],
18
+ "files": [
19
+ "index.mjs",
20
+ "src/"
21
+ ],
18
22
  "author": "Vinícius Gabriel",
19
23
  "license": "ISC",
20
24
  "dependencies": {
package/bash/publish.sh DELETED
@@ -1,3 +0,0 @@
1
- npm run test || exit -1
2
-
3
- npm publish
package/jsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": true,
4
- "checkJs": true,
5
- "strictNullChecks": true,
6
- "module": "ES2022",
7
- "target": "ES2022",
8
- "moduleResolution": "node"
9
- }
10
- }
@@ -1,53 +0,0 @@
1
- import { fakerPT_BR } from '@faker-js/faker'
2
- import { ObjectId } from 'mongodb'
3
- import { after, before } from 'node:test'
4
- import { closeMongoClient } from '../src/mongo_client.mjs'
5
- import { generateNewId } from '../src/usecases/generate_new_id.mjs'
6
- import { deleteOne } from '../src/usecases/operation/delete_one.mjs'
7
- import { insertOne } from '../src/usecases/operation/insert_one.mjs'
8
- import { mockGetCollection } from './mock_get_collection.mjs'
9
-
10
- /**
11
- *
12
- * @param {import('./mock_get_collection.mjs').ItestCollection} param
13
- * @param {object} options
14
- * @param {boolean} [options.deleteAtEnd]
15
- */
16
- export function manageMockRegistry({ tag, ...rest } = {}, {
17
- deleteAtEnd = true
18
- } = {}) {
19
-
20
- const id = generateNewId()
21
- const name = rest.name ?? fakerPT_BR.person.fullName()
22
-
23
- before(async () => {
24
- await insertOne({
25
- // @ts-ignore
26
- getCollection: mockGetCollection,
27
- doc: {
28
- id,
29
- createdAt: new Date(),
30
- tag,
31
- name: name,
32
- ...rest,
33
- },
34
- })
35
- })
36
-
37
- after(async () => {
38
- if (deleteAtEnd) {
39
- await deleteOne({
40
- query: {
41
- _id: ObjectId.createFromHexString(id)
42
- },
43
- // @ts-ignore
44
- getCollection: mockGetCollection,
45
- })
46
- }
47
- await closeMongoClient()
48
- })
49
-
50
- return {
51
- id, name
52
- }
53
- }
@@ -1,21 +0,0 @@
1
- import { Collection, ObjectId } from 'mongodb'
2
- import { getMongoClient } from '../src/mongo_client.mjs'
3
-
4
- export async function mockGetCollection(collectionName = 'test') {
5
- const client = await getMongoClient()
6
- const db = client.db()
7
- /** @type {Collection<ItestCollection>} */
8
- const collection = db.collection(collectionName)
9
- return collection
10
- }
11
-
12
- /**
13
- * @typedef {object} ItestCollection
14
- * @property {ObjectId} [_id]
15
- * @property {string} [id]
16
- * @property {string} [name]
17
- * @property {string | ObjectId} [tag]
18
- * @property {Date} [createdAt]
19
- * @property {object[]} [posts]
20
- * @property {object} [address]
21
- */