@qrush/types 1.0.0 → 1.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.
- package/README.md +118 -5
- package/dist/WebappUsers.d.ts +14 -0
- package/dist/WebappUsers.js +1 -0
- package/dist/firebase.d.ts +5 -0
- package/dist/firebase.js +12 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -1,15 +1,128 @@
|
|
|
1
|
-
# qrush
|
|
1
|
+
# @qrush/types
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared TypeScript types for the QRush ecosystem. This package provides type definitions for common data structures used across QRush applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @qrush/types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Full Import
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { User, Event, Promotion, Location } from '@qrush/types';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Selective Imports
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// Import specific modules
|
|
23
|
+
import { User, UserRole } from '@qrush/types/Users';
|
|
24
|
+
import { Event, EventStatus } from '@qrush/types/Events';
|
|
25
|
+
import { Promotion, PromotionType } from '@qrush/types/Promotion';
|
|
26
|
+
import { Location, LocationType } from '@qrush/types/Location';
|
|
27
|
+
import { Genre } from '@qrush/types/Genres';
|
|
28
|
+
import { Meta } from '@qrush/types/Meta';
|
|
29
|
+
import { CommonFields } from '@qrush/types/Common';
|
|
30
|
+
import { CustomDocType } from '@qrush/types/CustomDocType';
|
|
31
|
+
import { Timestamp, GeoPoint, formatTimestamp } from '@qrush/types/firebase';
|
|
32
|
+
import { IFireWebappUser, FireWebappUserSnapshotRef } from '@qrush/types/WebappUsers';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Available Types
|
|
36
|
+
|
|
37
|
+
- **Users** - User profiles, roles, and authentication types
|
|
38
|
+
- **Events** - Event data structures and status types
|
|
39
|
+
- **Promotions** - Promotion and marketing campaign types
|
|
40
|
+
- **Location** - Geographic and venue-related types
|
|
41
|
+
- **Genres** - Music and entertainment genre definitions
|
|
42
|
+
- **Meta** - Metadata and configuration types
|
|
43
|
+
- **Common** - Shared utility types and interfaces
|
|
44
|
+
- **CustomDocType** - Custom document type definitions
|
|
45
|
+
- **firebase** - Firebase/Firestore type re-exports and utilities
|
|
46
|
+
- **WebappUsers** - Web application specific user types and interfaces
|
|
47
|
+
|
|
48
|
+
## Development
|
|
49
|
+
|
|
50
|
+
### Prerequisites
|
|
51
|
+
|
|
52
|
+
- [Bun](https://bun.sh) v1.1.1 or later
|
|
53
|
+
- Node.js 18+ (for npm publishing)
|
|
54
|
+
|
|
55
|
+
### Setup
|
|
4
56
|
|
|
5
57
|
```bash
|
|
58
|
+
# Install dependencies
|
|
6
59
|
bun install
|
|
60
|
+
|
|
61
|
+
# Build the project
|
|
62
|
+
bun run build
|
|
63
|
+
|
|
64
|
+
# Build and watch for changes
|
|
65
|
+
bun run build --watch
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Project Structure
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
src/
|
|
72
|
+
├── index.ts # Main entry point
|
|
73
|
+
├── Common.ts # Shared utility types
|
|
74
|
+
├── Users.ts # User-related types
|
|
75
|
+
├── Events.ts # Event-related types
|
|
76
|
+
├── Promotion.ts # Promotion types
|
|
77
|
+
├── Location.ts # Location types
|
|
78
|
+
├── Genres.ts # Genre definitions
|
|
79
|
+
├── Meta.ts # Metadata types
|
|
80
|
+
├── CustomDocType.ts # Custom document types
|
|
81
|
+
├── firebase.ts # Firebase/Firestore type utilities
|
|
82
|
+
└── WebappUsers.ts # Web application user types
|
|
7
83
|
```
|
|
8
84
|
|
|
9
|
-
|
|
85
|
+
## Publishing
|
|
86
|
+
|
|
87
|
+
This package uses automated publishing via GitHub Actions:
|
|
88
|
+
|
|
89
|
+
### Automatic Publishing (Recommended)
|
|
90
|
+
|
|
91
|
+
1. Update the version in `package.json`
|
|
92
|
+
2. Commit your changes
|
|
93
|
+
3. Create and push a version tag:
|
|
10
94
|
|
|
11
95
|
```bash
|
|
12
|
-
|
|
96
|
+
git add .
|
|
97
|
+
git commit -m "Release v1.0.1"
|
|
98
|
+
git tag v1.0.1
|
|
99
|
+
git push origin v1.0.1
|
|
13
100
|
```
|
|
14
101
|
|
|
15
|
-
|
|
102
|
+
### Manual Publishing
|
|
103
|
+
|
|
104
|
+
1. Go to the GitHub repository
|
|
105
|
+
2. Navigate to **Actions** tab
|
|
106
|
+
3. Select **"Manual Publish to NPM"** workflow
|
|
107
|
+
4. Click **"Run workflow"**
|
|
108
|
+
5. Choose version bump type (patch/minor/major)
|
|
109
|
+
6. Click **"Run workflow"**
|
|
110
|
+
|
|
111
|
+
## Dependencies
|
|
112
|
+
|
|
113
|
+
### Peer Dependencies
|
|
114
|
+
|
|
115
|
+
- `@firebase/firestore` >=4.0.0
|
|
116
|
+
|
|
117
|
+
### Dev Dependencies
|
|
118
|
+
|
|
119
|
+
- `typescript` ^5.4.5
|
|
120
|
+
- `@firebase/firestore` ^4.6.3
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
This project is part of the QRush ecosystem.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
Built with [Bun](https://bun.sh) 🚀
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FireQueryDocSnapshotRef } from "./CustomDocType.js";
|
|
2
|
+
import { UserRole } from "./Users.js";
|
|
3
|
+
import { Timestamp } from "@firebase/firestore";
|
|
4
|
+
export type IFireWebappUser = {
|
|
5
|
+
email: string;
|
|
6
|
+
name: string;
|
|
7
|
+
createdAt: Timestamp;
|
|
8
|
+
locationIds: string[];
|
|
9
|
+
role?: UserRole;
|
|
10
|
+
isApproved?: boolean;
|
|
11
|
+
ownedPromotionIds?: string[];
|
|
12
|
+
preferredLanguage?: string;
|
|
13
|
+
};
|
|
14
|
+
export type FireWebappUserSnapshotRef = FireQueryDocSnapshotRef<IFireWebappUser>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Timestamp, GeoPoint, QueryDocumentSnapshot, DocumentData, FieldValue } from '@firebase/firestore';
|
|
2
|
+
export type { Timestamp, GeoPoint, QueryDocumentSnapshot, DocumentData, FieldValue };
|
|
3
|
+
export type FirebaseTimestamp = Timestamp;
|
|
4
|
+
export type FirebaseGeoPoint = GeoPoint;
|
|
5
|
+
export declare function formatTimestamp(timestamp: Timestamp | undefined): string;
|
package/dist/firebase.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Utility function to format Firebase Timestamp for display
|
|
2
|
+
export function formatTimestamp(timestamp) {
|
|
3
|
+
if (!timestamp)
|
|
4
|
+
return "Unknown";
|
|
5
|
+
const date = timestamp.toDate();
|
|
6
|
+
// Simple date formatting without external dependencies
|
|
7
|
+
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
8
|
+
const month = months[date.getMonth()];
|
|
9
|
+
const day = date.getDate();
|
|
10
|
+
const year = date.getFullYear();
|
|
11
|
+
return `${month} ${day.toString().padStart(2, '0')}, ${year}`;
|
|
12
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,3 +3,8 @@ export * from './Events.js';
|
|
|
3
3
|
export * from './Users.js';
|
|
4
4
|
export * from './Location.js';
|
|
5
5
|
export * from './Common.js';
|
|
6
|
+
export * from './CustomDocType.js';
|
|
7
|
+
export * from './Genres.js';
|
|
8
|
+
export * from './Meta.js';
|
|
9
|
+
export * from './firebase.js';
|
|
10
|
+
export * from './WebappUsers.js';
|
package/dist/index.js
CHANGED
|
@@ -3,3 +3,8 @@ export * from './Events.js';
|
|
|
3
3
|
export * from './Users.js';
|
|
4
4
|
export * from './Location.js';
|
|
5
5
|
export * from './Common.js';
|
|
6
|
+
export * from './CustomDocType.js';
|
|
7
|
+
export * from './Genres.js';
|
|
8
|
+
export * from './Meta.js';
|
|
9
|
+
export * from './firebase.js';
|
|
10
|
+
export * from './WebappUsers.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qrush/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Shared TypeScript types for the QRush ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -56,6 +56,14 @@
|
|
|
56
56
|
"./Meta": {
|
|
57
57
|
"import": "./dist/Meta.js",
|
|
58
58
|
"types": "./dist/Meta.d.ts"
|
|
59
|
+
},
|
|
60
|
+
"./firebase": {
|
|
61
|
+
"import": "./dist/firebase.js",
|
|
62
|
+
"types": "./dist/firebase.d.ts"
|
|
63
|
+
},
|
|
64
|
+
"./WebappUsers": {
|
|
65
|
+
"import": "./dist/WebappUsers.js",
|
|
66
|
+
"types": "./dist/WebappUsers.d.ts"
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
}
|