@rudderhq/db 0.7.2 → 0.7.4

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 (73) hide show
  1. package/dist/backup-lib.d.ts.map +1 -1
  2. package/dist/backup-lib.js +59 -43
  3. package/dist/backup-lib.js.map +1 -1
  4. package/dist/backup-lib.test.js +122 -2
  5. package/dist/backup-lib.test.js.map +1 -1
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +8 -3
  8. package/dist/client.js.map +1 -1
  9. package/dist/client.test.js +216 -5
  10. package/dist/client.test.js.map +1 -1
  11. package/dist/migrations/0149_app_builder_verified_source_ready.sql +3 -0
  12. package/dist/migrations/0150_rudder_plugins_v1.sql +114 -0
  13. package/dist/migrations/0151_agent_issue_creation_requests.sql +49 -0
  14. package/dist/migrations/0152_unified_requests_block_audit.sql +80 -0
  15. package/dist/migrations/0153_goal_result_ready_unique.sql +19 -0
  16. package/dist/migrations/0154_goal_owner_runtime_overrides.sql +1 -0
  17. package/dist/migrations/meta/_journal.json +42 -0
  18. package/dist/schema/{plugin_jobs.d.ts → agent_issue_creation_requests.d.ts} +134 -142
  19. package/dist/schema/{plugin_jobs.d.ts.map → agent_issue_creation_requests.d.ts.map} +1 -1
  20. package/dist/schema/agent_issue_creation_requests.js +40 -0
  21. package/dist/schema/agent_issue_creation_requests.js.map +1 -0
  22. package/dist/schema/app_builder_apps.js +1 -1
  23. package/dist/schema/app_builder_apps.js.map +1 -1
  24. package/dist/schema/goals.d.ts +20 -1
  25. package/dist/schema/goals.d.ts.map +1 -1
  26. package/dist/schema/goals.js +4 -0
  27. package/dist/schema/goals.js.map +1 -1
  28. package/dist/schema/index.d.ts +3 -8
  29. package/dist/schema/index.d.ts.map +1 -1
  30. package/dist/schema/index.js +3 -8
  31. package/dist/schema/index.js.map +1 -1
  32. package/dist/schema/issues.d.ts.map +1 -1
  33. package/dist/schema/issues.js +4 -0
  34. package/dist/schema/issues.js.map +1 -1
  35. package/dist/schema/requests.d.ts +714 -0
  36. package/dist/schema/requests.d.ts.map +1 -0
  37. package/dist/schema/requests.js +62 -0
  38. package/dist/schema/requests.js.map +1 -0
  39. package/dist/schema/rudder_plugins.d.ts +978 -0
  40. package/dist/schema/rudder_plugins.d.ts.map +1 -0
  41. package/dist/schema/rudder_plugins.js +91 -0
  42. package/dist/schema/rudder_plugins.js.map +1 -0
  43. package/package.json +2 -2
  44. package/dist/schema/plugin_config.d.ts +0 -123
  45. package/dist/schema/plugin_config.d.ts.map +0 -1
  46. package/dist/schema/plugin_config.js +0 -26
  47. package/dist/schema/plugin_config.js.map +0 -1
  48. package/dist/schema/plugin_entities.d.ts +0 -213
  49. package/dist/schema/plugin_entities.d.ts.map +0 -1
  50. package/dist/schema/plugin_entities.js +0 -37
  51. package/dist/schema/plugin_entities.js.map +0 -1
  52. package/dist/schema/plugin_jobs.js +0 -83
  53. package/dist/schema/plugin_jobs.js.map +0 -1
  54. package/dist/schema/plugin_logs.d.ts +0 -125
  55. package/dist/schema/plugin_logs.d.ts.map +0 -1
  56. package/dist/schema/plugin_logs.js +0 -29
  57. package/dist/schema/plugin_logs.js.map +0 -1
  58. package/dist/schema/plugin_organization_settings.d.ts +0 -158
  59. package/dist/schema/plugin_organization_settings.d.ts.map +0 -1
  60. package/dist/schema/plugin_organization_settings.js +0 -34
  61. package/dist/schema/plugin_organization_settings.js.map +0 -1
  62. package/dist/schema/plugin_state.d.ts +0 -169
  63. package/dist/schema/plugin_state.d.ts.map +0 -1
  64. package/dist/schema/plugin_state.js +0 -68
  65. package/dist/schema/plugin_state.js.map +0 -1
  66. package/dist/schema/plugin_webhooks.d.ts +0 -239
  67. package/dist/schema/plugin_webhooks.d.ts.map +0 -1
  68. package/dist/schema/plugin_webhooks.js +0 -52
  69. package/dist/schema/plugin_webhooks.js.map +0 -1
  70. package/dist/schema/plugins.d.ts +0 -246
  71. package/dist/schema/plugins.d.ts.map +0 -1
  72. package/dist/schema/plugins.js +0 -31
  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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB9B,CAAC;AAEJ,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe7B,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { sql } from "drizzle-orm";
2
+ import { boolean, check, index, jsonb, pgTable, text, timestamp, uniqueIndex, uuid, } from "drizzle-orm/pg-core";
3
+ import { organizations } from "./organizations.js";
4
+ export const pluginSources = pgTable("plugin_sources", {
5
+ id: uuid("id").primaryKey().defaultRandom(),
6
+ orgId: uuid("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
7
+ sourceType: text("source_type").notNull(),
8
+ label: text("label").notNull(),
9
+ locator: text("locator"),
10
+ metadata: jsonb("metadata").$type().notNull().default({}),
11
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
12
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
13
+ }, (table) => ({
14
+ orgIdx: index("plugin_sources_org_idx").on(table.orgId),
15
+ sourceTypeCheck: check("plugin_sources_type_check", sql `${table.sourceType} in ('local_upload', 'marketplace', 'git', 'package')`),
16
+ }));
17
+ export const pluginPackages = pgTable("plugin_packages", {
18
+ id: uuid("id").primaryKey().defaultRandom(),
19
+ sourceId: uuid("source_id").references(() => pluginSources.id, { onDelete: "set null" }),
20
+ name: text("name").notNull(),
21
+ version: text("version").notNull(),
22
+ digest: text("digest").notNull(),
23
+ rawManifest: jsonb("raw_manifest").$type().notNull(),
24
+ normalizedManifest: jsonb("normalized_manifest").$type().notNull(),
25
+ snapshot: jsonb("snapshot").$type().notNull(),
26
+ compatibility: jsonb("compatibility").$type().notNull().default({}),
27
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
28
+ }, (table) => ({
29
+ digestUnique: uniqueIndex("plugin_packages_digest_uq").on(table.digest),
30
+ identityIdx: index("plugin_packages_identity_idx").on(table.name, table.version),
31
+ }));
32
+ export const installedPlugins = pgTable("installed_plugins", {
33
+ id: uuid("id").primaryKey().defaultRandom(),
34
+ orgId: uuid("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
35
+ packageId: uuid("package_id").notNull().references(() => pluginPackages.id),
36
+ previousPackageId: uuid("previous_package_id").references(() => pluginPackages.id, { onDelete: "set null" }),
37
+ sourceId: uuid("source_id").references(() => pluginSources.id, { onDelete: "set null" }),
38
+ packageName: text("package_name").notNull(),
39
+ enabled: boolean("enabled").notNull().default(true),
40
+ lifecycleState: text("lifecycle_state").notNull().default("installed"),
41
+ setupState: text("setup_state").notNull().default("not_required"),
42
+ healthState: text("health_state").notNull().default("unknown"),
43
+ updateState: text("update_state").notNull().default("none"),
44
+ lastOperation: jsonb("last_operation").$type().notNull().default({}),
45
+ installedAt: timestamp("installed_at", { withTimezone: true }).notNull().defaultNow(),
46
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
47
+ }, (table) => ({
48
+ orgPackageNameUnique: uniqueIndex("installed_plugins_org_package_name_uq")
49
+ .on(table.orgId, table.packageName)
50
+ .where(sql `${table.lifecycleState} <> 'uninstalled'`),
51
+ orgLifecycleIdx: index("installed_plugins_org_lifecycle_idx").on(table.orgId, table.lifecycleState),
52
+ lifecycleCheck: check("installed_plugins_lifecycle_check", sql `${table.lifecycleState} in ('installed', 'uninstalling', 'uninstalled')`),
53
+ setupCheck: check("installed_plugins_setup_check", sql `${table.setupState} in ('not_required', 'setup_required', 'configuring', 'ready', 'blocked')`),
54
+ healthCheck: check("installed_plugins_health_check", sql `${table.healthState} in ('unknown', 'healthy', 'degraded', 'unavailable')`),
55
+ updateCheck: check("installed_plugins_update_check", sql `${table.updateState} in ('none', 'available', 'review_required', 'applying', 'failed')`),
56
+ }));
57
+ export const pluginComponentLinks = pgTable("plugin_component_links", {
58
+ id: uuid("id").primaryKey().defaultRandom(),
59
+ orgId: uuid("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
60
+ installedPluginId: uuid("installed_plugin_id").notNull().references(() => installedPlugins.id, { onDelete: "cascade" }),
61
+ componentType: text("component_type").notNull(),
62
+ componentKey: text("component_key").notNull(),
63
+ displayName: text("display_name").notNull(),
64
+ status: text("status").notNull(),
65
+ targetId: uuid("target_id"),
66
+ metadata: jsonb("metadata").$type().notNull().default({}),
67
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
68
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
69
+ }, (table) => ({
70
+ pluginComponentUnique: uniqueIndex("plugin_component_links_plugin_key_uq").on(table.installedPluginId, table.componentType, table.componentKey),
71
+ orgTargetIdx: index("plugin_component_links_org_target_idx").on(table.orgId, table.targetId),
72
+ typeCheck: check("plugin_component_links_type_check", sql `${table.componentType} in ('skill', 'mcp', 'app', 'unsupported')`),
73
+ statusCheck: check("plugin_component_links_status_check", sql `${table.status} in ('ready', 'setup_required', 'unsupported', 'disabled')`),
74
+ }));
75
+ export const pluginImportReports = pgTable("plugin_import_reports", {
76
+ id: uuid("id").primaryKey().defaultRandom(),
77
+ orgId: uuid("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
78
+ packageId: uuid("package_id").references(() => pluginPackages.id, { onDelete: "set null" }),
79
+ sourceId: uuid("source_id").references(() => pluginSources.id, { onDelete: "set null" }),
80
+ sourceType: text("source_type").notNull(),
81
+ sourceLabel: text("source_label").notNull(),
82
+ status: text("status").notNull(),
83
+ digest: text("digest"),
84
+ report: jsonb("report").$type().notNull(),
85
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
86
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
87
+ }, (table) => ({
88
+ orgCreatedIdx: index("plugin_import_reports_org_created_idx").on(table.orgId, table.createdAt),
89
+ statusCheck: check("plugin_import_reports_status_check", sql `${table.status} in ('review_required', 'accepted', 'rejected', 'failed')`),
90
+ }));
91
+ //# sourceMappingURL=rudder_plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rudder_plugins.js","sourceRoot":"","sources":["../../src/schema/rudder_plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,WAAW,EACX,IAAI,GACL,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE;IACrD,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE;IAC3C,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC3F,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;IACzC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE;IAC9B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAA2B,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAClF,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;IACjF,SAAS,EAAE,SA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AAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE;IAC3C,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;IAChC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC;IACtB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,EAA2B,CAAC,OAAO,EAAE;IAClE,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;IACjF,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;CAClF,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACb,aAAa,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9F,WAAW,EAAE,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAA,GAAG,KAAK,CAAC,MAAM,2DAA2D,CAAC;CACxI,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rudderhq/db",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "homepage": "https://github.com/Undertone0809/rudder",
6
6
  "bugs": {
@@ -51,7 +51,7 @@
51
51
  "seed": "tsx src/seed.ts"
52
52
  },
53
53
  "dependencies": {
54
- "@rudderhq/shared": "0.7.2",
54
+ "@rudderhq/shared": "0.7.4",
55
55
  "drizzle-orm": "^0.45.2",
56
56
  "embedded-postgres": "18.1.0-beta.16",
57
57
  "postgres": "^3.4.8"
@@ -1,123 +0,0 @@
1
- /**
2
- * `plugin_config` table — stores operator-provided instance configuration
3
- * for each plugin (one row per plugin, enforced by a unique index on
4
- * `plugin_id`).
5
- *
6
- * The `config_json` column holds the values that the operator enters in the
7
- * plugin settings UI. These values are validated at runtime against the
8
- * plugin's `instanceConfigSchema` from the manifest.
9
- *
10
- * @see doc/engineering/PLUGIN_RUNTIME_CONTRACT.md
11
- */
12
- export declare const pluginConfig: import("drizzle-orm/pg-core").PgTableWithColumns<{
13
- name: "plugin_config";
14
- schema: undefined;
15
- columns: {
16
- id: import("drizzle-orm/pg-core").PgColumn<{
17
- name: "id";
18
- tableName: "plugin_config";
19
- dataType: "string";
20
- columnType: "PgUUID";
21
- data: string;
22
- driverParam: string;
23
- notNull: true;
24
- hasDefault: true;
25
- isPrimaryKey: true;
26
- isAutoincrement: false;
27
- hasRuntimeDefault: false;
28
- enumValues: undefined;
29
- baseColumn: never;
30
- identity: undefined;
31
- generated: undefined;
32
- }, {}, {}>;
33
- pluginId: import("drizzle-orm/pg-core").PgColumn<{
34
- name: "plugin_id";
35
- tableName: "plugin_config";
36
- dataType: "string";
37
- columnType: "PgUUID";
38
- data: string;
39
- driverParam: string;
40
- notNull: true;
41
- hasDefault: false;
42
- isPrimaryKey: false;
43
- isAutoincrement: false;
44
- hasRuntimeDefault: false;
45
- enumValues: undefined;
46
- baseColumn: never;
47
- identity: undefined;
48
- generated: undefined;
49
- }, {}, {}>;
50
- configJson: import("drizzle-orm/pg-core").PgColumn<{
51
- name: "config_json";
52
- tableName: "plugin_config";
53
- dataType: "json";
54
- columnType: "PgJsonb";
55
- data: Record<string, unknown>;
56
- driverParam: unknown;
57
- notNull: true;
58
- hasDefault: true;
59
- isPrimaryKey: false;
60
- isAutoincrement: false;
61
- hasRuntimeDefault: false;
62
- enumValues: undefined;
63
- baseColumn: never;
64
- identity: undefined;
65
- generated: undefined;
66
- }, {}, {
67
- $type: Record<string, unknown>;
68
- }>;
69
- lastError: import("drizzle-orm/pg-core").PgColumn<{
70
- name: "last_error";
71
- tableName: "plugin_config";
72
- dataType: "string";
73
- columnType: "PgText";
74
- data: string;
75
- driverParam: string;
76
- notNull: false;
77
- hasDefault: false;
78
- isPrimaryKey: false;
79
- isAutoincrement: false;
80
- hasRuntimeDefault: false;
81
- enumValues: [string, ...string[]];
82
- baseColumn: never;
83
- identity: undefined;
84
- generated: undefined;
85
- }, {}, {}>;
86
- createdAt: import("drizzle-orm/pg-core").PgColumn<{
87
- name: "created_at";
88
- tableName: "plugin_config";
89
- dataType: "date";
90
- columnType: "PgTimestamp";
91
- data: Date;
92
- driverParam: string;
93
- notNull: true;
94
- hasDefault: true;
95
- isPrimaryKey: false;
96
- isAutoincrement: false;
97
- hasRuntimeDefault: false;
98
- enumValues: undefined;
99
- baseColumn: never;
100
- identity: undefined;
101
- generated: undefined;
102
- }, {}, {}>;
103
- updatedAt: import("drizzle-orm/pg-core").PgColumn<{
104
- name: "updated_at";
105
- tableName: "plugin_config";
106
- dataType: "date";
107
- columnType: "PgTimestamp";
108
- data: Date;
109
- driverParam: string;
110
- notNull: true;
111
- hasDefault: true;
112
- isPrimaryKey: false;
113
- isAutoincrement: false;
114
- hasRuntimeDefault: false;
115
- enumValues: undefined;
116
- baseColumn: never;
117
- identity: undefined;
118
- generated: undefined;
119
- }, {}, {}>;
120
- };
121
- dialect: "pg";
122
- }>;
123
- //# sourceMappingURL=plugin_config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin_config.d.ts","sourceRoot":"","sources":["../../src/schema/plugin_config.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAexB,CAAC"}
@@ -1,26 +0,0 @@
1
- import { jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
2
- import { plugins } from "./plugins.js";
3
- /**
4
- * `plugin_config` table — stores operator-provided instance configuration
5
- * for each plugin (one row per plugin, enforced by a unique index on
6
- * `plugin_id`).
7
- *
8
- * The `config_json` column holds the values that the operator enters in the
9
- * plugin settings UI. These values are validated at runtime against the
10
- * plugin's `instanceConfigSchema` from the manifest.
11
- *
12
- * @see doc/engineering/PLUGIN_RUNTIME_CONTRACT.md
13
- */
14
- export const pluginConfig = pgTable("plugin_config", {
15
- id: uuid("id").primaryKey().defaultRandom(),
16
- pluginId: uuid("plugin_id")
17
- .notNull()
18
- .references(() => plugins.id, { onDelete: "cascade" }),
19
- configJson: jsonb("config_json").$type().notNull().default({}),
20
- lastError: text("last_error"),
21
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
22
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
23
- }, (table) => ({
24
- pluginIdIdx: uniqueIndex("plugin_config_plugin_id_idx").on(table.pluginId),
25
- }));
26
- //# sourceMappingURL=plugin_config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin_config.js","sourceRoot":"","sources":["../../src/schema/plugin_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CACjC,eAAe,EACf;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE;IAC3C,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;SACxB,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACxD,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,KAAK,EAA2B,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACvF,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;IAC7B,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;IACjF,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;CAClF,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACV,WAAW,EAAE,WAAW,CAAC,6BAA6B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;CAC3E,CAAC,CACH,CAAC"}
@@ -1,213 +0,0 @@
1
- /**
2
- * `plugin_entities` table — persistent high-level mapping between Rudder
3
- * objects and external plugin-defined entities.
4
- *
5
- * This table is used by plugins (e.g. `linear`, `github`) to store pointers
6
- * to their respective external IDs for projects, issues, etc. and to store
7
- * their custom data.
8
- *
9
- * Unlike `plugin_state`, which is for raw K-V persistence, `plugin_entities`
10
- * is intended for structured object mappings that the host can understand
11
- * and query for cross-plugin UI integration.
12
- *
13
- * @see doc/engineering/PLUGIN_RUNTIME_CONTRACT.md
14
- */
15
- export declare const pluginEntities: import("drizzle-orm/pg-core").PgTableWithColumns<{
16
- name: "plugin_entities";
17
- schema: undefined;
18
- columns: {
19
- id: import("drizzle-orm/pg-core").PgColumn<{
20
- name: "id";
21
- tableName: "plugin_entities";
22
- dataType: "string";
23
- columnType: "PgUUID";
24
- data: string;
25
- driverParam: string;
26
- notNull: true;
27
- hasDefault: true;
28
- isPrimaryKey: true;
29
- isAutoincrement: false;
30
- hasRuntimeDefault: false;
31
- enumValues: undefined;
32
- baseColumn: never;
33
- identity: undefined;
34
- generated: undefined;
35
- }, {}, {}>;
36
- pluginId: import("drizzle-orm/pg-core").PgColumn<{
37
- name: "plugin_id";
38
- tableName: "plugin_entities";
39
- dataType: "string";
40
- columnType: "PgUUID";
41
- data: string;
42
- driverParam: string;
43
- notNull: true;
44
- hasDefault: false;
45
- isPrimaryKey: false;
46
- isAutoincrement: false;
47
- hasRuntimeDefault: false;
48
- enumValues: undefined;
49
- baseColumn: never;
50
- identity: undefined;
51
- generated: undefined;
52
- }, {}, {}>;
53
- entityType: import("drizzle-orm/pg-core").PgColumn<{
54
- name: "entity_type";
55
- tableName: "plugin_entities";
56
- dataType: "string";
57
- columnType: "PgText";
58
- data: string;
59
- driverParam: string;
60
- notNull: true;
61
- hasDefault: false;
62
- isPrimaryKey: false;
63
- isAutoincrement: false;
64
- hasRuntimeDefault: false;
65
- enumValues: [string, ...string[]];
66
- baseColumn: never;
67
- identity: undefined;
68
- generated: undefined;
69
- }, {}, {}>;
70
- scopeKind: import("drizzle-orm/pg-core").PgColumn<{
71
- name: "scope_kind";
72
- tableName: "plugin_entities";
73
- dataType: "string";
74
- columnType: "PgText";
75
- data: "issue" | "organization" | "agent" | "project" | "goal" | "run" | "instance" | "project_workspace";
76
- driverParam: string;
77
- notNull: true;
78
- hasDefault: false;
79
- isPrimaryKey: false;
80
- isAutoincrement: false;
81
- hasRuntimeDefault: false;
82
- enumValues: [string, ...string[]];
83
- baseColumn: never;
84
- identity: undefined;
85
- generated: undefined;
86
- }, {}, {
87
- $type: "issue" | "organization" | "agent" | "project" | "goal" | "run" | "instance" | "project_workspace";
88
- }>;
89
- scopeId: import("drizzle-orm/pg-core").PgColumn<{
90
- name: "scope_id";
91
- tableName: "plugin_entities";
92
- dataType: "string";
93
- columnType: "PgText";
94
- data: string;
95
- driverParam: string;
96
- notNull: false;
97
- hasDefault: false;
98
- isPrimaryKey: false;
99
- isAutoincrement: false;
100
- hasRuntimeDefault: false;
101
- enumValues: [string, ...string[]];
102
- baseColumn: never;
103
- identity: undefined;
104
- generated: undefined;
105
- }, {}, {}>;
106
- externalId: import("drizzle-orm/pg-core").PgColumn<{
107
- name: "external_id";
108
- tableName: "plugin_entities";
109
- dataType: "string";
110
- columnType: "PgText";
111
- data: string;
112
- driverParam: string;
113
- notNull: false;
114
- hasDefault: false;
115
- isPrimaryKey: false;
116
- isAutoincrement: false;
117
- hasRuntimeDefault: false;
118
- enumValues: [string, ...string[]];
119
- baseColumn: never;
120
- identity: undefined;
121
- generated: undefined;
122
- }, {}, {}>;
123
- title: import("drizzle-orm/pg-core").PgColumn<{
124
- name: "title";
125
- tableName: "plugin_entities";
126
- dataType: "string";
127
- columnType: "PgText";
128
- data: string;
129
- driverParam: string;
130
- notNull: false;
131
- hasDefault: false;
132
- isPrimaryKey: false;
133
- isAutoincrement: false;
134
- hasRuntimeDefault: false;
135
- enumValues: [string, ...string[]];
136
- baseColumn: never;
137
- identity: undefined;
138
- generated: undefined;
139
- }, {}, {}>;
140
- status: import("drizzle-orm/pg-core").PgColumn<{
141
- name: "status";
142
- tableName: "plugin_entities";
143
- dataType: "string";
144
- columnType: "PgText";
145
- data: string;
146
- driverParam: string;
147
- notNull: false;
148
- hasDefault: false;
149
- isPrimaryKey: false;
150
- isAutoincrement: false;
151
- hasRuntimeDefault: false;
152
- enumValues: [string, ...string[]];
153
- baseColumn: never;
154
- identity: undefined;
155
- generated: undefined;
156
- }, {}, {}>;
157
- data: import("drizzle-orm/pg-core").PgColumn<{
158
- name: "data";
159
- tableName: "plugin_entities";
160
- dataType: "json";
161
- columnType: "PgJsonb";
162
- data: Record<string, unknown>;
163
- driverParam: unknown;
164
- notNull: true;
165
- hasDefault: true;
166
- isPrimaryKey: false;
167
- isAutoincrement: false;
168
- hasRuntimeDefault: false;
169
- enumValues: undefined;
170
- baseColumn: never;
171
- identity: undefined;
172
- generated: undefined;
173
- }, {}, {
174
- $type: Record<string, unknown>;
175
- }>;
176
- createdAt: import("drizzle-orm/pg-core").PgColumn<{
177
- name: "created_at";
178
- tableName: "plugin_entities";
179
- dataType: "date";
180
- columnType: "PgTimestamp";
181
- data: Date;
182
- driverParam: string;
183
- notNull: true;
184
- hasDefault: true;
185
- isPrimaryKey: false;
186
- isAutoincrement: false;
187
- hasRuntimeDefault: false;
188
- enumValues: undefined;
189
- baseColumn: never;
190
- identity: undefined;
191
- generated: undefined;
192
- }, {}, {}>;
193
- updatedAt: import("drizzle-orm/pg-core").PgColumn<{
194
- name: "updated_at";
195
- tableName: "plugin_entities";
196
- dataType: "date";
197
- columnType: "PgTimestamp";
198
- data: Date;
199
- driverParam: string;
200
- notNull: true;
201
- hasDefault: true;
202
- isPrimaryKey: false;
203
- isAutoincrement: false;
204
- hasRuntimeDefault: false;
205
- enumValues: undefined;
206
- baseColumn: never;
207
- identity: undefined;
208
- generated: undefined;
209
- }, {}, {}>;
210
- };
211
- dialect: "pg";
212
- }>;
213
- //# sourceMappingURL=plugin_entities.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin_entities.d.ts","sourceRoot":"","sources":["../../src/schema/plugin_entities.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B1B,CAAC"}
@@ -1,37 +0,0 @@
1
- import { index, jsonb, pgTable, text, timestamp, uniqueIndex, uuid, } from "drizzle-orm/pg-core";
2
- import { plugins } from "./plugins.js";
3
- /**
4
- * `plugin_entities` table — persistent high-level mapping between Rudder
5
- * objects and external plugin-defined entities.
6
- *
7
- * This table is used by plugins (e.g. `linear`, `github`) to store pointers
8
- * to their respective external IDs for projects, issues, etc. and to store
9
- * their custom data.
10
- *
11
- * Unlike `plugin_state`, which is for raw K-V persistence, `plugin_entities`
12
- * is intended for structured object mappings that the host can understand
13
- * and query for cross-plugin UI integration.
14
- *
15
- * @see doc/engineering/PLUGIN_RUNTIME_CONTRACT.md
16
- */
17
- export const pluginEntities = pgTable("plugin_entities", {
18
- id: uuid("id").primaryKey().defaultRandom(),
19
- pluginId: uuid("plugin_id")
20
- .notNull()
21
- .references(() => plugins.id, { onDelete: "cascade" }),
22
- entityType: text("entity_type").notNull(),
23
- scopeKind: text("scope_kind").$type().notNull(),
24
- scopeId: text("scope_id"), // NULL for global scope (text to match plugin_state.scope_id)
25
- externalId: text("external_id"), // ID in the external system
26
- title: text("title"),
27
- status: text("status"),
28
- data: jsonb("data").$type().notNull().default({}),
29
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
30
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
31
- }, (table) => ({
32
- pluginIdx: index("plugin_entities_plugin_idx").on(table.pluginId),
33
- typeIdx: index("plugin_entities_type_idx").on(table.entityType),
34
- scopeIdx: index("plugin_entities_scope_idx").on(table.scopeKind, table.scopeId),
35
- externalIdx: uniqueIndex("plugin_entities_external_idx").on(table.pluginId, table.entityType, table.externalId),
36
- }));
37
- //# sourceMappingURL=plugin_entities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin_entities.js","sourceRoot":"","sources":["../../src/schema/plugin_entities.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,WAAW,EACX,IAAI,GACL,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CACnC,iBAAiB,EACjB;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE;IAC3C,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;SACxB,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,C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ueIndex, uuid, } from "drizzle-orm/pg-core";
2
- import { plugins } from "./plugins.js";
3
- /**
4
- * `plugin_jobs` table — registration and runtime configuration for
5
- * scheduled jobs declared by plugins in their manifests.
6
- *
7
- * Each row represents one scheduled job entry for a plugin. The
8
- * `job_key` matches the key declared in the manifest's `jobs` array.
9
- * The `schedule` column stores the cron expression or interval string
10
- * used by the job scheduler to decide when to fire the job.
11
- *
12
- * Status values:
13
- * - `active` — job is enabled and will run on schedule
14
- * - `paused` — job is temporarily disabled by the operator
15
- * - `error` — job has been disabled due to repeated failures
16
- *
17
- * @see doc/engineering/PLUGIN_RUNTIME_CONTRACT.md — `plugin_jobs`
18
- */
19
- export const pluginJobs = pgTable("plugin_jobs", {
20
- id: uuid("id").primaryKey().defaultRandom(),
21
- /** FK to the owning plugin. Cascades on delete. */
22
- pluginId: uuid("plugin_id")
23
- .notNull()
24
- .references(() => plugins.id, { onDelete: "cascade" }),
25
- /** Identifier matching the key in the plugin manifest's `jobs` array. */
26
- jobKey: text("job_key").notNull(),
27
- /** Cron expression (e.g. `"0 * * * *"`) or interval string. */
28
- schedule: text("schedule").notNull(),
29
- /** Current scheduling state. */
30
- status: text("status").$type().notNull().default("active"),
31
- /** Timestamp of the most recent successful execution. */
32
- lastRunAt: timestamp("last_run_at", { withTimezone: true }),
33
- /** Pre-computed timestamp of the next scheduled execution. */
34
- nextRunAt: timestamp("next_run_at", { withTimezone: true }),
35
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
36
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
37
- }, (table) => ({
38
- pluginIdx: index("plugin_jobs_plugin_idx").on(table.pluginId),
39
- nextRunIdx: index("plugin_jobs_next_run_idx").on(table.nextRunAt),
40
- uniqueJobIdx: uniqueIndex("plugin_jobs_unique_idx").on(table.pluginId, table.jobKey),
41
- }));
42
- /**
43
- * `plugin_job_runs` table — immutable execution history for plugin-owned jobs.
44
- *
45
- * Each row is created when a job run begins and updated when it completes.
46
- * Rows are never modified after `status` reaches a terminal value
47
- * (`succeeded` | `failed` | `cancelled`).
48
- *
49
- * Trigger values:
50
- * - `scheduled` — fired automatically by the cron/interval scheduler
51
- * - `manual` — triggered by an operator via the admin UI or API
52
- *
53
- * @see doc/engineering/PLUGIN_RUNTIME_CONTRACT.md — `plugin_job_runs`
54
- */
55
- export const pluginJobRuns = pgTable("plugin_job_runs", {
56
- id: uuid("id").primaryKey().defaultRandom(),
57
- /** FK to the parent job definition. Cascades on delete. */
58
- jobId: uuid("job_id")
59
- .notNull()
60
- .references(() => pluginJobs.id, { onDelete: "cascade" }),
61
- /** Denormalized FK to the owning plugin for efficient querying. Cascades on delete. */
62
- pluginId: uuid("plugin_id")
63
- .notNull()
64
- .references(() => plugins.id, { onDelete: "cascade" }),
65
- /** What caused this run to start (`"scheduled"` or `"manual"`). */
66
- trigger: text("trigger").$type().notNull(),
67
- /** Current lifecycle state of this run. */
68
- status: text("status").$type().notNull().default("pending"),
69
- /** Wall-clock duration in milliseconds. Null until the run finishes. */
70
- durationMs: integer("duration_ms"),
71
- /** Error message if `status === "failed"`. */
72
- error: text("error"),
73
- /** Ordered list of log lines emitted during this run. */
74
- logs: jsonb("logs").$type().notNull().default([]),
75
- startedAt: timestamp("started_at", { withTimezone: true }),
76
- finishedAt: timestamp("finished_at", { withTimezone: true }),
77
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
78
- }, (table) => ({
79
- jobIdx: index("plugin_job_runs_job_idx").on(table.jobId),
80
- pluginIdx: index("plugin_job_runs_plugin_idx").on(table.pluginId),
81
- statusIdx: index("plugin_job_runs_status_idx").on(table.status),
82
- }));
83
- //# sourceMappingURL=plugin_jobs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin_jobs.js","sourceRoot":"","sources":["../../src/schema/plugin_jobs.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAS,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