@justins-home/factories 0.1.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.
@@ -0,0 +1,14 @@
1
+  WARN  Issue while reading "/home/runner/work/justins-home-platform-ui/justins-home-platform-ui/.npmrc". Failed to replace env in config: ${NODE_AUTH_TOKEN}
2
+
3
+ > @justins-home/factories@0.1.0 build /home/runner/work/justins-home-platform-ui/justins-home-platform-ui/packages/factories
4
+ > tsup src/index.ts --format esm,cjs
5
+
6
+ CLI Building entry: src/index.ts
7
+ CLI tsup v8.5.1
8
+ CLI Target: node16
9
+ ESM Build start
10
+ CJS Build start
11
+ ESM dist/index.mjs 1009.00 B
12
+ ESM ⚡️ Build success in 53ms
13
+ CJS dist/index.js 2.05 KB
14
+ CJS ⚡️ Build success in 53ms
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # @justins-home/factories
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - aced108: added minor pumb
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [aced108]
12
+ - Updated dependencies [26690e2]
13
+ - @justins-home/enums@0.1.0
14
+ - @justins-home/types@1.0.0
15
+
16
+ ## 0.0.1
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [3f39ece]
21
+ - @justins-home/types@0.0.2
package/dist/index.js ADDED
@@ -0,0 +1,76 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/index.ts
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ createListing: () => createListing,
23
+ createTenancy: () => createTenancy,
24
+ createTenant: () => createTenant
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // src/createListing.ts
29
+ function createListing(overrides = {}) {
30
+ return {
31
+ uid: "lst_" + Math.random().toString(36).slice(2),
32
+ vertical: "property",
33
+ listing_type: "rent",
34
+ state: "draft",
35
+ is_visible: false,
36
+ price: {
37
+ amount: "1000",
38
+ currency: "GBP"
39
+ },
40
+ ...overrides
41
+ };
42
+ }
43
+
44
+ // src/createTenant.ts
45
+ function createTenant(overrides = {}) {
46
+ return {
47
+ id: Math.floor(Math.random() * 1e3),
48
+ uid: "usr_" + Math.random().toString(36).slice(2),
49
+ name: "Mock Tenant",
50
+ ...overrides
51
+ };
52
+ }
53
+
54
+ // src/createTenancy.ts
55
+ function createTenancy(overrides = {}) {
56
+ return {
57
+ uid: "ten_" + Math.random().toString(36).slice(2),
58
+ listing_id: 1,
59
+ landlord_id: 1,
60
+ tenant_id: 2,
61
+ rent_amount: "1000",
62
+ deposit_amount: "1000",
63
+ state: "enquiry",
64
+ start_date: null,
65
+ end_date: null,
66
+ is_periodic: false,
67
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
68
+ ...overrides
69
+ };
70
+ }
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ createListing,
74
+ createTenancy,
75
+ createTenant
76
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,48 @@
1
+ // src/createListing.ts
2
+ function createListing(overrides = {}) {
3
+ return {
4
+ uid: "lst_" + Math.random().toString(36).slice(2),
5
+ vertical: "property",
6
+ listing_type: "rent",
7
+ state: "draft",
8
+ is_visible: false,
9
+ price: {
10
+ amount: "1000",
11
+ currency: "GBP"
12
+ },
13
+ ...overrides
14
+ };
15
+ }
16
+
17
+ // src/createTenant.ts
18
+ function createTenant(overrides = {}) {
19
+ return {
20
+ id: Math.floor(Math.random() * 1e3),
21
+ uid: "usr_" + Math.random().toString(36).slice(2),
22
+ name: "Mock Tenant",
23
+ ...overrides
24
+ };
25
+ }
26
+
27
+ // src/createTenancy.ts
28
+ function createTenancy(overrides = {}) {
29
+ return {
30
+ uid: "ten_" + Math.random().toString(36).slice(2),
31
+ listing_id: 1,
32
+ landlord_id: 1,
33
+ tenant_id: 2,
34
+ rent_amount: "1000",
35
+ deposit_amount: "1000",
36
+ state: "enquiry",
37
+ start_date: null,
38
+ end_date: null,
39
+ is_periodic: false,
40
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
41
+ ...overrides
42
+ };
43
+ }
44
+ export {
45
+ createListing,
46
+ createTenancy,
47
+ createTenant
48
+ };
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@justins-home/factories",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "main": "src/index.ts",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "dependencies": {
10
+ "@justins-home/types": "1.0.0",
11
+ "@justins-home/enums": "0.1.0"
12
+ },
13
+ "scripts": {
14
+ "lint": "eslint src",
15
+ "check-types": "tsc --noEmit -p ../../tsconfig.base.json",
16
+ "build": "tsup src/index.ts --format esm,cjs",
17
+ "test": "vitest"
18
+ }
19
+ }
@@ -0,0 +1,24 @@
1
+ import type { PropertyListingResource } from '@justins-home/types';
2
+
3
+ export function createListing(
4
+ overrides: Partial<PropertyListingResource> = {},
5
+ ): PropertyListingResource {
6
+ return {
7
+ uid: 'lst_' + Math.random().toString(36).slice(2),
8
+
9
+ vertical: 'property',
10
+
11
+ listing_type: 'rent',
12
+
13
+ state: 'draft',
14
+
15
+ is_visible: false,
16
+
17
+ price: {
18
+ amount: '1000',
19
+ currency: 'GBP',
20
+ },
21
+
22
+ ...overrides,
23
+ } as PropertyListingResource;
24
+ }
@@ -0,0 +1,31 @@
1
+ import { TenancyResource } from '@justins-home/types';
2
+
3
+ export function createTenancy(
4
+ overrides: Partial<TenancyResource> = {},
5
+ ): TenancyResource {
6
+ return {
7
+ uid: 'ten_' + Math.random().toString(36).slice(2),
8
+
9
+ listing_id: 1,
10
+
11
+ landlord_id: 1,
12
+
13
+ tenant_id: 2,
14
+
15
+ rent_amount: '1000',
16
+
17
+ deposit_amount: '1000',
18
+
19
+ state: 'enquiry',
20
+
21
+ start_date: null,
22
+
23
+ end_date: null,
24
+
25
+ is_periodic: false,
26
+
27
+ created_at: new Date().toISOString(),
28
+
29
+ ...overrides,
30
+ };
31
+ }
@@ -0,0 +1,13 @@
1
+ import { UserType } from '@justins-home/types';
2
+
3
+ export function createTenant(overrides: Partial<UserType> = {}): UserType {
4
+ return {
5
+ id: Math.floor(Math.random() * 1000),
6
+
7
+ uid: 'usr_' + Math.random().toString(36).slice(2),
8
+
9
+ name: 'Mock Tenant',
10
+
11
+ ...overrides,
12
+ };
13
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './createListing';
2
+ export * from './createTenant';
3
+ export * from './createTenancy';