@periskope/types 0.5.4 → 0.5.6

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/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './supabase.types';
2
+ export * from './types';
3
+
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "private": false,
5
- "main": "types.ts",
5
+ "main": "index.ts",
6
+ "types": "index.d.ts",
6
7
  "dependencies": {
7
8
  "type-fest": "^4.8.3",
8
9
  "whatsapp-web.js": "^1.23.0"
package/tsconfig.json CHANGED
@@ -11,7 +11,7 @@
11
11
  // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
12
 
13
13
  /* Language and Environment */
14
- "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14
+ "target": "ES2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
15
  // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
16
  // "jsx": "preserve", /* Specify what JSX code is generated. */
17
17
  // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
@@ -25,9 +25,9 @@
25
25
  // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
26
 
27
27
  /* Modules */
28
- "module": "ESNext", /* Specify what module code is generated. */
28
+ "module": "CommonJS", /* Specify what module code is generated. */
29
29
  // "rootDir": "./", /* Specify the root folder within your source files. */
30
- "moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
30
+ // "moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
31
31
  // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
32
  // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
33
  // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
@@ -49,15 +49,15 @@
49
49
  // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
50
 
51
51
  /* Emit */
52
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
52
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
53
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
54
  // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
55
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
56
  // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
57
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58
- // "outDir": "dist/", /* Specify an output folder for all emitted files. */
58
+ "outDir": "dist/", /* Specify an output folder for all emitted files. */
59
59
  // "removeComments": true, /* Disable emitting comments. */
60
- "noEmit": true, /* Disable emitting files from a compilation. */
60
+ // "noEmit": true, /* Disable emitting files from a compilation. */
61
61
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62
62
  // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63
63
  // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
package/types.ts CHANGED
@@ -1,50 +1,46 @@
1
- import * as typefest from 'type-fest';
2
- import * as wweb from 'whatsapp-web.js';
3
- import * as supabase from './supabase.types';
4
- export * from './supabase.types';
5
-
6
- // Override the type for a specific column in a view:
7
- export type Database = typefest.OverrideProperties<supabase.Database, {}>;
1
+ import { Merge, OverrideProperties } from 'type-fest';
2
+ import { Chat, MessageTypes } from 'whatsapp-web.js';
3
+ import { Tables } from './supabase.types';
8
4
 
9
5
  /* ----------------------------- TYPE SHORTHANDS ---------------------------- */
10
6
 
11
7
  /* ------------------------------ WHATSAPP ------------------------------ */
12
8
 
13
- export type WhatsappChat = wweb.Chat & { groupMetadata?: any; pinned?: boolean };
9
+ export type WhatsappChat = Chat & { groupMetadata?: any; pinned?: boolean };
14
10
 
15
11
  /* ------------------------------ PERISKOPE TYPES ------------------------------ */
16
12
 
17
- export type OrgType = supabase.Tables<'tbl_org'> & {
18
- user: supabase.Tables<'tbl_org_members'>;
19
- members: supabase.Tables<'tbl_org_members'>[];
20
- phones: supabase.Tables<'tbl_org_phones'>[];
21
- labels: supabase.Tables<'tbl_org_labels'>[];
13
+ export type OrgType = Tables<'tbl_org'> & {
14
+ user: Tables<'tbl_org_members'>;
15
+ members: Tables<'tbl_org_members'>[];
16
+ phones: Tables<'tbl_org_phones'>[];
17
+ labels: Tables<'tbl_org_labels'>[];
22
18
  };
23
19
 
24
- export type ChatType = typefest.Merge<
25
- supabase.Tables<'view_chats'>,
20
+ export type ChatType = Merge<
21
+ Tables<'view_chats'>,
26
22
  {
27
23
  chat_id: string;
28
24
  latest_message: MessageType | null;
29
25
  members:
30
- | (supabase.Tables<'tbl_chat_participants'> & Partial<supabase.Tables<'tbl_contacts'>>)[]
26
+ | (Tables<'tbl_chat_participants'> & Partial<Tables<'tbl_contacts'>>)[]
31
27
  | null;
32
- notifications: supabase.Tables<'tbl_chat_notifications'>[] | null;
28
+ notifications: Tables<'tbl_chat_notifications'>[] | null;
33
29
  chat_type: 'user' | 'group' | 'business';
34
30
  active_phone?: boolean;
35
- org_participants?: supabase.Tables<'tbl_chat_participants'>[];
31
+ org_participants?: Tables<'tbl_chat_participants'>[];
36
32
  }
37
33
  >;
38
34
 
39
- export type MessageType = typefest.OverrideProperties<
40
- supabase.Tables<'view_chat_messages'>,
35
+ export type MessageType = OverrideProperties<
36
+ Tables<'view_chat_messages'>,
41
37
  {
42
- type: wweb.MessageTypes;
38
+ type: MessageTypes;
43
39
  }
44
40
  >;
45
41
 
46
- export type ContactType = typefest.Merge<
47
- supabase.Tables<'tbl_contacts'>,
42
+ export type ContactType = Merge<
43
+ Tables<'tbl_contacts'>,
48
44
  { chats: ChatType[] | null; chat_count: number | null }
49
45
  >;
50
46