@objectstack/platform-objects 5.1.0 → 6.0.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.
package/dist/index.js CHANGED
@@ -3268,6 +3268,20 @@ var defaultPermissionSets = [
3268
3268
  operation: "select",
3269
3269
  using: "id = current_user.id"
3270
3270
  },
3271
+ // Org collaborators: members can see other users in the same
3272
+ // organization. Without this, owner/assignee lookups, @-mention
3273
+ // suggestions, reviewer pickers and team-roster surfaces all
3274
+ // collapse to just the current user. `org_user_ids` is
3275
+ // pre-resolved by runtime/resolve-execution-context from
3276
+ // `sys_member` for the active organization. Sensitive credential
3277
+ // tables (`sys_account`, `sys_session`, `sys_api_key`, …) keep
3278
+ // their stricter self-only carve-outs above.
3279
+ {
3280
+ name: "sys_user_org_members",
3281
+ object: "sys_user",
3282
+ operation: "select",
3283
+ using: "id IN (current_user.org_user_ids)"
3284
+ },
3271
3285
  {
3272
3286
  name: "sys_session_self",
3273
3287
  object: "sys_session",
@@ -3365,8 +3379,14 @@ var defaultPermissionSets = [
3365
3379
  operation: "select",
3366
3380
  using: "id = current_user.id"
3367
3381
  },
3368
- // ── Per-user visibility on better-auth tables that lack
3369
- // `organization_id` (matches the `member_default` carve-outs).
3382
+ // Org collaborators (read-only): see `sys_user_org_members` in
3383
+ // `member_default` for rationale.
3384
+ {
3385
+ name: "sys_user_org_members",
3386
+ object: "sys_user",
3387
+ operation: "select",
3388
+ using: "id IN (current_user.org_user_ids)"
3389
+ },
3370
3390
  {
3371
3391
  name: "sys_session_self",
3372
3392
  object: "sys_session",
@@ -3810,12 +3830,12 @@ var SysActivity = data.ObjectSchema.create({
3810
3830
  group: "Target"
3811
3831
  }),
3812
3832
  // ── Context ──────────────────────────────────────────────────
3813
- project_id: data.Field.lookup("sys_project", {
3814
- label: "Project",
3833
+ environment_id: data.Field.lookup("sys_environment", {
3834
+ label: "Environment",
3815
3835
  required: false,
3816
3836
  readonly: true,
3817
3837
  searchable: true,
3818
- description: "Project context (multi-project deployments)",
3838
+ description: "Environment context (multi-environment deployments)",
3819
3839
  group: "Context"
3820
3840
  }),
3821
3841
  metadata: data.Field.textarea({
@@ -3831,7 +3851,7 @@ var SysActivity = data.ObjectSchema.create({
3831
3851
  { fields: ["actor_id"] },
3832
3852
  { fields: ["object_name", "record_id"] },
3833
3853
  { fields: ["type"] },
3834
- { fields: ["project_id"] }
3854
+ { fields: ["environment_id"] }
3835
3855
  ],
3836
3856
  enable: {
3837
3857
  trackHistory: false,
@@ -4093,13 +4113,56 @@ var SysNotification = data.ObjectSchema.create({
4093
4113
  displayNameField: "title",
4094
4114
  titleFormat: "{title}",
4095
4115
  compactLayout: ["title", "type", "is_read", "created_at"],
4116
+ /**
4117
+ * Row-level inbox actions. Use `visible` CEL expressions to ensure
4118
+ * `mark_read` only shows on unread rows and vice-versa, mirroring the
4119
+ * mark-as-read affordances in GitHub / Linear inboxes. The toolbar-level
4120
+ * `mark_all_read` is intentionally omitted server-side: it requires a
4121
+ * bulk update primitive that doesn't yet exist on the REST surface, and
4122
+ * the popover already handles the multi-row case client-side via N
4123
+ * single-row PATCHes (see `InboxPopover.tsx` -> AppHeader `markAllRead`).
4124
+ */
4125
+ actions: [
4126
+ {
4127
+ name: "mark_read",
4128
+ label: "Mark as Read",
4129
+ icon: "check",
4130
+ variant: "secondary",
4131
+ mode: "custom",
4132
+ locations: ["list_item"],
4133
+ type: "api",
4134
+ method: "PATCH",
4135
+ target: "/api/v1/data/sys_notification/{id}",
4136
+ bodyExtra: { is_read: true },
4137
+ visible: "!record.is_read",
4138
+ successMessage: "Notification marked as read",
4139
+ refreshAfter: true
4140
+ },
4141
+ {
4142
+ name: "mark_unread",
4143
+ label: "Mark as Unread",
4144
+ icon: "bell-dot",
4145
+ variant: "secondary",
4146
+ mode: "custom",
4147
+ locations: ["list_item"],
4148
+ type: "api",
4149
+ method: "PATCH",
4150
+ target: "/api/v1/data/sys_notification/{id}",
4151
+ bodyExtra: { is_read: false, read_at: null },
4152
+ visible: "record.is_read",
4153
+ successMessage: "Notification marked as unread",
4154
+ refreshAfter: true
4155
+ }
4156
+ ],
4096
4157
  listViews: {
4097
4158
  unread: {
4098
4159
  type: "grid",
4099
4160
  name: "unread",
4100
4161
  label: "Unread",
4101
4162
  data: { provider: "object", object: "sys_notification" },
4102
- columns: ["type", "title", "recipient_id", "created_at"],
4163
+ // Title + actor first (the "who/what" the user actually scans);
4164
+ // type stays as a categorising chip; created_at right-aligned.
4165
+ columns: ["title", "actor_name", "type", "created_at"],
4103
4166
  filter: [
4104
4167
  { field: "recipient_id", operator: "equals", value: "{current_user_id}" },
4105
4168
  { field: "is_read", operator: "equals", value: false }
@@ -4113,17 +4176,21 @@ var SysNotification = data.ObjectSchema.create({
4113
4176
  name: "mine",
4114
4177
  label: "Mine",
4115
4178
  data: { provider: "object", object: "sys_notification" },
4116
- columns: ["type", "title", "is_read", "created_at"],
4179
+ columns: ["title", "actor_name", "type", "is_read", "created_at"],
4117
4180
  filter: [{ field: "recipient_id", operator: "equals", value: "{current_user_id}" }],
4118
4181
  sort: [{ field: "created_at", order: "desc" }],
4119
- pagination: { pageSize: 50 }
4182
+ pagination: { pageSize: 50 },
4183
+ // Group by notification category so mention/assignment storms don't
4184
+ // hide system or task_due rows. Users still toggle to flat via the
4185
+ // toolbar Group control if they prefer chronology only.
4186
+ grouping: { fields: [{ field: "type", order: "asc", collapsed: false }] }
4120
4187
  },
4121
4188
  all_notifications: {
4122
4189
  type: "grid",
4123
4190
  name: "all_notifications",
4124
4191
  label: "All",
4125
4192
  data: { provider: "object", object: "sys_notification" },
4126
- columns: ["type", "title", "recipient_id", "is_read", "created_at"],
4193
+ columns: ["title", "recipient_id", "actor_name", "type", "is_read", "created_at"],
4127
4194
  sort: [{ field: "created_at", order: "desc" }],
4128
4195
  pagination: { pageSize: 100 }
4129
4196
  }
@@ -4976,6 +5043,14 @@ var SysApprovalRequest = data.ObjectSchema.create({
4976
5043
  description: "Record snapshot at submission time",
4977
5044
  group: "State"
4978
5045
  }),
5046
+ process_hash: data.Field.text({
5047
+ label: "Process Hash",
5048
+ required: false,
5049
+ maxLength: 80,
5050
+ readonly: true,
5051
+ description: "sha256 of the approval process body at submit time (ADR-0009 execution pinning). Resolved through sys_metadata_history so process upgrades do not affect in-flight requests.",
5052
+ group: "State"
5053
+ }),
4979
5054
  completed_at: data.Field.datetime({
4980
5055
  label: "Completed At",
4981
5056
  required: false,
@@ -5564,12 +5639,12 @@ var SysMetadataObject = data.ObjectSchema.create({
5564
5639
  }),
5565
5640
  /**
5566
5641
  * @deprecated ADR-0005 (revised 2026-05): per-env DBs replace per-project
5567
- * isolation. `project_id` is no longer written by saveMetaItem and not
5642
+ * isolation. `environment_id` is no longer written by saveMetaItem and not
5568
5643
  * consulted by overlay reads. Kept for legacy rows; new writes leave it
5569
5644
  * NULL. Will be dropped in a future schema migration.
5570
5645
  */
5571
- project_id: data.Field.lookup("sys_project", {
5572
- label: "Project (deprecated)",
5646
+ environment_id: data.Field.lookup("sys_environment", {
5647
+ label: "Environment (deprecated)",
5573
5648
  required: false,
5574
5649
  description: "DEPRECATED. Use organization_id for tenant isolation."
5575
5650
  }),
@@ -5619,7 +5694,7 @@ var SysMetadataObject = data.ObjectSchema.create({
5619
5694
  indexes: [
5620
5695
  // ADR-0005 (revised 2026-05): overlay uniqueness is scoped by
5621
5696
  // (type, name, organization_id), restricted to active rows so resets
5622
- // / archived versions don't collide. project_id is deprecated and
5697
+ // / archived versions don't collide. environment_id is deprecated and
5623
5698
  // not part of the discriminator. The runtime layer (protocol.ts
5624
5699
  // ensureOverlayIndex) issues a DROP-then-CREATE migration to
5625
5700
  // replace any pre-existing legacy composite index in-place.
@@ -6262,6 +6337,28 @@ var SETUP_APP = {
6262
6337
  { id: "nav_notifications", type: "object", label: "Notifications", objectName: "sys_notification", icon: "bell", requiresObject: "sys_notification" }
6263
6338
  ]
6264
6339
  },
6340
+ {
6341
+ id: "group_integrations",
6342
+ type: "group",
6343
+ label: "Integrations",
6344
+ icon: "plug",
6345
+ children: [
6346
+ // Outbound HTTP integrations. `sys_webhook` always ships with
6347
+ // platform-objects, so the Webhooks entry is always visible.
6348
+ // `sys_webhook_delivery` is the durable outbox row from
6349
+ // `@objectstack/plugin-webhooks/schema` — gated on `requiresObject`
6350
+ // so the Deliveries entry only renders when the plugin has been
6351
+ // wired into `defineStack({ objects: [SysWebhookDelivery, ...] })`.
6352
+ //
6353
+ // This is the canonical demonstration of "everything is an object":
6354
+ // managing webhooks (configuration) and inspecting deliveries
6355
+ // (operational telemetry) reuses the same generic ObjectView /
6356
+ // ObjectListView UI as any business object — no bespoke webhook
6357
+ // admin page.
6358
+ { id: "nav_webhooks", type: "object", label: "Webhooks", objectName: "sys_webhook", icon: "webhook", requiresObject: "sys_webhook" },
6359
+ { id: "nav_webhook_deliveries", type: "object", label: "Webhook Deliveries", objectName: "sys_webhook_delivery", icon: "send", requiresObject: "sys_webhook_delivery" }
6360
+ ]
6361
+ },
6265
6362
  {
6266
6363
  id: "group_advanced",
6267
6364
  type: "group",
@@ -6285,7 +6382,7 @@ var SETUP_APP = {
6285
6382
  // - The marketplace-only `sys_app` / `sys_package` /
6286
6383
  // `sys_package_installation` menus have been removed entirely;
6287
6384
  // they are contributed by `@objectstack/service-tenant`
6288
- // (control-plane) and are not present in single-project runtimes.
6385
+ // (control-plane) and are not present in single-environment runtimes.
6289
6386
  { id: "nav_oauth_apps", type: "object", label: "OAuth Applications", objectName: "sys_oauth_application", icon: "app-window" },
6290
6387
  { id: "nav_jwks", type: "object", label: "Signing Keys (JWKS)", objectName: "sys_jwks", icon: "key-round" },
6291
6388
  { id: "nav_verifications", type: "object", label: "Verifications", objectName: "sys_verification", icon: "mail-check" },
@@ -6364,7 +6461,7 @@ var SystemOverviewDashboard = ui.Dashboard.create({
6364
6461
  type: "metric",
6365
6462
  object: "sys_package_installation",
6366
6463
  // Cloud-only object — only registered when service-tenant is loaded.
6367
- // Hide this widget gracefully in single-project runtimes.
6464
+ // Hide this widget gracefully in single-environment runtimes.
6368
6465
  requiresObject: "sys_package_installation",
6369
6466
  layout: {
6370
6467
  x: 9,
@@ -8216,9 +8313,9 @@ var enObjects = {
8216
8313
  label: "URL",
8217
8314
  help: "Optional deep-link to the activity target"
8218
8315
  },
8219
- project_id: {
8316
+ environment_id: {
8220
8317
  label: "Project",
8221
- help: "Project context (multi-project deployments)"
8318
+ help: "Environment context (multi-environment deployments)"
8222
8319
  },
8223
8320
  metadata: {
8224
8321
  label: "Metadata",
@@ -9211,7 +9308,7 @@ var enObjects = {
9211
9308
  label: "Organization",
9212
9309
  help: "Organization for multi-tenant isolation."
9213
9310
  },
9214
- project_id: {
9311
+ environment_id: {
9215
9312
  label: "Project (deprecated)",
9216
9313
  help: "DEPRECATED. Use organization_id for tenant isolation."
9217
9314
  },
@@ -9293,7 +9390,7 @@ var enObjects = {
9293
9390
  label: "Organization",
9294
9391
  help: "Organization for multi-tenant isolation."
9295
9392
  },
9296
- project_id: {
9393
+ environment_id: {
9297
9394
  label: "Environment ID",
9298
9395
  help: "Scopes this history entry to a specific environment."
9299
9396
  },
@@ -11251,7 +11348,7 @@ var zhCNObjects = {
11251
11348
  label: "URL",
11252
11349
  help: "\u6307\u5411\u6D3B\u52A8\u76EE\u6807\u7684\u53EF\u9009\u6DF1\u5EA6\u94FE\u63A5"
11253
11350
  },
11254
- project_id: {
11351
+ environment_id: {
11255
11352
  label: "\u9879\u76EE",
11256
11353
  help: "\u9879\u76EE\u4E0A\u4E0B\u6587\uFF08\u591A\u9879\u76EE\u90E8\u7F72\uFF09"
11257
11354
  },
@@ -12250,7 +12347,7 @@ var zhCNObjects = {
12250
12347
  label: "\u7EC4\u7EC7",
12251
12348
  help: "\u7528\u4E8E\u591A\u79DF\u6237\u9694\u79BB\u7684\u7EC4\u7EC7\u3002"
12252
12349
  },
12253
- project_id: {
12350
+ environment_id: {
12254
12351
  label: "\u9879\u76EE\uFF08\u5DF2\u5E9F\u5F03\uFF09",
12255
12352
  help: "\u5DF2\u5E9F\u5F03\u3002\u8BF7\u4F7F\u7528 organization_id \u8FDB\u884C\u79DF\u6237\u9694\u79BB\u3002"
12256
12353
  },
@@ -12332,7 +12429,7 @@ var zhCNObjects = {
12332
12429
  label: "\u7EC4\u7EC7",
12333
12430
  help: "\u7528\u4E8E\u591A\u79DF\u6237\u9694\u79BB\u7684\u7EC4\u7EC7\u3002"
12334
12431
  },
12335
- project_id: {
12432
+ environment_id: {
12336
12433
  label: "\u73AF\u5883 ID",
12337
12434
  help: "\u5C06\u8BE5\u5386\u53F2\u8BB0\u5F55\u9650\u5B9A\u5230\u7279\u5B9A\u73AF\u5883\u3002"
12338
12435
  },
@@ -14240,7 +14337,7 @@ var jaJPObjects = {
14240
14337
  label: "URL",
14241
14338
  help: "\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u30BF\u30FC\u30B2\u30C3\u30C8\u3078\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30C7\u30A3\u30FC\u30D7\u30EA\u30F3\u30AF"
14242
14339
  },
14243
- project_id: {
14340
+ environment_id: {
14244
14341
  label: "\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8",
14245
14342
  help: "\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\uFF08\u30DE\u30EB\u30C1\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30C7\u30D7\u30ED\u30A4\u30E1\u30F3\u30C8\uFF09"
14246
14343
  },
@@ -15235,7 +15332,7 @@ var jaJPObjects = {
15235
15332
  label: "\u7D44\u7E54",
15236
15333
  help: "\u30DE\u30EB\u30C1\u30C6\u30CA\u30F3\u30C8\u5206\u96E2\u306E\u305F\u3081\u306E\u7D44\u7E54\u3002"
15237
15334
  },
15238
- project_id: {
15335
+ environment_id: {
15239
15336
  label: "\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08\u975E\u63A8\u5968\uFF09",
15240
15337
  help: "\u975E\u63A8\u5968\u3002\u30C6\u30CA\u30F3\u30C8\u5206\u96E2\u306B\u306F organization_id \u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
15241
15338
  },
@@ -15317,7 +15414,7 @@ var jaJPObjects = {
15317
15414
  label: "\u7D44\u7E54",
15318
15415
  help: "\u30DE\u30EB\u30C1\u30C6\u30CA\u30F3\u30C8\u5206\u96E2\u306E\u305F\u3081\u306E\u7D44\u7E54\u3002"
15319
15416
  },
15320
- project_id: {
15417
+ environment_id: {
15321
15418
  label: "\u74B0\u5883 ID",
15322
15419
  help: "\u3053\u306E\u5C65\u6B74\u30A8\u30F3\u30C8\u30EA\u3092\u7279\u5B9A\u306E\u74B0\u5883\u306B\u30B9\u30B3\u30FC\u30D7\u3057\u307E\u3059\u3002"
15323
15420
  },
@@ -17225,7 +17322,7 @@ var esESObjects = {
17225
17322
  label: "URL",
17226
17323
  help: "Enlace profundo opcional al destino de la actividad."
17227
17324
  },
17228
- project_id: {
17325
+ environment_id: {
17229
17326
  label: "Proyecto",
17230
17327
  help: "Contexto del proyecto (implementaciones multiproyecto)."
17231
17328
  },
@@ -18220,7 +18317,7 @@ var esESObjects = {
18220
18317
  label: "Organizaci\xF3n",
18221
18318
  help: "Organizaci\xF3n para el aislamiento multi-tenant."
18222
18319
  },
18223
- project_id: {
18320
+ environment_id: {
18224
18321
  label: "Proyecto (obsoleto)",
18225
18322
  help: "OBSOLETO. Use organization_id para el aislamiento del tenant."
18226
18323
  },
@@ -18302,7 +18399,7 @@ var esESObjects = {
18302
18399
  label: "Organizaci\xF3n",
18303
18400
  help: "Organizaci\xF3n para el aislamiento multi-tenant."
18304
18401
  },
18305
- project_id: {
18402
+ environment_id: {
18306
18403
  label: "ID del entorno",
18307
18404
  help: "Limita esta entrada de historial a un entorno espec\xEDfico."
18308
18405
  },