diff --git a/README.md b/README.md index 2f124dc4..d9427807 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Link : https://app.CropWatch.io - PWA Framework: Svelte, SvelteKit - UI Components: @cropwatchdevelopment/cwui, bits-ui, @revolist/svelte-datagrid - Styling: Tailwind CSS, @layerstack/tailwind, @tailwindcss/forms, @tailwindcss/typography -- State & IoC: @stencil/store, inversify +- State Management: @stencil/store - Data Visualization: D3.js, ApexCharts - Mapping: Leaflet - PDF Generation: jspdf, pdfkit, html2canvas diff --git a/database.types.ts b/database.types.ts index 43ddae51..fe554400 100644 --- a/database.types.ts +++ b/database.types.ts @@ -1,6 +1,11 @@ export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]; export type Database = { + // Allows to automatically instanciate createClient with right options + // instead of createClient(URL, KEY) + __InternalSupabase: { + PostgrestVersion: '12.2.3 (519615d)'; + }; public: { Tables: { api_keys: { @@ -67,6 +72,7 @@ export type Database = { created_at: string | null; email: string | null; id: string; + name: string | null; stripe_customer_id: string; updated_at: string | null; user_id: string; @@ -75,6 +81,7 @@ export type Database = { created_at?: string | null; email?: string | null; id: string; + name?: string | null; stripe_customer_id: string; updated_at?: string | null; user_id: string; @@ -83,6 +90,7 @@ export type Database = { created_at?: string | null; email?: string | null; id?: string; + name?: string | null; stripe_customer_id?: string; updated_at?: string | null; user_id?: string; @@ -1425,6 +1433,8 @@ export type Database = { name: string; operator: string | null; report_id: string; + user_id: string | null; + value: number | null; }; Insert: { created_at?: string; @@ -1436,6 +1446,8 @@ export type Database = { name: string; operator?: string | null; report_id: string; + user_id?: string | null; + value?: number | null; }; Update: { created_at?: string; @@ -1447,6 +1459,8 @@ export type Database = { name?: string; operator?: string | null; report_id?: string; + user_id?: string | null; + value?: number | null; }; Relationships: [ { @@ -1462,23 +1476,29 @@ export type Database = { Row: { communication_method: number; created_at: string; + email: string | null; id: number; - profile_id: string; + name: string | null; report_id: string; + user_id: string | null; }; Insert: { communication_method: number; created_at?: string; + email?: string | null; id?: number; - profile_id: string; + name?: string | null; report_id: string; + user_id?: string | null; }; Update: { communication_method?: number; created_at?: string; + email?: string | null; id?: number; - profile_id?: string; + name?: string | null; report_id?: string; + user_id?: string | null; }; Relationships: [ { @@ -1488,13 +1508,6 @@ export type Database = { referencedRelation: 'communication_methods'; referencedColumns: ['communication_method_id']; }, - { - foreignKeyName: 'report_recipients_profile_id_fkey'; - columns: ['profile_id']; - isOneToOne: false; - referencedRelation: 'profiles'; - referencedColumns: ['id']; - }, { foreignKeyName: 'report_recipients_report_id_fkey'; columns: ['report_id']; @@ -1569,6 +1582,7 @@ export type Database = { id: number; name: string; report_id: string; + user_id: string | null; }; Insert: { created_at?: string; @@ -1576,6 +1590,7 @@ export type Database = { id?: number; name: string; report_id?: string; + user_id?: string | null; }; Update: { created_at?: string; @@ -1583,6 +1598,7 @@ export type Database = { id?: number; name?: string; report_id?: string; + user_id?: string | null; }; Relationships: [ { @@ -1591,6 +1607,13 @@ export type Database = { isOneToOne: false; referencedRelation: 'cw_devices'; referencedColumns: ['dev_eui']; + }, + { + foreignKeyName: 'reports_user_id_fkey'; + columns: ['user_id']; + isOneToOne: false; + referencedRelation: 'profiles'; + referencedColumns: ['id']; } ]; }; @@ -1639,6 +1662,93 @@ export type Database = { } ]; }; + stripe_customers: { + Row: { + attrs: Json | null; + created: string | null; + description: string | null; + email: string | null; + id: string | null; + name: string | null; + }; + Insert: { + attrs?: Json | null; + created?: string | null; + description?: string | null; + email?: string | null; + id?: string | null; + name?: string | null; + }; + Update: { + attrs?: Json | null; + created?: string | null; + description?: string | null; + email?: string | null; + id?: string | null; + name?: string | null; + }; + Relationships: []; + }; + stripe_products: { + Row: { + active: boolean | null; + attrs: Json | null; + created: string | null; + default_price: string | null; + description: string | null; + id: string | null; + name: string | null; + updated: string | null; + }; + Insert: { + active?: boolean | null; + attrs?: Json | null; + created?: string | null; + default_price?: string | null; + description?: string | null; + id?: string | null; + name?: string | null; + updated?: string | null; + }; + Update: { + active?: boolean | null; + attrs?: Json | null; + created?: string | null; + default_price?: string | null; + description?: string | null; + id?: string | null; + name?: string | null; + updated?: string | null; + }; + Relationships: []; + }; + stripe_subscriptions: { + Row: { + attrs: Json | null; + currency: string | null; + current_period_end: string | null; + current_period_start: string | null; + customer: string | null; + id: string | null; + }; + Insert: { + attrs?: Json | null; + currency?: string | null; + current_period_end?: string | null; + current_period_start?: string | null; + customer?: string | null; + id?: string | null; + }; + Update: { + attrs?: Json | null; + currency?: string | null; + current_period_end?: string | null; + current_period_start?: string | null; + customer?: string | null; + id?: string | null; + }; + Relationships: []; + }; subscription_items: { Row: { created_at: string | null; @@ -1898,21 +2008,25 @@ export type Database = { }; }; -type DefaultSchema = Database[Extract]; +type DatabaseWithoutInternals = Omit; + +type DefaultSchema = DatabaseWithoutInternals[Extract]; export type Tables< DefaultSchemaTableNameOrOptions extends | keyof (DefaultSchema['Tables'] & DefaultSchema['Views']) - | { schema: keyof Database }, + | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { - schema: keyof Database; + schema: keyof DatabaseWithoutInternals; } - ? keyof (Database[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & - Database[DefaultSchemaTableNameOrOptions['schema']]['Views']) + ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views']) : never = never -> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database } - ? (Database[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & - Database[DefaultSchemaTableNameOrOptions['schema']]['Views'])[TableName] extends { +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals; +} + ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views'])[TableName] extends { Row: infer R; } ? R @@ -1928,14 +2042,16 @@ export type Tables< export type TablesInsert< DefaultSchemaTableNameOrOptions extends | keyof DefaultSchema['Tables'] - | { schema: keyof Database }, + | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { - schema: keyof Database; + schema: keyof DatabaseWithoutInternals; } - ? keyof Database[DefaultSchemaTableNameOrOptions['schema']]['Tables'] + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] : never = never -> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database } - ? Database[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends { +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals; +} + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends { Insert: infer I; } ? I @@ -1951,14 +2067,16 @@ export type TablesInsert< export type TablesUpdate< DefaultSchemaTableNameOrOptions extends | keyof DefaultSchema['Tables'] - | { schema: keyof Database }, + | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { - schema: keyof Database; + schema: keyof DatabaseWithoutInternals; } - ? keyof Database[DefaultSchemaTableNameOrOptions['schema']]['Tables'] + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] : never = never -> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database } - ? Database[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends { +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals; +} + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends { Update: infer U; } ? U @@ -1972,14 +2090,18 @@ export type TablesUpdate< : never; export type Enums< - DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema['Enums'] | { schema: keyof Database }, + DefaultSchemaEnumNameOrOptions extends + | keyof DefaultSchema['Enums'] + | { schema: keyof DatabaseWithoutInternals }, EnumName extends DefaultSchemaEnumNameOrOptions extends { - schema: keyof Database; + schema: keyof DatabaseWithoutInternals; } - ? keyof Database[DefaultSchemaEnumNameOrOptions['schema']]['Enums'] + ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'] : never = never -> = DefaultSchemaEnumNameOrOptions extends { schema: keyof Database } - ? Database[DefaultSchemaEnumNameOrOptions['schema']]['Enums'][EnumName] +> = DefaultSchemaEnumNameOrOptions extends { + schema: keyof DatabaseWithoutInternals; +} + ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'][EnumName] : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema['Enums'] ? DefaultSchema['Enums'][DefaultSchemaEnumNameOrOptions] : never; @@ -1987,14 +2109,16 @@ export type Enums< export type CompositeTypes< PublicCompositeTypeNameOrOptions extends | keyof DefaultSchema['CompositeTypes'] - | { schema: keyof Database }, + | { schema: keyof DatabaseWithoutInternals }, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { - schema: keyof Database; + schema: keyof DatabaseWithoutInternals; } - ? keyof Database[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'] + ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'] : never = never -> = PublicCompositeTypeNameOrOptions extends { schema: keyof Database } - ? Database[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'][CompositeTypeName] +> = PublicCompositeTypeNameOrOptions extends { + schema: keyof DatabaseWithoutInternals; +} + ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema['CompositeTypes'] ? DefaultSchema['CompositeTypes'][PublicCompositeTypeNameOrOptions] : never; diff --git a/package.json b/package.json index 6b25d84c..7f4ce99b 100644 --- a/package.json +++ b/package.json @@ -78,13 +78,11 @@ "d3-axis": "^3.0.0", "d3-scale": "^4.0.2", "d3-selection": "^3.0.0", - "inversify": "7.0.0-alpha.5", "jspdf": "^3.0.1", "leaflet": "2.0.0-alpha", "lodash": "^4.17.21", "luxon": "^3.6.1", "pdfkit": "^0.17.1", - "reflect-metadata": "^0.2.2", "stripe": "^18.3.0", "svelte-i18n": "^4.0.1", "svelte-ux": "^1.0.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8d428598..a9888816 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,9 +56,6 @@ importers: d3-selection: specifier: ^3.0.0 version: 3.0.0 - inversify: - specifier: 7.0.0-alpha.5 - version: 7.0.0-alpha.5(reflect-metadata@0.2.2) jspdf: specifier: ^3.0.1 version: 3.0.1 @@ -74,9 +71,6 @@ importers: pdfkit: specifier: ^0.17.1 version: 0.17.1 - reflect-metadata: - specifier: ^0.2.2 - version: 0.2.2 stripe: specifier: ^18.3.0 version: 18.3.0(@types/node@24.0.3) @@ -1157,25 +1151,6 @@ packages: '@internationalized/date@3.8.2': resolution: {integrity: sha512-/wENk7CbvLbkUvX1tu0mwq49CVkkWpkXubGel6birjRPyo6uQ4nQpnq5xZu823zRCwwn82zgHrvgF1vZyvmVgA==} - '@inversifyjs/common@1.5.0': - resolution: {integrity: sha512-Qj5BELk11AfI2rgZEAaLPmOftmQRLLmoCXgAjmaF0IngQN5vHomVT5ML7DZ3+CA5fgGcEVMcGbUDAun+Rz+oNg==} - - '@inversifyjs/container@1.5.2': - resolution: {integrity: sha512-z0h5iwzA/Gv/1K1ZFHj4VAXpyShOez61g4vWMaWpY4gKidsIbnn01ArRbKbsTKzwW63DniAGMhtnUO+y3htcpQ==} - peerDependencies: - reflect-metadata: ~0.2.2 - - '@inversifyjs/core@4.0.0': - resolution: {integrity: sha512-uNK3aFEAn5mnQ1TbPqDDG/4BMNGPZ8Jb+cDW2ualjNCiMqtIDWP2gBQf0zahxSbZnc5iVrkk7ftjX3Raze8BLQ==} - - '@inversifyjs/prototype-utils@0.1.0': - resolution: {integrity: sha512-lNz1yyajMRDXBHLvJsYYX81FcmeD15e5Qz1zAZ/3zeYTl+u7ZF/GxNRKJzNOloeMPMtuR8BnvzHA1SZxjR+J9w==} - - '@inversifyjs/reflect-metadata-utils@1.1.0': - resolution: {integrity: sha512-jmuAuC3eL1GnFAYfJGJOMKRDL9q1mgzOyrban6zxfM8Yg1FUHsj25h27bW2G7p8X1Amvhg3MLkaOuogszkrofA==} - peerDependencies: - reflect-metadata: 0.2.2 - '@isaacs/cliui@8.0.2': resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -3243,11 +3218,6 @@ packages: invariant@2.2.4: resolution: {integrity: sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==} - inversify@7.0.0-alpha.5: - resolution: {integrity: sha512-fl09CyoTZXUc26m0GK65Cxx8B3MNjVb2vhdD/o03Vn9yXGFiQuRInvc3WC64j4QZl2UtRD9kK3Spk1junADT8g==} - peerDependencies: - reflect-metadata: ~0.2.2 - is-alphabetical@1.0.4: resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==} @@ -4265,9 +4235,6 @@ packages: redux@5.0.1: resolution: {integrity: sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==} - reflect-metadata@0.2.2: - resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==} - reflect.getprototypeof@1.0.10: resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==} engines: {node: '>= 0.4'} @@ -6290,31 +6257,6 @@ snapshots: dependencies: '@swc/helpers': 0.5.17 - '@inversifyjs/common@1.5.0': {} - - '@inversifyjs/container@1.5.2(reflect-metadata@0.2.2)': - dependencies: - '@inversifyjs/common': 1.5.0 - '@inversifyjs/core': 4.0.0(reflect-metadata@0.2.2) - '@inversifyjs/reflect-metadata-utils': 1.1.0(reflect-metadata@0.2.2) - reflect-metadata: 0.2.2 - - '@inversifyjs/core@4.0.0(reflect-metadata@0.2.2)': - dependencies: - '@inversifyjs/common': 1.5.0 - '@inversifyjs/prototype-utils': 0.1.0 - '@inversifyjs/reflect-metadata-utils': 1.1.0(reflect-metadata@0.2.2) - transitivePeerDependencies: - - reflect-metadata - - '@inversifyjs/prototype-utils@0.1.0': - dependencies: - '@inversifyjs/common': 1.5.0 - - '@inversifyjs/reflect-metadata-utils@1.1.0(reflect-metadata@0.2.2)': - dependencies: - reflect-metadata: 0.2.2 - '@isaacs/cliui@8.0.2': dependencies: string-width: 5.1.2 @@ -8887,13 +8829,6 @@ snapshots: dependencies: loose-envify: 1.4.0 - inversify@7.0.0-alpha.5(reflect-metadata@0.2.2): - dependencies: - '@inversifyjs/common': 1.5.0 - '@inversifyjs/container': 1.5.2(reflect-metadata@0.2.2) - '@inversifyjs/core': 4.0.0(reflect-metadata@0.2.2) - reflect-metadata: 0.2.2 - is-alphabetical@1.0.4: {} is-alphanumerical@1.0.4: @@ -9772,8 +9707,6 @@ snapshots: redux@5.0.1: {} - reflect-metadata@0.2.2: {} - reflect.getprototypeof@1.0.10: dependencies: call-bind: 1.0.8 diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 4f58d343..bdcbb0d8 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,4 +1,3 @@ -import 'reflect-metadata'; import { error, redirect, type Handle } from '@sveltejs/kit'; import { createServerClient } from '@supabase/ssr'; import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; diff --git a/src/lib/components/GlobalSidebar.svelte b/src/lib/components/GlobalSidebar.svelte index 91e742ce..d830243b 100644 --- a/src/lib/components/GlobalSidebar.svelte +++ b/src/lib/components/GlobalSidebar.svelte @@ -114,8 +114,8 @@