@clidey/dory 0.1.0 → 0.3.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 +1 -1
- package/docs/api-playground-demo.mdx +119 -0
- package/docs/api-reference/openapi.json +366 -0
- package/docs/api-reference/operations/create.mdx +5 -0
- package/docs/api-reference/operations/delete.mdx +5 -0
- package/docs/api-reference/operations/get.mdx +5 -0
- package/docs/api-reference/operations/update.mdx +5 -0
- package/docs/assets/dory.jpeg +0 -0
- package/docs/dory.json +12 -131
- package/docs/favicon.svg +75 -0
- package/docs/features.mdx +440 -0
- package/docs/introduction.mdx +44 -0
- package/docs/logo/logo.png +0 -0
- package/package.json +9 -10
- package/src/mdx/fence.tsx +2 -1
- package/src/mdx/mermaid.tsx +39 -11
- package/src/mdx/source.tsx +15 -4
- package/docs/README.md +0 -2
- package/docs/configuration/app-settings/feature-flags.mdx +0 -157
- package/docs/configuration/app-settings/user-settings.mdx +0 -201
- package/docs/configuration/installation-setup/env-vars.mdx +0 -198
- package/docs/configuration/installation-setup/installation.mdx +0 -127
- package/docs/integrations/analytics-monitoring/error-tracking.mdx +0 -199
- package/docs/integrations/analytics-monitoring/notifications.mdx +0 -189
- package/docs/integrations/analytics-monitoring/user-analytics.mdx +0 -182
- package/docs/integrations/shopify-integration/shopify-setup.mdx +0 -226
- package/docs/integrations/shopify-integration/shopify-webhooks.mdx +0 -207
- package/docs/overview/developer-overview/dev-architecture.mdx +0 -292
- package/docs/overview/product-intro/app-overview.mdx +0 -167
- package/docs/overview/product-intro/architecture.mdx +0 -203
- package/docs/overview/product-intro/core-concepts.mdx +0 -267
- package/docs/platform-admin/billing-subscriptions/billing.mdx +0 -176
- package/docs/platform-admin/system-maintenance/db-migrations.mdx +0 -184
- package/docs/platform-admin/system-maintenance/health-monitoring.mdx +0 -222
- package/docs/platform-admin/system-maintenance/queue-management.mdx +0 -234
- package/docs/platform-admin/user-team-management/teams.mdx +0 -170
- package/docs/platform-admin/user-team-management/users.mdx +0 -185
- package/docs/support/legal/dependency-analysis.mdx +0 -132
- package/docs/support/legal/privacy-terms.mdx +0 -73
- package/docs/support/troubleshooting/common-issues.mdx +0 -159
- package/docs/usage/api-usage/api-inventory.mdx +0 -213
- package/docs/usage/api-usage/api-products.mdx +0 -249
- package/docs/usage/api-usage/api-purchase-orders.mdx +0 -289
- package/docs/usage/api-usage/api-reports.mdx +0 -227
- package/docs/usage/api-usage/api-suppliers.mdx +0 -171
- package/docs/usage/api-usage/api-user-management.mdx +0 -171
- package/docs/usage/ui-workflows/bundles.mdx +0 -157
- package/docs/usage/ui-workflows/demand-planning.mdx +0 -210
- package/docs/usage/ui-workflows/favorites.mdx +0 -167
- package/docs/usage/ui-workflows/inventory-management.mdx +0 -179
- package/docs/usage/ui-workflows/onboarding.mdx +0 -215
- package/docs/usage/ui-workflows/purchase-orders.mdx +0 -200
- package/docs/usage/ui-workflows/reports.mdx +0 -257
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 'User Management'
|
|
3
|
-
description: 'User lifecycle management including invitations, authentication, and roles.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## User Management Module
|
|
7
|
-
|
|
8
|
-
### 1. Purpose and Scope
|
|
9
|
-
|
|
10
|
-
The User Management module is a core system component responsible for handling all aspects of user and team management, authentication, authorization, and user context within the Genie application. It solves key problems such as user identity management, secure authentication, team membership and permissions, user notifications, and related settings management.
|
|
11
|
-
|
|
12
|
-
**System Boundaries:**
|
|
13
|
-
- Handles all user-related data and interactions.
|
|
14
|
-
- Manages teams and membership invitations.
|
|
15
|
-
- Authenticates users using JWT-based strategies.
|
|
16
|
-
- Integrates with email module for communication.
|
|
17
|
-
- Supports context-aware services to provide customized user experiences.
|
|
18
|
-
|
|
19
|
-
This module functions as a foundational building block that other application modules depend on for user and team context information, authentication enforcement, and user notifications.
|
|
20
|
-
|
|
21
|
-
### 2. Technical Overview
|
|
22
|
-
|
|
23
|
-
The `UserManagementModule` is implemented using the NestJS framework and follows a modular pattern integrating with various NestJS features and other system modules. This module utilizes TypeORM for ORM data access, Passport.js for authentication strategies, and strongly typed DTOs validated via Zod schemas.
|
|
24
|
-
|
|
25
|
-
#### Architecture Diagram
|
|
26
|
-
```mermaid
|
|
27
|
-
flowchart TD
|
|
28
|
-
subgraph "User Management Module"
|
|
29
|
-
UM["UserManagementModule"]:::service
|
|
30
|
-
AuthS["AuthService"]:::service
|
|
31
|
-
JwtStrat["JwtStrategy"]:::service
|
|
32
|
-
TeamsS["TeamsService"]:::service
|
|
33
|
-
SettingsS["SettingsService"]:::service
|
|
34
|
-
ContextS["ContextService"]:::service
|
|
35
|
-
|
|
36
|
-
AuthC["AuthController"]:::controller
|
|
37
|
-
TeamsC["TeamsController"]:::controller
|
|
38
|
-
UserContextC["UserContextController"]:::controller
|
|
39
|
-
|
|
40
|
-
UM -->|"provides"| AuthS
|
|
41
|
-
UM -->|"provides"| JwtStrat
|
|
42
|
-
UM -->|"provides"| TeamsS
|
|
43
|
-
UM -->|"provides"| SettingsS
|
|
44
|
-
UM -->|"provides"| ContextS
|
|
45
|
-
|
|
46
|
-
UM -->|"exposes"| AuthC
|
|
47
|
-
UM -->|"exposes"| TeamsC
|
|
48
|
-
UM -->|"exposes"| UserContextC
|
|
49
|
-
|
|
50
|
-
UM -->|"imports"| EmailModule["EmailModule"]:::module
|
|
51
|
-
UM -->|"imports"| TypeOrmFeature["TypeOrmModule (UserEntity, TeamEntity, MemberInvitationEntity)"]:::module
|
|
52
|
-
UM -->|"imports"| PassportModule["PassportModule (JWT strategy)"]:::module
|
|
53
|
-
UM -->|"imports"| CommonsModule["CommonsModule"]:::module
|
|
54
|
-
UM -->|"imports"| BillingModule["BillingModule"]:::module
|
|
55
|
-
UM -->|"imports"| TrackingModule["TrackingModule"]:::module
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
classDef service fill:#91caff,stroke:#004080,color:#000;
|
|
59
|
-
classDef controller fill:#ffd9a8,stroke:#ff9a00,color:#000;
|
|
60
|
-
classDef module fill:#dcdcdc,stroke:#666,color:#000,stroke-dasharray: 2 2;
|
|
61
|
-
|
|
62
|
-
click UM "apps/api/src/user-management/user-management.module.ts"
|
|
63
|
-
click AuthS "apps/api/src/user-management/services/auth.service.ts"
|
|
64
|
-
click TeamsS "apps/api/src/user-management/services/teams.service.ts"
|
|
65
|
-
click SettingsS "apps/api/src/user-management/services/settings.service.ts"
|
|
66
|
-
click ContextS "apps/api/src/user-management/services/context.service.ts"
|
|
67
|
-
click AuthC "apps/api/src/user-management/controllers/auth.controller.ts"
|
|
68
|
-
click TeamsC "apps/api/src/user-management/controllers/teams.controller.ts"
|
|
69
|
-
click UserContextC "apps/api/src/user-management/controllers/user-context.controller.ts"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### 3. Core Concepts and Responsibilities
|
|
73
|
-
|
|
74
|
-
- **UserEntity**: Represents the user with fields such as email, role, team relation, login codes, and activation status.
|
|
75
|
-
- **TeamEntity**: Represents user teams; users may belong to a single team.
|
|
76
|
-
- **MemberInvitationEntity**: Manages invitations for new team members.
|
|
77
|
-
- **Authentication**: Uses JWT strategy with Passport.js ensuring stateless secure authentication.
|
|
78
|
-
- **TeamsService**: Manages team-related functions including fetching users, notifications, and team settings.
|
|
79
|
-
- **ContextService**: Provides enriched context about the user and team for services requiring user-specific data.
|
|
80
|
-
- **SettingsService**: Stores and manages user/team-specific application settings.
|
|
81
|
-
- **Notifications**: Users can get and update their notifications state via the UserContextController.
|
|
82
|
-
|
|
83
|
-
#### Key Design Decisions
|
|
84
|
-
|
|
85
|
-
- **Use of JWT Authentication**: Facilitates scalable, stateless user authentication handled via Passport.js integration.
|
|
86
|
-
- **Modular Design**: Separates concerns clearly between authentication, teams, user context, and settings management.
|
|
87
|
-
- **TypeORM Entities**: Enables straightforward mapping between the database and application domain.
|
|
88
|
-
- **ForwardRef Usage**: To avoid circular dependencies with billing and tracking modules.
|
|
89
|
-
|
|
90
|
-
#### Ownership & Maintenance
|
|
91
|
-
|
|
92
|
-
- Maintained by the User Management team.
|
|
93
|
-
- Errors and exceptional cases throw `GenieException` with well-defined codes.
|
|
94
|
-
- Logs and errors are captured through a shared logging strategy (assumed from shared commons).
|
|
95
|
-
|
|
96
|
-
#### Non-Functional Requirements (NFRs)
|
|
97
|
-
|
|
98
|
-
- **Security**: Protects data using JWT and enforces role-based access.
|
|
99
|
-
- **Scalability**: Designed for multi-team, multi-user environments.
|
|
100
|
-
- **Reliability**: Handles user status (e.g., deactivation) and supports transactional updates.
|
|
101
|
-
|
|
102
|
-
### 4. Code Structure
|
|
103
|
-
|
|
104
|
-
| File | Description |
|
|
105
|
-
| --- | --- |
|
|
106
|
-
| [user-management.module.ts](apps/api/src/user-management/user-management.module.ts) | Module declaration and dependency injection setup. |
|
|
107
|
-
| [index.ts](apps/api/src/user-management/index.ts) | Module export entry point. |
|
|
108
|
-
| [user.entity.ts](apps/api/src/user-management/entities/user.entity.ts) | User entity ORM definition. |
|
|
109
|
-
| [auth.service.ts](apps/api/src/user-management/services/auth.service.ts) | Handles authentication logic (login, JWT validation).
|
|
110
|
-
| [teams.service.ts](apps/api/src/user-management/services/teams.service.ts) | Handles team data, notifications, invitations.
|
|
111
|
-
| [settings.service.ts](apps/api/src/user-management/services/settings.service.ts) | Manages user and team settings.
|
|
112
|
-
| [context.service.ts](apps/api/src/user-management/services/context.service.ts) | Provides user context data.
|
|
113
|
-
| [auth.controller.ts](apps/api/src/user-management/controllers/auth.controller.ts) | Exposes authentication REST APIs.
|
|
114
|
-
| [teams.controller.ts](apps/api/src/user-management/controllers/teams.controller.ts) | Manages teams-related endpoints.
|
|
115
|
-
| [user-context.controller.ts](apps/api/src/user-management/controllers/user-context.controller.ts) | Manages user context and notifications endpoints.
|
|
116
|
-
|
|
117
|
-
#### Example: User Entity Snippet
|
|
118
|
-
```ts
|
|
119
|
-
@Entity("user")
|
|
120
|
-
export class UserEntity extends BaseEntity {
|
|
121
|
-
@Column({ unique: true })
|
|
122
|
-
email!: string;
|
|
123
|
-
|
|
124
|
-
@Column({ type: "enum", enum: UserRole, default: UserRole.Member })
|
|
125
|
-
role!: UserRole;
|
|
126
|
-
|
|
127
|
-
@Index()
|
|
128
|
-
@Column({ type: "uuid", nullable: true })
|
|
129
|
-
teamId?: string | null;
|
|
130
|
-
|
|
131
|
-
@ManyToOne(() => TeamEntity, (team) => team.users, { onDelete: "CASCADE" })
|
|
132
|
-
team?: Relation<TeamEntity>;
|
|
133
|
-
|
|
134
|
-
@Column({ type: "timestamp", nullable: true })
|
|
135
|
-
deactivatedAt?: Date | null;
|
|
136
|
-
|
|
137
|
-
isSupport() {
|
|
138
|
-
return (
|
|
139
|
-
this.email.startsWith("support+") && this.email.endsWith("@getgenie.io")
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### 5. API and Interfaces
|
|
146
|
-
|
|
147
|
-
#### User Context APIs (UserContextController)
|
|
148
|
-
- **GET /user-context**: Retrieves detailed user context, including team data.
|
|
149
|
-
- **GET /user-context/notifications**: Gets user notification settings for their team.
|
|
150
|
-
- **PUT /user-context/notifications**: Updates user notification preferences.
|
|
151
|
-
|
|
152
|
-
#### Teams APIs (TeamsController)
|
|
153
|
-
- Manages CRUD and retrieval actions related to teams and invitations. (Details not exposed in the provided context.)
|
|
154
|
-
|
|
155
|
-
#### Authentication APIs (AuthController)
|
|
156
|
-
- Manages login, JWT token issuance, and verification. (Details not exposed in the provided context.)
|
|
157
|
-
|
|
158
|
-
#### Validation
|
|
159
|
-
- Uses Zod schemas for request input validation.
|
|
160
|
-
- Throws `GenieException` if user is not part of a team or for other validation failures.
|
|
161
|
-
|
|
162
|
-
#### Authorization
|
|
163
|
-
- Circuits ensure users are part of a team before proceeding.
|
|
164
|
-
- Role-based checks are embedded in service logic where applicable.
|
|
165
|
-
|
|
166
|
-
### 6. Environment & Configuration
|
|
167
|
-
|
|
168
|
-
- The module depends on JWT configuration managed at the PassportModule level.
|
|
169
|
-
- No explicit environment variables shown for the User Management module in the context.
|
|
170
|
-
- Database integration relies on TypeORM with entities: UserEntity, TeamEntity, MemberInvitationEntity.
|
|
171
|
-
|
|
172
|
-
### 7. Testing, Monitoring, and Deployment
|
|
173
|
-
|
|
174
|
-
- No explicit testing instructions provided.
|
|
175
|
-
- Logging and error monitoring are done via shared utilities (e.g., GenieException, Logger).
|
|
176
|
-
- The module is included in the main application module with global guards for JWT and admin access.
|
|
177
|
-
|
|
178
|
-
### 8. Troubleshooting & Known Issues
|
|
179
|
-
|
|
180
|
-
- **User Not in Team Exception:** Most service methods throw a `GenieException` if a user lacks a teamId.
|
|
181
|
-
- No other specific issues or runbooks described.
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
This documentation serves as a comprehensive technical reference for in-house developers working on the User Management module, highlighting implementation details, integration points, and usage patterns.
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Project Third‑Party Software Audit
|
|
3
|
-
description: "Comprehensive breakdown of direct & transitive dependencies, licenses, risks, and compliance overview"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 🛡️ Project Overview
|
|
7
|
-
|
|
8
|
-
**Monorepo Name**: `@genie/app`
|
|
9
|
-
**Purpose**: A multi‑package TypeScript monorepo powering backend APIs (`@genie/api`), shared utilities (`@genie/shared`), ESLint & TypeScript config packages, and a Next.js frontend (`@genie/web`). Designed for data processing, analytics, file handling, and integrations (Shopify, AWS, Slack, SendGrid, Sentry), with a strong focus on code quality (Lint, Vitest, Tailwind, Zod, etc.).
|
|
10
|
-
|
|
11
|
-
**License**: All internal workspaces are **UNLICENSED**—no open‑source licensing for in‑house packages.
|
|
12
|
-
**SBOM Integration**: Recommend generating an SBOM using tools like *Syft* or *CycloneDX* (e.g., `syft packages -o cyclonedx` in CI) to formalize a bill of materials.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## 📦 Dependency Breakdown
|
|
17
|
-
|
|
18
|
-
Below is a combined view of direct runtime dependencies across main packages (`@genie/api`, `@genie/web`, `@genie/shared`). Dev‑only tools (ESLint, Vitest, Tailwind, etc.) are listed separately.
|
|
19
|
-
|
|
20
|
-
| Package Name | Version | License | Source | Purpose | Notes |
|
|
21
|
-
|----------------------------------|-------------|---------------|----------------|-------------------------------------|----------------------------------------|
|
|
22
|
-
| `date‑fns` | ^2.29.3 | MIT | npm | Date handling | Lightweight, permissive license |
|
|
23
|
-
| `zod` | ^3.21.4 | MIT | npm | Runtime validation & schema parsing| Safe and permissive |
|
|
24
|
-
| `@aws-sdk/client‑s3` | ^3.363.0 | Apache‑2.0 | npm (AWS SDK) | S3 integration | Common permissive license |
|
|
25
|
-
| `@aws-sdk/s3‑request‑presigner`| ^3.363.0 | Apache‑2.0 | npm (AWS SDK) | S3 signed URLs | Same as above |
|
|
26
|
-
| `@bull‑board/*` | ^6.6.2 | MIT | npm | Bull/MQ admin UI | MIT licensed |
|
|
27
|
-
| `@bull‑mq` | ^5.26.2 | MIT | npm | Queue management | MIT |
|
|
28
|
-
| `@genie/shared` | ^1.0.0 | UNLICENSED | local workspace| Shared utility code | In‑house utilities |
|
|
29
|
-
| `@heymantle/client` | ^1.1.30 | MIT (assumed) | npm | HeyMantle SDK | Confirm license; likely MIT |
|
|
30
|
-
| `@hubspot/api‑client` | ^11.1.0 | Apache‑2.0 | npm | HubSpot API integration | Permissive |
|
|
31
|
-
| `@nestjs/*` | various | MIT | npm | NestJS framework | MIT |
|
|
32
|
-
| `@segment/analytics‑node` | ^1.0.0 | MIT | npm | Analytics tracking | MIT |
|
|
33
|
-
| `@sendgrid/mail` | ^7.7.0 | MIT | npm | Email delivery | MIT |
|
|
34
|
-
| `@sentry/*` | ^8.38.0 | MIT | npm | Error & performance monitoring | MIT |
|
|
35
|
-
| `@shopify/shopify‑api` | ^11.6.0 | MIT | npm | Shopify API integration | MIT |
|
|
36
|
-
| `@slack/web‑api` | ^6.9.0 | MIT | npm | Slack integration | MIT |
|
|
37
|
-
| `big.js` | ^6.2.2 | MIT | npm | Arbitrary‑precision decimals | MIT |
|
|
38
|
-
| `bullmq` | ^5.26.2 | MIT | npm | Message queue | MIT |
|
|
39
|
-
| `class‑transformer`, `class‑validator` | ^0.5.1, ^0.14.1 | MIT | npm | Validation / transformation | MIT |
|
|
40
|
-
| `compression`, `cookie‑parser`, `csv‑parser`/**‑stringify**/**‑writer** | various | MIT | npm | HTTP & CSV handling | MIT |
|
|
41
|
-
| `crypto` | 1.0.1 | Node.js core | Node.js | Core crypto | Included in Node |
|
|
42
|
-
| `dotenv` | ^16.4.5 | BSD‑2 | npm | Env var loader | BSD‑2 license |
|
|
43
|
-
| `graphql‑request` | ^6.1.0 | MIT | npm | GraphQL client | MIT |
|
|
44
|
-
| `jspdf` + `jspdf‑autotable` | ^2.5.2, ^3.8.4 | MIT | npm | PDF generation | MIT |
|
|
45
|
-
| `lodash` | ^4.17.21 | MIT | npm | Utility functions | MIT |
|
|
46
|
-
| `multer` | 1.4.5‑lts.1 | MIT | npm | File upload middleware | MIT |
|
|
47
|
-
| `nest‑commander`, `nestjs‑cls`, `passport`, `passport‑jwt` | various | MIT | npm | CLI, context, auth | MIT |
|
|
48
|
-
| `pg` | ^8.13.1 | MIT | npm | PostgreSQL driver | MIT |
|
|
49
|
-
| `rxjs` | ^7.8.1 | Apache‑2.0 | npm | Reactive programming | Apache‑2.0 |
|
|
50
|
-
| `slugify` | ^1.6.6 | MIT | npm | URL‑friendly strings | MIT |
|
|
51
|
-
| `snowflake‑sdk` | ^1.15.0 | MIT | npm | Snowflake DB integration | MIT |
|
|
52
|
-
| `typeorm` | ^0.3.20 | MIT | npm | ORM for relational DBs | MIT |
|
|
53
|
-
| `uuid` | ^11.0.3 | MIT | npm | Unique IDs generating | MIT |
|
|
54
|
-
| `winston` | ^3.17.0 | MIT | npm | Logging | MIT |
|
|
55
|
-
|
|
56
|
-
### 🚧 Development / Tooling
|
|
57
|
-
|
|
58
|
-
All dev‑dependencies are MIT‑licensed or similarly permissive (ESLint, Vitest, Tailwind, Prettier, Husky, Lerna, etc.), posing no licensing risk for production. They’re used for linting, formatting, typing, testing, and build orchestration.
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## 📝 License Overview & Obligations
|
|
63
|
-
|
|
64
|
-
- **Dominant Licenses**:
|
|
65
|
-
- **MIT** – All runtime and dev dependencies (≈90%); highly permissive.
|
|
66
|
-
- **Apache 2.0** – AWS SDK, RxJS, HubSpot; includes patent clause obligations and **NOTICE** file retention.
|
|
67
|
-
- **BSD‑2** – `dotenv` under BSD‑2; similarly permissive.
|
|
68
|
-
|
|
69
|
-
- **Internal UNLICENSED workspaces**: No downstream obligations, but proprietary—ensure internal ownership and documentation.
|
|
70
|
-
|
|
71
|
-
### ✅ Compliance Responsibilities
|
|
72
|
-
|
|
73
|
-
- Include proper **copyright + license headers** for MIT/BSD/Apache.
|
|
74
|
-
- Retain Apache **NOTICE** files (e.g., AWS SDKs, RxJS).
|
|
75
|
-
- No copyleft or viral licenses detected—no GPL/AGPL risk.
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## ⚠️ Legal Flags & Risk Assessment
|
|
80
|
-
|
|
81
|
-
| Risk Category | Description | Impact & Mitigation |
|
|
82
|
-
|----------------------|----------------------------------------------------------------------------------------|----------------------------------------------------------|
|
|
83
|
-
| **Copyleft Risk** | No GPL, AGPL, LGPL packages in the dependency tree. | ✅ Low risk |
|
|
84
|
-
| **Patent Term Risk** | Apache 2.0 license includes patent grants & retaliation clauses. | 🛡️ Acceptable if NOTICE files preserved |
|
|
85
|
-
| **Commercial SDKs** | AWS, Shopify, HubSpot, Slack, SendGrid—all under permissive licenses. | ✅ Good, but check vendor-specific Terms of Service |
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## 📦 Software Bill of Materials (SBOM)
|
|
90
|
-
|
|
91
|
-
We recommend using tools in CI such as:
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
# generates CycloneDX SBOM
|
|
95
|
-
syft packages -o cyclonedx > sbom.xml
|
|
96
|
-
|
|
97
|
-
# or SPDX format for compliance scanning
|
|
98
|
-
syft packages -o spdx-json > sbom.json
|
|
99
|
-
````
|
|
100
|
-
|
|
101
|
-
*SBOM files should be versioned and reviewed regularly.*
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
## 🔄 Update & Audit Practices
|
|
106
|
-
|
|
107
|
-
* **Regular scans**: Run `npm audit` or `yarn audit`; combine with license scanner (e.g., `license-checker`).
|
|
108
|
-
* **CI gating**: Block builds on new copyleft or high‑risk license additions.
|
|
109
|
-
* **Vendor SDK review**: Periodically review versions and associated ToS changes (e.g., Shopify API terms).
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## ✅ Summary & Compliance Statement
|
|
114
|
-
|
|
115
|
-
* **License posture**: Clean, permissive—no viral copyleft licenses used.
|
|
116
|
-
* **Risk level**: Low—standard obligations for MIT and Apache.
|
|
117
|
-
* **Next steps**:
|
|
118
|
-
|
|
119
|
-
1. Generate SBOM and track as part of release artifacts.
|
|
120
|
-
2. Automate license header checks and documentation of NOTICE files.
|
|
121
|
-
3. Document internal policies for SDK term compliance (Shopify, AWS, Slack, HubSpot, SendGrid).
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## 🔍 Appendix: Key Dependencies
|
|
126
|
-
|
|
127
|
-
* **`@genie/shared`**: Internal TS utilities
|
|
128
|
-
* **`@aws-sdk/*`**: S3 file storage integrations
|
|
129
|
-
* **`@shopify/shopify-api`**: E‑commerce platform integration
|
|
130
|
-
* **`typeorm`, `pg`, `bullmq`**: Data persistence & job queue
|
|
131
|
-
* **`nestjs`, `passport-jwt`**: Backend API framework & security
|
|
132
|
-
* **`react`, `next`, `recharts`, `react-hook-form`**: Frontend UI & data visualization
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 'Privacy & Terms'
|
|
3
|
-
description: 'Privacy policy and terms of use for Genie App users.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Privacy & Terms
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
This document details the privacy and terms-related components and policies integrated within the Genie application. It covers cookie consent handling, Shopify permission management, and user privacy notices displayed across the app.
|
|
11
|
-
|
|
12
|
-
## Cookie Consent
|
|
13
|
-
|
|
14
|
-
The Genie app includes a Cookies Consent Banner component designed to comply with necessary cookie usage regulations. It handles obtaining user consent for cookie usage and informs users about the types of cookies used.
|
|
15
|
-
|
|
16
|
-
### Key Features
|
|
17
|
-
|
|
18
|
-
- Displays a banner to users not yet providing consent.
|
|
19
|
-
- Explains the use of necessary cookies for core functionality.
|
|
20
|
-
- Offers information on analytics cookies and preference remembrance.
|
|
21
|
-
- Provides a link to the Privacy Policy for further details.
|
|
22
|
-
- Allows users to accept cookies with a single click.
|
|
23
|
-
|
|
24
|
-
### Usage Behavior
|
|
25
|
-
|
|
26
|
-
- Once accepted, the consent is stored persistently.
|
|
27
|
-
- The banner reappears if user navigates to a new page without previously giving consent.
|
|
28
|
-
- Users may dismiss the banner temporarily.
|
|
29
|
-
|
|
30
|
-
### Implementation Details
|
|
31
|
-
|
|
32
|
-
The banner implementation listens to route changes to reset visibility, uses local storage keys to remember consent, and includes accessible buttons for acceptance or dismissal. The privacy policy link opens externally to provide legal context.
|
|
33
|
-
|
|
34
|
-
## Shopify Permissions & Scopes
|
|
35
|
-
|
|
36
|
-
Genie integrates with Shopify through a precise set of API scopes. These are permissions granted by Shopify to the Genie app to perform operations on the user's store data.
|
|
37
|
-
|
|
38
|
-
### Shopify API Scopes
|
|
39
|
-
|
|
40
|
-
The following permissions are requested and used by Genie, respecting Shopify's restrictions on overlapping scopes:
|
|
41
|
-
|
|
42
|
-
- `read_orders` and `read_all_orders` for accessing order information.
|
|
43
|
-
- `write_products` and `write_inventory` for managing product listings and inventory updates.
|
|
44
|
-
- `read_locations` and `read_themes` for store locations and themes.
|
|
45
|
-
- `read_returns` and `write_publications` for returns management and content publications.
|
|
46
|
-
|
|
47
|
-
### Permission Updates Flow
|
|
48
|
-
|
|
49
|
-
- When new features require additional Shopify permissions, Genie prompts the user with a modal to approve these new scopes.
|
|
50
|
-
- If the current user is not the team owner, they are instructed to ask the owner to approve.
|
|
51
|
-
- The modal ensures users understand the necessity of granting these permissions for uninterrupted features.
|
|
52
|
-
|
|
53
|
-
## Links to Privacy Policy and Terms
|
|
54
|
-
|
|
55
|
-
- The Cookies Consent Banner provides a direct link to Genie’s Privacy Policy at `http://privacy.getgenie.io/`.
|
|
56
|
-
- This external page contains detailed legal information regarding data privacy and user terms.
|
|
57
|
-
|
|
58
|
-
## User Privacy Considerations
|
|
59
|
-
|
|
60
|
-
Genie limits cookie usage to necessary cookies required for website and application functionality and optional analytics cookies aimed at improving user experience.
|
|
61
|
-
|
|
62
|
-
By explicitly obtaining user consent before setting analytics cookies, Genie respects user privacy and legal compliance.
|
|
63
|
-
|
|
64
|
-
## Summary
|
|
65
|
-
|
|
66
|
-
Genie prioritizes privacy and transparency by:
|
|
67
|
-
|
|
68
|
-
- Informing users clearly about cookie usage.
|
|
69
|
-
- Limiting permissions requested from Shopify to only those necessary.
|
|
70
|
-
- Properly managing updates in permissions requiring user consent.
|
|
71
|
-
- Offering easy access to privacy documentation.
|
|
72
|
-
|
|
73
|
-
This approach ensures compliance and builds user trust while enabling Genie’s full feature set.
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 'Common Issues & Debugging'
|
|
3
|
-
description: 'Document known problems and developer tips for troubleshooting.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Common Issues & Debugging
|
|
7
|
-
|
|
8
|
-
This document provides an overview of frequent problems and debugging techniques encountered in the Genie backend system. It is intended for internal developers and maintainers to quickly diagnose and resolve issues related to team management, Shopify integration, webhook processing, data synchronization, and email notifications.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
### 1. Shopify Webhook Registration Failures
|
|
13
|
-
|
|
14
|
-
**Issue:** Teams sometimes fail to register Shopify webhooks successfully.
|
|
15
|
-
|
|
16
|
-
**Context:**
|
|
17
|
-
- The registration process occurs in `WebhooksInsightsSyncService.registerShopifyWebhooksForTeam` where webhooks are registered unless the team is on a free plan or listed in the exclusion for product update topics.
|
|
18
|
-
- Failures are logged with detailed error messages.
|
|
19
|
-
- The system retries failed registrations periodically (every 10 minutes) using `attemptToRegisterWebhooksForFailedTeams` until successful.
|
|
20
|
-
|
|
21
|
-
**Debugging Steps:**
|
|
22
|
-
- Check logs from `WebhooksInsightsSyncService` for specific error messages during webhook registration.
|
|
23
|
-
- Confirm team eligibility (not on free plan, not excluded from certain topics).
|
|
24
|
-
- Verify that the Shopify API credentials are valid and that network connectivity with Shopify is intact.
|
|
25
|
-
- Inspect the responses in the method `ShopifyWebhooksService.registerWebhooksForTeam` where individual webhook registration responses are validated.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
### 2. Shopify Webhook Event Processing Errors
|
|
30
|
-
|
|
31
|
-
**Issue:** Errors during processing Shopify webhook events can cause the events to fail or get stuck.
|
|
32
|
-
|
|
33
|
-
**Context:**
|
|
34
|
-
- Events are stored in the database and processed asynchronously by `ShopifyWebhooksService.startEventsProcessingForTeam`.
|
|
35
|
-
- Processing fails are caught, logged using the GenieException wrapper, and the corresponding events are marked with failed status.
|
|
36
|
-
- The system skips duplicated or irrelevant events to prevent redundant processing.
|
|
37
|
-
|
|
38
|
-
**Debugging Steps:**
|
|
39
|
-
- Review logs for errors thrown inside the event processing pipelines in `WebhooksInsightsSyncService` such as product sync, collections sync, inventory levels update, and orders sync.
|
|
40
|
-
- Check the `ShopifyWebhookEventEntity` table for event statuses (`PENDING`, `PROCESSED`, `FAILED`, `SKIPPED`) to identify problematic events.
|
|
41
|
-
- If many events are stuck in `FAILED`, investigate the root cause in the callback handlers.
|
|
42
|
-
- Monitor error tracking and exceptions captured to Sentry or other observability services.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
### 3. Data Synchronization Delays or Failures
|
|
47
|
-
|
|
48
|
-
**Issue:** Delay or failure in syncing Shopify products, collections, inventory levels, or sales metrics.
|
|
49
|
-
|
|
50
|
-
**Context:**
|
|
51
|
-
- Sync is orchestrated within `InsightsSyncService.syncDataForTeam` and related methods.
|
|
52
|
-
- Sync includes multiple steps: fetch products, import products, mark deletions, sync locations, sync collections, sync sales orders, and update metrics.
|
|
53
|
-
- Scheduled syncs and manual syncs use the same pipelines, with `manual` flag handled for tracking.
|
|
54
|
-
|
|
55
|
-
**Debugging Steps:**
|
|
56
|
-
- Verify that Shopify API authentication (`shopifyApiService.getAuth`) returns valid credentials for the team.
|
|
57
|
-
- Check the daily sync performance logs via `DailySyncPerformanceTrackerService` for bottlenecks.
|
|
58
|
-
- On failed syncs, look for `GenieException` captures containing detailed error context.
|
|
59
|
-
- Use `InsightsSyncService.debugAverageDailySales` to test sales data calculation for individual variants.
|
|
60
|
-
- Confirm that all required dependencies (`ProductRepository`, `ProductVariantRepository`, `LocationService`, etc.) are operational.
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
### 4. Inventory and Sales Metrics Misalignment
|
|
65
|
-
|
|
66
|
-
**Issue:** Inventory metrics like average daily sales, cumulative sales percentages, or sales velocity reports may appear incorrect.
|
|
67
|
-
|
|
68
|
-
**Context:**
|
|
69
|
-
- Calculations use historical sales and inventory data queried in batches.
|
|
70
|
-
- The thresholds for grading are enforced by database triggers to guarantee valid values (see migration `1702299870451-grading-settings-v3.ts`).
|
|
71
|
-
- Failed transformations or missing product variant data cause inaccurate aggregates.
|
|
72
|
-
|
|
73
|
-
**Debugging Steps:**
|
|
74
|
-
- Verify that threshold settings (`inventoryItemGradingLevelAThresholdSetting`, `B`, `C`) adhere to the constraints enforced by the DB trigger.
|
|
75
|
-
- Use the debug endpoint in `InsightsSyncService.debugAverageDailySales` to examine detailed calculation steps per variant.
|
|
76
|
-
- Check if variants or products are soft-deleted unexpectedly during sync.
|
|
77
|
-
- Review sales orders data and line items imported via `SalesOrdersService.importSalesOrders`.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
### 5. Slack Notification Failures
|
|
82
|
-
|
|
83
|
-
**Issue:** Slack notifications for system alerts, user requests, or sales health checks fail or do not appear on the expected channels.
|
|
84
|
-
|
|
85
|
-
**Context:**
|
|
86
|
-
- `SlackService` uses the Slack Web API client configured with the `SLACK_APP_TOKEN` environment variable.
|
|
87
|
-
- Before sending a message, it verifies membership in the Slack channel and attempts to join if not already a member.
|
|
88
|
-
- Messages include detailed contextual information such as team IDs, user emails, and report summaries.
|
|
89
|
-
|
|
90
|
-
**Debugging Steps:**
|
|
91
|
-
- Verify that the Slack app is installed in the workspace with the correct bot token (`SLACK_APP_TOKEN`).
|
|
92
|
-
- Confirm that channel IDs (`SLACK_APP_USER_REQUESTS_CHANNEL_ID`, `SLACK_APP_SYSTEM_ALERTS_CHANNEL_ID`) are correctly configured in environment variables.
|
|
93
|
-
- Check logs from `SlackService` for errors when sending messages or joining channels.
|
|
94
|
-
- Ensure the app has permissions to join channels and send messages.
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
### 6. Scheduled Tasks Not Running or Partially Executed
|
|
99
|
-
|
|
100
|
-
**Issue:** Scheduled cron jobs for deleting old sales orders or sales sync health checks do not trigger as expected.
|
|
101
|
-
|
|
102
|
-
**Context:**
|
|
103
|
-
- Scheduled tasks are implemented in `ScheduledTasksService` using decorators like `@EnhancedCron`.
|
|
104
|
-
- Tasks include conditions like checking for midnight in the configured timezone before executing.
|
|
105
|
-
- Notifications are sent on completion, leveraging `SlackService`.
|
|
106
|
-
|
|
107
|
-
**Debugging Steps:**
|
|
108
|
-
- Confirm the system clock and timezone configuration (`DATA_SYNC_TIMEZONE`) are correct.
|
|
109
|
-
- Verify the cron expressions for the scheduled tasks.
|
|
110
|
-
- Review logs for task start and completion messages.
|
|
111
|
-
- Confirm that the environment runs with all needed permissions and dependencies.
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
### 7. User and Team Data Synchronization Issues
|
|
116
|
-
|
|
117
|
-
**Issue:** Users associated with teams are not filtered correctly, or incomplete Shopify permissions causing team feature restrictions.
|
|
118
|
-
|
|
119
|
-
**Context:**
|
|
120
|
-
- The `TeamService.getAllTeams` filters out internal users (`@getgenie.io` emails) and maps shops.
|
|
121
|
-
- Missing Shopify permissions detected via `TeamsService.hasMissingShopifyScopes` for active teams.
|
|
122
|
-
- Teams with disabled reasons or uninstalled Mantle billing token are tracked.
|
|
123
|
-
|
|
124
|
-
**Debugging Steps:**
|
|
125
|
-
- Verify the user filters in `TeamService.getAllTeams`.
|
|
126
|
-
- Use administrative API endpoints to check for missing scopes or uninstalled teams.
|
|
127
|
-
- Review billing service connection via `MantleService` and mantle tokens.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Summary
|
|
132
|
-
|
|
133
|
-
This section consolidates major debugging areas with pointers to relevant classes and methods:
|
|
134
|
-
|
|
135
|
-
| Issue Category | Key Components / Files | Notes |
|
|
136
|
-
|--------------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------------------------------|
|
|
137
|
-
| Shopify Webhook Registration | `WebhooksInsightsSyncService.registerShopifyWebhooksForTeam` | Retry logic, logging successful and failed registrations |
|
|
138
|
-
| Webhook Event Processing | `ShopifyWebhooksService.startEventsProcessingForTeam` | Event status management, error captures |
|
|
139
|
-
| Data Sync Failures | `InsightsSyncService.syncDataForTeam` | Multi-step product and sales data sync |
|
|
140
|
-
| Inventory Metrics Incorrect | `InsightsSyncService.debugAverageDailySales` | Grading thresholds, sales data recalculations |
|
|
141
|
-
| Slack Notification Errors | `SlackService.sendNotification` | Channel membership verification and error handling |
|
|
142
|
-
| Scheduled Tasks | `ScheduledTasksService` | Cron job timing checks and notification sending |
|
|
143
|
-
| User & Team Data Integrity | `TeamService.getAllTeams`, `TeamsService.hasMissingShopifyScopes`| User filtering, Shopify permissions, billing status |
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
For detailed code and method references, developers should consult the source files linked below for direct exploration and debugging annotations:
|
|
148
|
-
|
|
149
|
-
- [apps/api/src/pim/services/webhooks-insights-sync.service.ts](apps/api/src/pim/services/webhooks-insights-sync.service.ts)
|
|
150
|
-
- [apps/api/src/shopify/services/shopify-webhooks.service.ts](apps/api/src/shopify/services/shopify-webhooks.service.ts)
|
|
151
|
-
- [apps/api/src/pim/services/insights-sync.service.ts](apps/api/src/pim/services/insights-sync.service.ts)
|
|
152
|
-
- [apps/api/src/slack/services/slack.service.ts](apps/api/src/slack/services/slack.service.ts)
|
|
153
|
-
- [apps/api/src/sales-order/services/sales-orders.service.ts](apps/api/src/sales-order/services/sales-orders.service.ts)
|
|
154
|
-
- [apps/api/src/sales-order/services/scheduled-tasks.service.ts](apps/api/src/sales-order/services/scheduled-tasks.service.ts)
|
|
155
|
-
- [apps/api/src/admin/services/team.service.ts](apps/api/src/admin/services/team.service.ts)
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
This document will be updated as new common issues or debugging procedures emerge from development and support activities.
|