@periskope/types 0.6.7 → 0.6.9-2.1

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/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
4
  /* Projects */
6
5
  // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
6
  // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
@@ -9,9 +8,8 @@
9
8
  // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
9
  // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
10
  // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
11
  /* Language and Environment */
14
- "target": "ES2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
12
+ "target": "ES2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
13
  // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
14
  // "jsx": "preserve", /* Specify what JSX code is generated. */
17
15
  // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
@@ -23,9 +21,8 @@
23
21
  // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
22
  // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
23
  // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
-
27
24
  /* Modules */
28
- "module": "CommonJS", /* Specify what module code is generated. */
25
+ "module": "CommonJS", /* Specify what module code is generated. */
29
26
  // "rootDir": "./", /* Specify the root folder within your source files. */
30
27
  // "moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
31
28
  // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
@@ -42,20 +39,18 @@
42
39
  // "resolveJsonModule": true, /* Enable importing .json files. */
43
40
  // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
41
  // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
-
46
42
  /* JavaScript Support */
47
43
  // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
44
  // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
45
  // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
-
51
46
  /* Emit */
52
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
47
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
48
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
49
  // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
50
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
51
  // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
52
  // "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. */
53
+ "outDir": "dist/", /* Specify an output folder for all emitted files. */
59
54
  // "removeComments": true, /* Disable emitting comments. */
60
55
  // "noEmit": true, /* Disable emitting files from a compilation. */
61
56
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -72,17 +67,15 @@
72
67
  // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73
68
  // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74
69
  // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75
-
76
70
  /* Interop Constraints */
77
71
  // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78
72
  // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79
73
  // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
74
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
81
75
  // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
83
-
76
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
84
77
  /* Type Checking */
85
- "strict": true, /* Enable all strict type-checking options. */
78
+ "strict": true, /* Enable all strict type-checking options. */
86
79
  // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87
80
  // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88
81
  // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
@@ -101,9 +94,13 @@
101
94
  // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102
95
  // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103
96
  // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104
-
105
97
  /* Completeness */
106
98
  // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
108
- }
109
- }
99
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
100
+ },
101
+ "exclude": [
102
+ "node_modules",
103
+ "dist",
104
+ "scripts"
105
+ ]
106
+ }
package/types.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import { Chat, Location } from '@periskope/whatsapp-web.js';
2
+ import type { default as _Stripe } from 'stripe';
1
3
  import { Merge, OverrideProperties } from 'type-fest';
2
- import { Chat, MessageTypes } from 'whatsapp-web.js';
3
4
  import { Tables } from './supabase.types';
4
5
 
5
6
  /* ----------------------------- TYPE SHORTHANDS ---------------------------- */
@@ -14,47 +15,196 @@ export type WhatsappChat = Chat & {
14
15
 
15
16
  /* ------------------------------ PERISKOPE TYPES ------------------------------ */
16
17
 
17
- export type OrgType = Tables<'tbl_org'> & {
18
- user: Tables<'tbl_org_members'>;
19
- members: Tables<'tbl_org_members'>[];
20
- phones: Tables<'tbl_org_phones'>[];
21
- labels: Tables<'tbl_org_labels'>[];
18
+ export enum AllPlans {
19
+ FREE_TRIAL = 'free-trial',
20
+ // MONTHLY_STARTER = 'monthly-starter',
21
+ // YEARLY_STARTER = 'yearly-starter',
22
+ // MONTHLY_PRO = 'monthly-pro',
23
+ // YEARLY_PRO = 'yearly-pro',
24
+ ENTERPRISE = 'enterprise',
25
+ MONTHLY_STARTER_SINGLE = 'monthly-starter-single',
26
+ YEARLY_STARTER_SINGLE = 'yearly-starter-single',
27
+ MONTHLY_PRO_SINGLE = 'monthly-pro-single',
28
+ YEARLY_PRO_SINGLE = 'yearly-pro-single',
29
+ }
30
+
31
+ export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
32
+
33
+ export type Enterprise = `${string}-enterprise`;
34
+
35
+ export type OrgPlanEnterprise = {
36
+ // subscription_id: string
37
+ plan_id: Enterprise;
38
+ interval: number;
39
+ frequency: Frequency;
40
+ user_limit: number;
41
+ phone_limit: number;
42
+ current_period_start: number;
43
+ current_period_end: number | null;
44
+ };
45
+
46
+ export type OrgPlanNonEnterprise = {
47
+ subscription_id: string
48
+ plan_id: AllPlans;
49
+ interval: number;
50
+ frequency: Frequency;
51
+ user_limit: number;
52
+ phone_limit: number;
53
+ current_period_end: number;
54
+ current_period_start: number;
55
+ };
56
+
57
+ export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
58
+ ? OrgPlanEnterprise
59
+ : T extends AllPlans
60
+ ? OrgPlanNonEnterprise
61
+ : never;
62
+
63
+ export type MicrosurveyData = {
64
+ key: string;
65
+ text: string;
66
+ checked: boolean;
67
+ }[];
68
+
69
+ export type OrgPreferences = {
70
+ disable_ai_flagging?: boolean;
71
+ allow_exports?: boolean;
72
+ sync_phone_contacts?: boolean;
22
73
  };
23
74
 
24
- export type ChatMemberType = Merge<Tables<'tbl_chat_participants'>,
25
- Tables<'tbl_contacts'>>;
75
+ export type OrgMetadata = {
76
+ phone_number: string;
77
+ ticket_prefix: string;
78
+ referralSource?: string;
79
+ surveyData?: MicrosurveyData;
80
+ onboarding: Record<string, boolean>;
81
+ onboarding_completed_at: Date | null;
82
+ preferences?: OrgPreferences;
83
+ hubspot_pipelines?: {
84
+ id: string;
85
+ label: string;
86
+ default_stage: { id: string; label: string };
87
+ }[];
88
+ };
89
+
90
+ export type OrgType = OverrideProperties<
91
+ Merge<
92
+ Tables<'tbl_org'>,
93
+ {
94
+ user: Tables<'tbl_org_members'>;
95
+ members: Tables<'tbl_org_members'>[];
96
+ phones: Tables<'tbl_org_phones'>[];
97
+ labels: Tables<'tbl_org_labels'>[];
98
+ quick_replies: Tables<'tbl_quick_replies'>[];
99
+ custom_properties: Tables<'tbl_custom_properties'>[];
100
+ subscription_status: 'active' | 'inactive' | 'unpaid';
101
+ is_enterprise: boolean;
102
+ is_free_trial: boolean;
103
+ is_hubspot_connected: boolean;
104
+ }
105
+ >,
106
+ {
107
+ org_plan: OrgPlan<AllPlans | Enterprise>;
108
+ stripe_customer_details: _Stripe.Customer | null;
109
+ stripe_subscription_details: Array<_Stripe.Subscription> | null;
110
+ stripe_customer_id: _Stripe.Customer['id'] | null;
111
+ org_metadata: OrgMetadata;
112
+ }
113
+ >;
114
+
115
+ export type ChatMemberType = Merge<
116
+ Tables<'tbl_chat_participants'>,
117
+ Tables<'tbl_contacts'>
118
+ >;
26
119
 
27
120
  export type ChatType = Merge<
28
121
  Tables<'view_chats'>,
29
122
  {
30
123
  chat_id: string;
31
124
  latest_message: MessageType | null;
32
- members: Record<string,ChatMemberType> | null;
33
- chat_type: 'user' | 'group' | 'business';
34
- active_phone?: boolean;
35
- org_participants?: Tables<'tbl_chat_participants'>[];
36
- chat_access: Record<string, boolean>;
37
- label_ids: Record<string, boolean>;
38
- }
125
+ members: { [key: string]: ChatMemberType } | null;
126
+ chat_type: 'user' | 'group' | 'business' | 'unknown';
127
+ chat_access: { [key: string]: boolean };
128
+ label_ids: { [key: string]: boolean };
129
+ chat_org_phones?: string[];
130
+ message_unread_count: number | null;
131
+ hubspot_metadata: {
132
+ id: string;
133
+ type: string;
134
+ hubId: string;
135
+ object_data: HubspotObjectDataType;
136
+ } | null;
137
+ // is_open?: boolean;
138
+ }
39
139
  >;
40
140
 
141
+ /* -------------------------------------------------------------------------- */
142
+ /* MESSAGE */
143
+ /* -------------------------------------------------------------------------- */
144
+
41
145
  export type MediaType = {
42
146
  path: string;
43
- mimetype: string | null;
44
- filename: string | null;
45
- }
147
+ mimetype?: string;
148
+ filename?: string;
149
+ dimensions?: { width: number; height: number; ar: number };
150
+ size?: number;
151
+ thumbnail?: string;
152
+ };
46
153
 
47
- export type MessageType = OverrideProperties<Tables<'tbl_chat_messages'>, {
48
- message_type: MessageTypes;
49
- media: MediaType | null;
50
- }>;
154
+ export type MessageType = OverrideProperties<
155
+ Tables<'tbl_chat_messages'>,
156
+ {
157
+ message_id: string;
158
+ org_id: string;
159
+ org_phone: string;
160
+ chat_id: string;
161
+ message_type: (typeof SUPPORTED_TYPES)[number];
162
+ media: MediaType | null;
163
+ flag_metadata: MessageFlagType | null;
164
+ }
165
+ >;
166
+
167
+ export type MessageFlagType = {
168
+ status: boolean;
169
+ response_type?: 'message' | 'reaction' | 'ticket';
170
+ response_id?: string;
171
+ response_timestamp?: string;
172
+ response_email?: string;
173
+ };
51
174
 
175
+ /* -------------------------------------------------------------------------- */
176
+
177
+ export type TicketType = OverrideProperties<
178
+ Tables<'tbl_chat_tickets'>,
179
+ {
180
+ label_ids: { [key: string]: boolean };
181
+ hubspot_metadata: {
182
+ id?: string;
183
+ type?: string;
184
+ hubId?: string;
185
+ pipeline: {
186
+ id: string;
187
+ label: string;
188
+ };
189
+ object_data?: HubspotObjectDataType;
190
+ } | null;
191
+ }
192
+ >;
52
193
  export type ContactType = Merge<
53
194
  Tables<'tbl_contacts'>,
54
- { chats: ChatType[] | null; chat_count: number | null; chat_ids: string[] | null }
195
+ {
196
+ chats: ChatType[] | null;
197
+ chat_ids?: string[];
198
+ }
55
199
  >;
200
+ export type ReactionType = Tables<'tbl_chat_reactions'>;
201
+
202
+ export type NotificationType = Tables<'tbl_chat_notifications'>;
56
203
 
57
- export type ChatAccessType = Merge<Partial<Tables<'tbl_chat_access'>>,Tables<'tbl_org_members'>>;
204
+ export type ChatAccessType = Merge<
205
+ Partial<Tables<'tbl_chat_access'>>,
206
+ Tables<'tbl_org_members'>
207
+ >;
58
208
 
59
209
  /* -------------------------------- CONSTANTS ------------------------------- */
60
210
 
@@ -83,3 +233,246 @@ export const enumChatColors = [
83
233
  '#FF2E74',
84
234
  '#DB2777',
85
235
  ] as const;
236
+
237
+ /* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
238
+
239
+ export const SUPPORTED_TYPES = [
240
+ 'chat',
241
+ 'sticker',
242
+ 'image',
243
+ 'video',
244
+ 'document',
245
+ 'vcard',
246
+ 'multi_vcard',
247
+ 'audio',
248
+ 'ptt',
249
+ 'poll_creation',
250
+ 'location',
251
+ ] as const;
252
+
253
+ export type SendMessageContent = {
254
+ message_type?: (typeof SUPPORTED_TYPES)[number];
255
+ body?: string;
256
+ media?: MediaType;
257
+ contact_ids?: string[];
258
+ location?: Location;
259
+ quoted_message_id?: string;
260
+ quoted_message_type?: 'reply' | 'forward' | 'reply_private';
261
+ broadcast_id?: string;
262
+ performed_by?: string;
263
+ variables?: { [key: string]: VariableType };
264
+ };
265
+
266
+ export type QuickReplyContent = Omit<
267
+ SendMessageContent,
268
+ 'broadcast_id' | 'variables'
269
+ >;
270
+
271
+ export type VariableType = { [key: string]: string };
272
+
273
+ export type BroadcastMessagePayload = SendMessageContent & {
274
+ chat_ids: string[];
275
+ broadcast_id?: string;
276
+ };
277
+
278
+ export type SingleMessagePayload = SendMessageContent & {
279
+ chat_id: string;
280
+ job_id?: string;
281
+ };
282
+
283
+ export type MessageAttachmentFileTypes =
284
+ | 'image'
285
+ | 'audio'
286
+ | 'document'
287
+ | 'video';
288
+
289
+ export type AttachmentTypeProps =
290
+ | {
291
+ result: string;
292
+ file: File | null;
293
+ type: MessageAttachmentFileTypes;
294
+ }
295
+ | {
296
+ link: {
297
+ url: string;
298
+ type: MessageAttachmentFileTypes;
299
+ name: string;
300
+ mimetype?: string;
301
+ };
302
+ };
303
+
304
+ /* -------------------------------- BROADCAST ------------------------------- */
305
+
306
+ export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
307
+ logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
308
+ } & {
309
+ chats: ChatType[];
310
+ };
311
+
312
+ /* ----------------------- CHAT PARTICIPANT OPERATION ----------------------- */
313
+
314
+ export type ChatParticipantOperation = {
315
+ participant_ids: string[];
316
+ operation_type: 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
317
+ };
318
+
319
+ export type ChatParticipantOperationPayload = ChatParticipantOperation & {
320
+ chat_ids: string[];
321
+ };
322
+
323
+ /* ----------------------- BILLING - STRIPE ----------------------- */
324
+
325
+ export type StripeSubscription = _Stripe.Subscription;
326
+ export type StripeCustomer = _Stripe.Customer;
327
+ export type StripeCoupon = _Stripe.Coupon;
328
+ export type StripePrice = _Stripe.Price;
329
+ export type Stripe = _Stripe;
330
+ export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
331
+ export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
332
+
333
+ /* -------------------------------- REALTIME -------------------------------- */
334
+
335
+ export type PhoneStateType = {
336
+ loading: boolean;
337
+ state: string;
338
+ sync: number;
339
+ percent: number | null;
340
+ message?: string;
341
+ error?: string;
342
+ };
343
+
344
+ /* ------------------------------- INTEGRATIONS ----------------------------- */
345
+
346
+ export type ChatInfoType = Merge<
347
+ ChatType,
348
+ {
349
+ members: {
350
+ [key: string]: Merge<ChatMemberType, { contact_labels: string }>;
351
+ } | null;
352
+ chat_labels: string | null;
353
+ custom_properties: { [key: string]: string } | null;
354
+ }
355
+ >;
356
+
357
+ export type TicketInfoType = {
358
+ chat: ChatInfoType;
359
+ message: {
360
+ body: string;
361
+ chat_id: string;
362
+ org_phone: string;
363
+ timestamp: string;
364
+ media_path: string;
365
+ message_id: string;
366
+ sender_name: string;
367
+ performed_by: string;
368
+ sender_phone: string;
369
+ };
370
+ ticket: {
371
+ org_id: string;
372
+ status: string;
373
+ subject: string;
374
+ assignee: string;
375
+ due_date: string;
376
+ priority: 0 | 1 | 2 | 3 | 4;
377
+ raised_by: string;
378
+ ticket_id: string;
379
+ created_at: string;
380
+ assigned_by: string;
381
+ ticket_labels: string;
382
+ quoted_message_id: string;
383
+ };
384
+ };
385
+
386
+ export enum IntegrationLogType {
387
+ NEW_CHAT = 'chat.created',
388
+ NEW_MESSAGE = 'message.created',
389
+ MESSAGE_UPDATED = 'message.updated',
390
+ MESSAGE_DELETED = 'message.deleted',
391
+ MESSAGE_ACK_UPDATED = 'message.ack.updated',
392
+ REACTION_CREATED = 'reaction.created',
393
+ REACTION_UPDATED = 'reaction.updated',
394
+ NEW_TICKET = 'ticket.created',
395
+ TICKET_UPDATED = 'ticket.updated',
396
+ TICKET_DELETED = 'ticket.deleted',
397
+ }
398
+
399
+ export type IntegrationLogMetadataType<T extends IntegrationLogType> =
400
+ T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED
401
+ ? TicketInfoType
402
+ : T extends IntegrationLogType.NEW_CHAT
403
+ ? Tables<'tbl_chats'>
404
+ : T extends
405
+ | IntegrationLogType.NEW_MESSAGE
406
+ | IntegrationLogType.MESSAGE_UPDATED
407
+ | IntegrationLogType.MESSAGE_DELETED
408
+ | IntegrationLogType.MESSAGE_ACK_UPDATED
409
+ ? Tables<'tbl_chat_messages'>
410
+ : T extends
411
+ | IntegrationLogType.REACTION_CREATED
412
+ | IntegrationLogType.REACTION_UPDATED
413
+ ? Tables<'tbl_chat_reactions'>
414
+ : {
415
+ [key: string]: unknown;
416
+ };
417
+
418
+ export type IntegrationLogDetailsType<T extends IntegrationLogType> =
419
+ OverrideProperties<
420
+ Tables<'tbl_integration_logs'>,
421
+ {
422
+ integration_name: T;
423
+ metadata: {
424
+ event: IntegrationLogMetadataType<T> & {
425
+ event_type: string;
426
+ org_id: string;
427
+ previous_attributes: {
428
+ [key: string]: unknown;
429
+ };
430
+ };
431
+ hook_id: string;
432
+ name: string;
433
+ };
434
+ }
435
+ >;
436
+
437
+ export type APIAuthDetails = {
438
+ org_details: Tables<'view_org'> | null;
439
+ phone_details: Tables<'tbl_org_phones'> | null;
440
+ token_details: Tables<'tbl_integration_tokens'> | null;
441
+ };
442
+
443
+ export type WebhookDataType = OverrideProperties<
444
+ Tables<'tbl_integration_hooks'>,
445
+ {
446
+ integration_name: string[];
447
+ }
448
+ >;
449
+
450
+ export type HubspotObjectDataType = {
451
+ createdAt: string;
452
+ archived: boolean;
453
+ id: string;
454
+ type: 'contacts' | 'tickets' | 'companies';
455
+ properties: Record<
456
+ string,
457
+ {
458
+ groupLabel: string;
459
+ groupName: string;
460
+ propertyKeyName: string;
461
+ propertyKey: string;
462
+ propertyInternalValue: string;
463
+ propertyValue: string;
464
+ propertyType: string;
465
+ propertyFieldType: string;
466
+ }[]
467
+ >;
468
+ };
469
+
470
+ /* ---------------------------- USER PREFERENCES ---------------------------- */
471
+
472
+ export type UserPreferences = {
473
+ theme: 'light' | 'dark';
474
+ language: 'en' | 'es';
475
+ left_sidebar_open: boolean;
476
+ right_sidepanel_open: boolean;
477
+ sync_wa_unread_count: boolean;
478
+ };
@@ -0,0 +1,21 @@
1
+ # Define the path to your package.json file
2
+ $packageJsonPath = "./package.json"
3
+
4
+ # Read the package.json file
5
+ $packageJson = Get-Content $packageJsonPath -Raw | ConvertFrom-Json
6
+
7
+ # Increment the patch version
8
+ $versionParts = $packageJson.version -split '\.'
9
+ $versionParts[2] = [int]$versionParts[2] + 1
10
+ $newVersion = $versionParts -join '.'
11
+
12
+ Write-Host "Updating package version to $newVersion"
13
+
14
+ # Update the version in the object
15
+ $packageJson.version = $newVersion
16
+
17
+ # Convert the object back to JSON and save
18
+ $packageJson | ConvertTo-Json -Depth 100 | Set-Content $packageJsonPath
19
+
20
+ # Run npm command
21
+ npm run update-package