@processfocus/cli 0.1.0-next.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.
Files changed (71) hide show
  1. package/LICENSE.md +28 -0
  2. package/README.md +736 -0
  3. package/dist/bundled-db-import.mjs +475 -0
  4. package/dist/bundled-graphql-schema.mjs +55 -0
  5. package/dist/main.mjs +1444 -0
  6. package/dist/prepare-deployment-artifact.mjs +4 -0
  7. package/dist/resources/cedar/policies.cedar +315 -0
  8. package/dist/resources/cedar/schema.cedarschema +276 -0
  9. package/dist/resources/system-migrations/20251230050207_wild_ikaris/migration.sql +1 -0
  10. package/dist/resources/system-migrations/20251230050207_wild_ikaris/snapshot.json +10 -0
  11. package/dist/resources/system-migrations/20260215222342_legacy_deploy_placeholder/migration.sql +1 -0
  12. package/dist/resources/system-migrations/20260217210625_legacy_deploy_placeholder/migration.sql +1 -0
  13. package/dist/resources/system-migrations/20260225225114_legacy_deploy_placeholder/migration.sql +1 -0
  14. package/dist/resources/system-migrations/20260304233747_legacy_deploy_placeholder/migration.sql +1 -0
  15. package/dist/resources/system-migrations/20260313015405_legacy_deploy_placeholder/migration.sql +1 -0
  16. package/dist/resources/system-migrations/20260317191043_legacy_deploy_placeholder/migration.sql +1 -0
  17. package/dist/resources/system-migrations/20260401023429_legacy_deploy_placeholder/migration.sql +1 -0
  18. package/dist/resources/system-migrations/20260401074807_legacy_deploy_placeholder/migration.sql +1 -0
  19. package/dist/resources/system-migrations/20260407221320_legacy_deploy_placeholder/migration.sql +1 -0
  20. package/dist/resources/system-migrations/20260409221005_lyrical_slapstick/migration.sql +588 -0
  21. package/dist/resources/system-migrations/20260409221005_lyrical_slapstick/snapshot.json +5580 -0
  22. package/dist/resources/system-migrations/20260410054541_updated-at-triggers/migration.sql +259 -0
  23. package/dist/resources/system-migrations/20260410054541_updated-at-triggers/snapshot.json +5580 -0
  24. package/dist/resources/system-migrations/20260506185000_external-participants/migration.sql +27 -0
  25. package/dist/resources/system-migrations/20260525081848_confused_mac_gargan/migration.sql +16 -0
  26. package/dist/resources/system-migrations/20260525081848_confused_mac_gargan/snapshot.json +5929 -0
  27. package/dist/resources/system-migrations/20260525211724_ordinary_archangel/migration.sql +1 -0
  28. package/dist/resources/system-migrations/20260525211724_ordinary_archangel/snapshot.json +5954 -0
  29. package/dist/resources/system-migrations/20260526022120_cultured_daredevil/migration.sql +1 -0
  30. package/dist/resources/system-migrations/20260526022120_cultured_daredevil/snapshot.json +5979 -0
  31. package/dist/resources/system-migrations/20260607222956_blue_maelstrom/migration.sql +26 -0
  32. package/dist/resources/system-migrations/20260607222956_blue_maelstrom/snapshot.json +6139 -0
  33. package/dist/resources/system-migrations/20260608074412_productive_guardian/migration.sql +4 -0
  34. package/dist/resources/system-migrations/20260608074412_productive_guardian/snapshot.json +6179 -0
  35. package/dist/resources/system-migrations/20260609042621_huge_hellcat/migration.sql +3 -0
  36. package/dist/resources/system-migrations/20260609042621_huge_hellcat/snapshot.json +6209 -0
  37. package/dist/resources/system-migrations/20260626224225_glorious_tenebrous/migration.sql +107 -0
  38. package/dist/resources/system-migrations/20260626224225_glorious_tenebrous/snapshot.json +6221 -0
  39. package/dist/resources/system-migrations/20260722090215_mighty_colonel_america/migration.sql +26 -0
  40. package/dist/resources/system-migrations/20260722090215_mighty_colonel_america/snapshot.json +6490 -0
  41. package/dist/resources/system-migrations/20260722234847_brainy_quasimodo/migration.sql +1 -0
  42. package/dist/resources/system-migrations/20260722234847_brainy_quasimodo/snapshot.json +6500 -0
  43. package/dist/resources/system-migrations/20260727044204_nostalgic_lightspeed/migration.sql +51 -0
  44. package/dist/resources/system-migrations/20260727044204_nostalgic_lightspeed/snapshot.json +6670 -0
  45. package/dist/resources/system-migrations/20260727044743_green_thaddeus_ross/migration.sql +30 -0
  46. package/dist/resources/system-migrations/20260727044743_green_thaddeus_ross/snapshot.json +6670 -0
  47. package/dist/resources/system-migrations/20260727085203_safe_flatman/migration.sql +80 -0
  48. package/dist/resources/system-migrations/20260727085203_safe_flatman/snapshot.json +6803 -0
  49. package/dist/resources/system-migrations/20260727192244_natural_franklin_richards/migration.sql +14 -0
  50. package/dist/resources/system-migrations/20260727192244_natural_franklin_richards/snapshot.json +6947 -0
  51. package/dist/resources/system-migrations/20260727230751_updated-at-triggers/migration.sql +1 -0
  52. package/dist/resources/system-migrations/20260727230751_updated-at-triggers/snapshot.json +6947 -0
  53. package/dist/resources/system-migrations/20260727230758_pale_mother_askani/migration.sql +25 -0
  54. package/dist/resources/system-migrations/20260727230758_pale_mother_askani/snapshot.json +7121 -0
  55. package/dist/resources/system-migrations/20260831084613_nostalgic_hannibal_king/migration.sql +4 -0
  56. package/dist/resources/system-migrations/20260831084613_nostalgic_hannibal_king/snapshot.json +6852 -0
  57. package/dist/resources/system-migrations/20260906234923_stiff_maria_hill/migration.sql +77 -0
  58. package/dist/resources/system-migrations/20260906234923_stiff_maria_hill/snapshot.json +7396 -0
  59. package/dist/resources/system-migrations/20260907104651_delegation-rename-snapshots/migration.sql +2 -0
  60. package/dist/resources/system-migrations/20260907104651_delegation-rename-snapshots/snapshot.json +7416 -0
  61. package/dist/resources/system-migrations/20260907113440_abandoned_vertigo/migration.sql +2 -0
  62. package/dist/resources/system-migrations/20260907113440_abandoned_vertigo/snapshot.json +7466 -0
  63. package/dist/resources/system-migrations/20260908002610_mute_sharon_ventura/migration.sql +87 -0
  64. package/dist/resources/system-migrations/20260908002610_mute_sharon_ventura/snapshot.json +7491 -0
  65. package/dist/resources/system-migrations/20260914100808_slippery_ultragirl/migration.sql +1 -0
  66. package/dist/resources/system-migrations/20260914100808_slippery_ultragirl/snapshot.json +7501 -0
  67. package/dist/resources/system-migrations/20260919083020_passkey-name/migration.sql +1 -0
  68. package/dist/resources/system-migrations/20260919083020_passkey-name/snapshot.json +7511 -0
  69. package/dist/resources/system-migrations/20260919094049_passkey-last-used/migration.sql +1 -0
  70. package/dist/resources/system-migrations/20260919094049_passkey-last-used/snapshot.json +7521 -0
  71. package/package.json +36 -0
@@ -0,0 +1,107 @@
1
+ DROP VIEW IF EXISTS `pf_process_its_active_processes`;--> statement-breakpoint
2
+ DROP VIEW IF EXISTS `pf_process_its_no_drafts`;--> statement-breakpoint
3
+ DROP VIEW IF EXISTS `pf_process_state_its_is_draft`;--> statement-breakpoint
4
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
5
+ CREATE TABLE `__new_pf_process_state` (
6
+ `id` text(41) PRIMARY KEY,
7
+ `process_id` text(41) NOT NULL,
8
+ `start_step` text(41) NOT NULL,
9
+ `state` text NOT NULL,
10
+ `started_by_user` text(41),
11
+ `started_by_external_participant` text(41),
12
+ `started_by_role` text(41),
13
+ `created_at` real DEFAULT (julianday('now')) NOT NULL,
14
+ `updated_at` real DEFAULT (julianday('now')) NOT NULL,
15
+ `created_by` text(256) DEFAULT 'SYSTEM' NOT NULL,
16
+ `updated_by` text(256) DEFAULT 'SYSTEM' NOT NULL,
17
+ `_deleted` integer DEFAULT false NOT NULL,
18
+ CONSTRAINT `pf_process_state_process_id_pf_process_id_fk` FOREIGN KEY (`process_id`) REFERENCES `pf_process`(`id`),
19
+ CONSTRAINT `pf_process_state_start_step_pf_step_id_fk` FOREIGN KEY (`start_step`) REFERENCES `pf_step`(`id`),
20
+ CONSTRAINT `pf_process_state_started_by_user_pf_user_id_fk` FOREIGN KEY (`started_by_user`) REFERENCES `pf_user`(`id`),
21
+ CONSTRAINT `pf_process_state_started_by_external_participant_pf_external_participant_id_fk` FOREIGN KEY (`started_by_external_participant`) REFERENCES `pf_external_participant`(`id`),
22
+ CONSTRAINT `pf_process_state_started_by_role_pf_role_id_fk` FOREIGN KEY (`started_by_role`) REFERENCES `pf_role`(`id`),
23
+ CONSTRAINT "single_starter_check" CHECK("started_by_user" is null or "started_by_external_participant" is null)
24
+ );
25
+ --> statement-breakpoint
26
+ INSERT INTO `__new_pf_process_state`(`id`, `process_id`, `start_step`, `state`, `started_by_user`, `started_by_external_participant`, `started_by_role`, `created_at`, `updated_at`, `created_by`, `updated_by`, `_deleted`) SELECT `id`, `process_id`, `start_step`, `state`, `started_by_user`, `started_by_external_participant`, `started_by_role`, `created_at`, `updated_at`, `created_by`, `updated_by`, `_deleted` FROM `pf_process_state`;--> statement-breakpoint
27
+ DROP TABLE `pf_process_state`;--> statement-breakpoint
28
+ ALTER TABLE `__new_pf_process_state` RENAME TO `pf_process_state`;--> statement-breakpoint
29
+ PRAGMA foreign_keys=ON;--> statement-breakpoint
30
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
31
+ CREATE TABLE `__new_pf_to_do` (
32
+ `id` text(41) PRIMARY KEY,
33
+ `process_execution_id` text(41) NOT NULL,
34
+ `flow_id` text(41) NOT NULL,
35
+ `completed_by_user` text(41),
36
+ `completed_by_external_participant` text(41),
37
+ `assigned_to_provider_user` text(41),
38
+ `business_duration` integer,
39
+ `sla_target_at` real,
40
+ `sla_warning_at` real,
41
+ `failure_reason` text collate nocase,
42
+ `correction_required_at` real,
43
+ `correction_failure_reason` text collate nocase,
44
+ `correction_invitation_attempt_id` text(41),
45
+ `item_data` text,
46
+ `barrier_scheduled_flow_id` text(41),
47
+ `completed_by_role` text(41),
48
+ `created_at` real DEFAULT (julianday('now')) NOT NULL,
49
+ `updated_at` real DEFAULT (julianday('now')) NOT NULL,
50
+ `created_by` text(256) DEFAULT 'SYSTEM' NOT NULL,
51
+ `updated_by` text(256) DEFAULT 'SYSTEM' NOT NULL,
52
+ `_deleted` integer DEFAULT false NOT NULL,
53
+ CONSTRAINT `pf_to_do_process_execution_id_pf_process_execution_id_fk` FOREIGN KEY (`process_execution_id`) REFERENCES `pf_process_execution`(`id`),
54
+ CONSTRAINT `pf_to_do_flow_id_pf_flow_id_fk` FOREIGN KEY (`flow_id`) REFERENCES `pf_flow`(`id`),
55
+ CONSTRAINT `pf_to_do_completed_by_user_pf_user_id_fk` FOREIGN KEY (`completed_by_user`) REFERENCES `pf_user`(`id`),
56
+ CONSTRAINT `pf_to_do_completed_by_external_participant_pf_external_participant_id_fk` FOREIGN KEY (`completed_by_external_participant`) REFERENCES `pf_external_participant`(`id`),
57
+ CONSTRAINT `pf_to_do_assigned_to_provider_user_pf_provider_user_id_fk` FOREIGN KEY (`assigned_to_provider_user`) REFERENCES `pf_provider_user`(`id`),
58
+ CONSTRAINT `pf_to_do_completed_by_role_pf_role_id_fk` FOREIGN KEY (`completed_by_role`) REFERENCES `pf_role`(`id`),
59
+ CONSTRAINT "single_completer_check" CHECK("completed_by_user" is null or "completed_by_external_participant" is null)
60
+ );
61
+ --> statement-breakpoint
62
+ INSERT INTO `__new_pf_to_do`(`id`, `process_execution_id`, `flow_id`, `completed_by_user`, `completed_by_external_participant`, `assigned_to_provider_user`, `business_duration`, `sla_target_at`, `sla_warning_at`, `failure_reason`, `correction_required_at`, `correction_failure_reason`, `correction_invitation_attempt_id`, `item_data`, `barrier_scheduled_flow_id`, `completed_by_role`, `created_at`, `updated_at`, `created_by`, `updated_by`, `_deleted`) SELECT `id`, `process_execution_id`, `flow_id`, `completed_by_user`, `completed_by_external_participant`, `assigned_to_provider_user`, `business_duration`, `sla_target_at`, `sla_warning_at`, `failure_reason`, `correction_required_at`, `correction_failure_reason`, `correction_invitation_attempt_id`, `item_data`, `barrier_scheduled_flow_id`, `completed_by_role`, `created_at`, `updated_at`, `created_by`, `updated_by`, `_deleted` FROM `pf_to_do`;--> statement-breakpoint
63
+ DROP TABLE `pf_to_do`;--> statement-breakpoint
64
+ ALTER TABLE `__new_pf_to_do` RENAME TO `pf_to_do`;--> statement-breakpoint
65
+ PRAGMA foreign_keys=ON;--> statement-breakpoint
66
+ CREATE INDEX `pf_process_state_updated_at_id_idx` ON `pf_process_state` (`updated_at`,`id`);--> statement-breakpoint
67
+ CREATE INDEX `pf_to_do_updated_at_id_idx` ON `pf_to_do` (`updated_at`,`id`);--> statement-breakpoint
68
+ CREATE VIEW `pf_process_its_active_processes` AS
69
+ select
70
+ pf_process.id,
71
+ count(distinct pf_to_do.id) as active_processes
72
+ from pf_process
73
+ left outer join pf_process_state on pf_process_state.process_id = pf_process.id and pf_process_state._deleted = false
74
+ left outer join pf_process_execution on pf_process_execution.process_state_id = pf_process_state.id and pf_process_execution._deleted = false
75
+ left outer join pf_to_do on pf_to_do.process_execution_id = pf_process_execution.id and pf_to_do._deleted = false
76
+ group by
77
+ pf_process.id
78
+ ;--> statement-breakpoint
79
+ CREATE VIEW `pf_process_its_no_drafts` AS
80
+ select
81
+ id,
82
+ not exists (select 1 from pf_process_execution
83
+ join pf_process_state on pf_process_execution.process_state_id = pf_process_state.id and pf_process_state._deleted = false
84
+ where pf_process_state.process_id = pf_process.id and pf_process_execution._deleted = false) as no_drafts
85
+ from pf_process
86
+ ;--> statement-breakpoint
87
+ CREATE VIEW `pf_process_state_its_is_draft` AS
88
+ select
89
+ id,
90
+ not exists (select 1 from pf_process_execution where pf_process_execution.process_state_id = pf_process_state.id and pf_process_execution._deleted = false) as is_draft
91
+ from pf_process_state
92
+ ;--> statement-breakpoint
93
+ CREATE TRIGGER IF NOT EXISTS pf_process_state_updated_at_trigger
94
+ AFTER UPDATE ON "pf_process_state"
95
+ FOR EACH ROW
96
+ WHEN NEW.updated_at = OLD.updated_at
97
+ BEGIN
98
+ UPDATE "pf_process_state" SET updated_at = julianday('now') WHERE id = NEW.id;
99
+ END;
100
+ --> statement-breakpoint
101
+ CREATE TRIGGER IF NOT EXISTS pf_to_do_updated_at_trigger
102
+ AFTER UPDATE ON "pf_to_do"
103
+ FOR EACH ROW
104
+ WHEN NEW.updated_at = OLD.updated_at
105
+ BEGIN
106
+ UPDATE "pf_to_do" SET updated_at = julianday('now') WHERE id = NEW.id;
107
+ END;