@objectstack/spec 2.0.4 → 2.0.5

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 (54) hide show
  1. package/dist/contracts/index.d.mts +2 -2
  2. package/dist/contracts/index.d.ts +2 -2
  3. package/dist/data/index.d.mts +2 -2
  4. package/dist/data/index.d.ts +2 -2
  5. package/dist/data/index.js +482 -453
  6. package/dist/data/index.js.map +1 -1
  7. package/dist/data/index.mjs +481 -453
  8. package/dist/data/index.mjs.map +1 -1
  9. package/dist/{driver.zod-DddW_4lJ.d.mts → driver.zod-DnOPgUGi.d.mts} +430 -1
  10. package/dist/{driver.zod-BJHWEbwG.d.ts → driver.zod-E3C6n0W-.d.ts} +430 -1
  11. package/dist/{index-yvEIvpa3.d.ts → index-BPhGHW32.d.ts} +4 -2
  12. package/dist/{index-C8xlxqpA.d.ts → index-C6p-2KXV.d.ts} +1 -1
  13. package/dist/index-CDN6TRx9.d.mts +765 -0
  14. package/dist/index-CDN6TRx9.d.ts +765 -0
  15. package/dist/{index-wFiQRott.d.mts → index-CVnGe2b8.d.mts} +1 -1
  16. package/dist/{index-Cp6xnrOM.d.mts → index-D-tf4nDV.d.mts} +4 -2
  17. package/dist/{index-DOuMlF5h.d.ts → index-DyawwLFZ.d.ts} +31 -2
  18. package/dist/{index-DPlvQwlz.d.mts → index-E1mP_eoE.d.mts} +31 -2
  19. package/dist/index.d.mts +38 -799
  20. package/dist/index.d.ts +38 -799
  21. package/dist/index.js +8585 -8556
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +8585 -8556
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/kernel/index.d.mts +1 -1
  26. package/dist/kernel/index.d.ts +1 -1
  27. package/dist/kernel/index.js +23 -0
  28. package/dist/kernel/index.js.map +1 -1
  29. package/dist/kernel/index.mjs +22 -0
  30. package/dist/kernel/index.mjs.map +1 -1
  31. package/dist/security/index.d.mts +2 -0
  32. package/dist/security/index.d.ts +2 -0
  33. package/dist/security/index.js +666 -0
  34. package/dist/security/index.js.map +1 -0
  35. package/dist/security/index.mjs +616 -0
  36. package/dist/security/index.mjs.map +1 -0
  37. package/json-schema/data/BaseEngineOptions.json +49 -0
  38. package/json-schema/data/DataEngineAggregateOptions.json +42 -0
  39. package/json-schema/data/DataEngineAggregateRequest.json +42 -0
  40. package/json-schema/data/DataEngineBatchRequest.json +294 -0
  41. package/json-schema/data/DataEngineCountOptions.json +42 -0
  42. package/json-schema/data/DataEngineCountRequest.json +42 -0
  43. package/json-schema/data/DataEngineDeleteOptions.json +42 -0
  44. package/json-schema/data/DataEngineDeleteRequest.json +42 -0
  45. package/json-schema/data/DataEngineFindOneRequest.json +42 -0
  46. package/json-schema/data/DataEngineFindRequest.json +42 -0
  47. package/json-schema/data/DataEngineInsertOptions.json +42 -0
  48. package/json-schema/data/DataEngineInsertRequest.json +42 -0
  49. package/json-schema/data/DataEngineQueryOptions.json +42 -0
  50. package/json-schema/data/DataEngineRequest.json +588 -0
  51. package/json-schema/data/DataEngineUpdateOptions.json +42 -0
  52. package/json-schema/data/DataEngineUpdateRequest.json +42 -0
  53. package/json-schema/kernel/ExecutionContext.json +43 -0
  54. package/package.json +6 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/security/permission.zod.ts","../../src/shared/identifiers.zod.ts","../../src/security/rls.zod.ts","../../src/security/sharing.zod.ts","../../src/security/territory.zod.ts","../../src/security/policy.zod.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\nimport { RowLevelSecurityPolicySchema } from './rls.zod';\n\n/**\n * Entity (Object) Level Permissions\n * Defines CRUD + VAMA (View All / Modify All) + Lifecycle access.\n * \n * Refined with enterprise data lifecycle controls:\n * - Transfer (Ownership change)\n * - Restore (Soft delete recovery)\n * - Purge (Hard delete / Compliance)\n */\nexport const ObjectPermissionSchema = z.object({\n /** C: Create */\n allowCreate: z.boolean().default(false).describe('Create permission'),\n /** R: Read (Owned records or Shared records) */\n allowRead: z.boolean().default(false).describe('Read permission'),\n /** U: Edit (Owned records or Shared records) */\n allowEdit: z.boolean().default(false).describe('Edit permission'),\n /** D: Delete (Owned records or Shared records) */\n allowDelete: z.boolean().default(false).describe('Delete permission'),\n \n /** Lifecycle Operations */\n allowTransfer: z.boolean().default(false).describe('Change record ownership'),\n allowRestore: z.boolean().default(false).describe('Restore from trash (Undelete)'),\n allowPurge: z.boolean().default(false).describe('Permanently delete (Hard Delete/GDPR)'),\n\n /** \n * View All Records: Super-user read access. \n * Bypasses Sharing Rules and Ownership checks.\n * Equivalent to Microsoft Dataverse \"Organization\" level read access.\n */\n viewAllRecords: z.boolean().default(false).describe('View All Data (Bypass Sharing)'),\n \n /** \n * Modify All Records: Super-user write access. \n * Bypasses Sharing Rules and Ownership checks.\n * Equivalent to Microsoft Dataverse \"Organization\" level write access.\n */\n modifyAllRecords: z.boolean().default(false).describe('Modify All Data (Bypass Sharing)'),\n});\n\n/**\n * Field Level Security (FLS)\n */\nexport const FieldPermissionSchema = z.object({\n /** Can see this field */\n readable: z.boolean().default(true).describe('Field read access'),\n /** Can edit this field */\n editable: z.boolean().default(false).describe('Field edit access'),\n});\n\n/**\n * Permission Set Schema\n * Defines a collection of permissions that can be assigned to users.\n * \n * DIFFERENTIATION:\n * - Profile: The ONE primary functional definition of a user (e.g. Standard User).\n * - Permission Set: Add-on capabilities assigned to users (e.g. Export Reports).\n * - Role: (Defined in src/system/role.zod.ts) Defines data visibility hierarchy.\n * \n * **NAMING CONVENTION:**\n * Permission set names MUST be lowercase snake_case to prevent security issues.\n * \n * @example Good permission set names\n * - 'read_only'\n * - 'system_admin'\n * - 'standard_user'\n * - 'api_access'\n * \n * @example Bad permission set names (will be rejected)\n * - 'ReadOnly' (camelCase)\n * - 'SystemAdmin' (mixed case)\n * - 'Read Only' (spaces)\n */\nexport const PermissionSetSchema = z.object({\n /** Unique permission set name */\n name: SnakeCaseIdentifierSchema.describe('Permission set unique name (lowercase snake_case)'),\n \n /** Display label */\n label: z.string().optional().describe('Display label'),\n \n /** Is this a Profile? (Base set for a user) */\n isProfile: z.boolean().default(false).describe('Whether this is a user profile'),\n \n /** Object Permissions Map: <entity_name> -> permissions */\n objects: z.record(z.string(), ObjectPermissionSchema).describe('Entity permissions'),\n \n /** Field Permissions Map: <entity_name>.<field_name> -> permissions */\n fields: z.record(z.string(), FieldPermissionSchema).optional().describe('Field level security'),\n \n /** System permissions (e.g., \"manage_users\") */\n systemPermissions: z.array(z.string()).optional().describe('System level capabilities'),\n \n /** \n * Row-Level Security Rules\n * \n * Row-level security policies that filter records based on user context.\n * These rules are applied in addition to object-level permissions.\n * \n * Uses the canonical RLS protocol from rls.zod.ts for comprehensive\n * row-level security features including PostgreSQL-style USING and CHECK clauses.\n * \n * @see {@link RowLevelSecurityPolicySchema} for full RLS specification\n * @see {@link file://./rls.zod.ts} for comprehensive RLS documentation\n * \n * @example Multi-tenant isolation\n * ```typescript\n * rls: [{\n * name: 'tenant_filter',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id'\n * }]\n * ```\n */\n rowLevelSecurity: z.array(RowLevelSecurityPolicySchema).optional()\n .describe('Row-level security policies (see rls.zod.ts for full spec)'),\n \n /**\n * Context-Based Access Control Variables\n * \n * Custom context variables that can be referenced in RLS rules.\n * These variables are evaluated at runtime based on the user's session.\n * \n * Common context variables:\n * - `current_user.id` - Current user ID\n * - `current_user.tenant_id` - User's tenant/organization ID\n * - `current_user.department` - User's department\n * - `current_user.role` - User's role\n * - `current_user.region` - User's geographic region\n * \n * @example Custom context\n * ```typescript\n * contextVariables: {\n * allowed_regions: ['US', 'EU'],\n * access_level: 2,\n * custom_attribute: 'value'\n * }\n * ```\n */\n contextVariables: z.record(z.string(), z.unknown()).optional().describe('Context variables for RLS evaluation'),\n});\n\nexport type PermissionSet = z.infer<typeof PermissionSetSchema>;\nexport type ObjectPermission = z.infer<typeof ObjectPermissionSchema>;\nexport type FieldPermission = z.infer<typeof FieldPermissionSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * System Identifier Schema\n * \n * Universal naming convention for all machine identifiers (API Names) in ObjectStack.\n * Enforces lowercase with underscores or dots to ensure:\n * - Cross-platform compatibility (case-insensitive filesystems)\n * - URL-friendliness (no encoding needed)\n * - Database consistency (no collation issues)\n * - Security (no case-sensitivity bugs in permission checks)\n * \n * **Applies to all metadata that acts as a machine identifier:**\n * - Object names (tables/collections)\n * - Field names\n * - Role names\n * - Permission set names\n * - Action/trigger names\n * - Event keys\n * - App IDs\n * - Menu/page IDs\n * - Select option values\n * - Workflow names\n * - Webhook names\n * \n * **Naming Convention Summary:**\n * | Type | Pattern | Example |\n * |------|---------|---------|\n * | Machine ID | snake_case | `crm_account`, `btn_submit`, `role_admin` |\n * | Event keys | dot.notation | `user.login`, `order.created` |\n * | Labels | Any case | `Client Account`, `Submit Form` |\n * \n * @example Valid identifiers\n * - 'account'\n * - 'crm_account'\n * - 'user_profile'\n * - 'order.created' (for events)\n * - 'api_v2_endpoint'\n * \n * @example Invalid identifiers (will be rejected)\n * - 'Account' (uppercase)\n * - 'CrmAccount' (camelCase)\n * - 'crm-account' (kebab-case - use underscore instead)\n * - 'user profile' (spaces)\n */\nexport const SystemIdentifierSchema = z\n .string()\n .min(2, { message: 'System identifier must be at least 2 characters' })\n .regex(/^[a-z][a-z0-9_.]*$/, {\n message:\n 'System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., \"user_profile\" or \"order.created\")',\n })\n .describe('System identifier (lowercase with underscores or dots)');\n\n/**\n * Strict Snake Case Identifier\n * \n * More restrictive than SystemIdentifierSchema - only allows underscores (no dots).\n * Use this for identifiers that should NOT contain dots (e.g., database table/column names).\n * \n * @example Valid\n * - 'account'\n * - 'crm_account'\n * - 'user_profile'\n * \n * @example Invalid\n * - 'user.profile' (dots not allowed)\n * - 'UserProfile' (uppercase)\n */\nexport const SnakeCaseIdentifierSchema = z\n .string()\n .min(2, { message: 'Identifier must be at least 2 characters' })\n .regex(/^[a-z][a-z0-9_]*$/, {\n message:\n 'Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., \"user_profile\")',\n })\n .describe('Snake case identifier (lowercase with underscores only)');\n\n/**\n * Event Name Identifier\n * \n * Specialized identifier for event names that encourages dot notation.\n * Used in event-driven systems, message queues, and webhooks.\n * \n * Pattern: `namespace.action` or `entity.event_type`\n * \n * @example Valid\n * - 'user.created'\n * - 'order.paid'\n * - 'user.login_success'\n * - 'alarm.high_cpu'\n * \n * @example Invalid\n * - 'UserCreated' (camelCase)\n * - 'user_created' (should use dots for namespacing)\n */\nexport const EventNameSchema = z\n .string()\n .min(3, { message: 'Event name must be at least 3 characters' })\n .regex(/^[a-z][a-z0-9_.]*$/, {\n message:\n 'Event name must be lowercase with dots for namespacing (e.g., \"user.created\", \"order.paid\")',\n })\n .describe('Event name (lowercase with dot notation for namespacing)');\n\n/**\n * Type Exports\n */\nexport type SystemIdentifier = z.infer<typeof SystemIdentifierSchema>;\nexport type SnakeCaseIdentifier = z.infer<typeof SnakeCaseIdentifierSchema>;\nexport type EventName = z.infer<typeof EventNameSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * # Row-Level Security (RLS) Protocol\n * \n * Implements fine-grained record-level access control inspired by PostgreSQL RLS\n * and Salesforce Criteria-Based Sharing Rules.\n * \n * ## Overview\n * \n * Row-Level Security (RLS) allows you to control which rows users can access\n * in database tables based on their identity and role. Unlike object-level\n * permissions (CRUD), RLS provides record-level filtering.\n * \n * ## Use Cases\n * \n * 1. **Multi-Tenant Data Isolation**\n * - Users only see records from their organization\n * - `using: \"tenant_id = current_user.tenant_id\"`\n * \n * 2. **Ownership-Based Access**\n * - Users only see records they own\n * - `using: \"owner_id = current_user.id\"`\n * \n * 3. **Department-Based Access**\n * - Users only see records from their department\n * - `using: \"department = current_user.department\"`\n * \n * 4. **Regional Access Control**\n * - Sales reps only see accounts in their territory\n * - `using: \"region IN (current_user.assigned_regions)\"`\n * \n * 5. **Time-Based Access**\n * - Users can only access active records\n * - `using: \"status = 'active' AND expiry_date > NOW()\"`\n * \n * ## PostgreSQL RLS Comparison\n * \n * PostgreSQL RLS Example:\n * ```sql\n * CREATE POLICY tenant_isolation ON accounts\n * FOR SELECT\n * USING (tenant_id = current_setting('app.current_tenant_id')::uuid);\n * \n * CREATE POLICY account_insert ON accounts\n * FOR INSERT\n * WITH CHECK (tenant_id = current_setting('app.current_tenant_id')::uuid);\n * ```\n * \n * ObjectStack RLS Equivalent:\n * ```typescript\n * {\n * name: 'tenant_isolation',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id'\n * }\n * ```\n * \n * ## Salesforce Sharing Rules Comparison\n * \n * Salesforce uses \"Sharing Rules\" and \"Role Hierarchy\" for record-level access.\n * ObjectStack RLS provides similar functionality with more flexibility.\n * \n * Salesforce:\n * - Criteria-Based Sharing: Share records matching criteria with users/roles\n * - Owner-Based Sharing: Share records based on owner's role\n * - Manual Sharing: Individual record sharing\n * \n * ObjectStack RLS:\n * - More flexible formula-based conditions\n * - Direct SQL-like syntax\n * - Supports complex logic with AND/OR/NOT\n * \n * ## Best Practices\n * \n * 1. **Always Define SELECT Policy**: Control what users can view\n * 2. **Define INSERT/UPDATE CHECK Policies**: Prevent data leakage\n * 3. **Use Role-Based Policies**: Apply different rules to different roles\n * 4. **Test Thoroughly**: RLS can have complex interactions\n * 5. **Monitor Performance**: Complex RLS policies can impact query performance\n * \n * ## Security Considerations\n * \n * 1. **Defense in Depth**: RLS is one layer; use with object permissions\n * 2. **Default Deny**: If no policy matches, access is denied\n * 3. **Policy Precedence**: More permissive policy wins (OR logic)\n * 4. **Context Variables**: Ensure current_user context is always set\n * \n * @see https://www.postgresql.org/docs/current/ddl-rowsecurity.html\n * @see https://help.salesforce.com/s/articleView?id=sf.security_sharing_rules.htm\n */\n\n/**\n * RLS Operation Enum\n * Specifies which database operation this policy applies to.\n * \n * - **select**: Controls which rows can be read (SELECT queries)\n * - **insert**: Controls which rows can be inserted (INSERT statements)\n * - **update**: Controls which rows can be updated (UPDATE statements)\n * - **delete**: Controls which rows can be deleted (DELETE statements)\n * - **all**: Shorthand for all operations (equivalent to defining 4 separate policies)\n */\nexport const RLSOperation = z.enum(['select', 'insert', 'update', 'delete', 'all']);\n\nexport type RLSOperation = z.infer<typeof RLSOperation>;\n\n/**\n * Row-Level Security Policy Schema\n * \n * Defines a single RLS policy that filters records based on conditions.\n * Multiple policies can be defined for the same object, and they are\n * combined with OR logic (union of results).\n * \n * @example Multi-Tenant Isolation\n * ```typescript\n * {\n * name: 'tenant_isolation',\n * label: 'Multi-Tenant Data Isolation',\n * object: 'account',\n * operation: 'select',\n * using: 'tenant_id = current_user.tenant_id',\n * enabled: true\n * }\n * ```\n * \n * @example Owner-Based Access\n * ```typescript\n * {\n * name: 'owner_access',\n * label: 'Users Can View Their Own Records',\n * object: 'opportunity',\n * operation: 'select',\n * using: 'owner_id = current_user.id',\n * enabled: true\n * }\n * ```\n * \n * @example Manager Can View Team Records\n * ```typescript\n * {\n * name: 'manager_team_access',\n * label: 'Managers Can View Team Records',\n * object: 'task',\n * operation: 'select',\n * using: 'assigned_to_id IN (SELECT id FROM users WHERE manager_id = current_user.id)',\n * roles: ['manager', 'director'],\n * enabled: true\n * }\n * ```\n * \n * @example Prevent Cross-Tenant Data Insertion\n * ```typescript\n * {\n * name: 'tenant_insert_check',\n * label: 'Prevent Cross-Tenant Data Creation',\n * object: 'account',\n * operation: 'insert',\n * check: 'tenant_id = current_user.tenant_id',\n * enabled: true\n * }\n * ```\n * \n * @example Regional Sales Access\n * ```typescript\n * {\n * name: 'regional_sales_access',\n * label: 'Sales Reps Access Regional Accounts',\n * object: 'account',\n * operation: 'select',\n * using: 'region = current_user.region OR region IS NULL',\n * roles: ['sales_rep'],\n * enabled: true\n * }\n * ```\n * \n * @example Time-Based Access Control\n * ```typescript\n * {\n * name: 'active_records_only',\n * label: 'Users Only Access Active Records',\n * object: 'contract',\n * operation: 'select',\n * using: 'status = \"active\" AND start_date <= NOW() AND end_date >= NOW()',\n * enabled: true\n * }\n * ```\n * \n * @example Hierarchical Access (Role-Based)\n * ```typescript\n * {\n * name: 'executive_full_access',\n * label: 'Executives See All Records',\n * object: 'account',\n * operation: 'all',\n * using: '1 = 1', // Always true - see everything\n * roles: ['ceo', 'cfo', 'cto'],\n * enabled: true\n * }\n * ```\n */\nexport const RowLevelSecurityPolicySchema = z.object({\n /**\n * Unique identifier for this policy.\n * Must be unique within the object.\n * Use snake_case following ObjectStack naming conventions.\n * \n * @example \"tenant_isolation\", \"owner_access\", \"manager_team_view\"\n */\n name: z.string()\n .regex(/^[a-z_][a-z0-9_]*$/)\n .describe('Policy unique identifier (snake_case)'),\n\n /**\n * Human-readable label for the policy.\n * Used in admin UI and logs.\n * \n * @example \"Multi-Tenant Data Isolation\", \"Owner-Based Access\"\n */\n label: z.string()\n .optional()\n .describe('Human-readable policy label'),\n\n /**\n * Description explaining what this policy does and why.\n * Helps with governance and compliance.\n * \n * @example \"Ensures users can only access records from their own tenant organization\"\n */\n description: z.string()\n .optional()\n .describe('Policy description and business justification'),\n\n /**\n * Target object (table) this policy applies to.\n * Must reference a valid ObjectStack object name.\n * \n * @example \"account\", \"opportunity\", \"contact\", \"custom_object\"\n */\n object: z.string()\n .describe('Target object name'),\n\n /**\n * Database operation(s) this policy applies to.\n * \n * - **select**: Controls read access (SELECT queries)\n * - **insert**: Controls insert access (INSERT statements)\n * - **update**: Controls update access (UPDATE statements)\n * - **delete**: Controls delete access (DELETE statements)\n * - **all**: Applies to all operations\n * \n * @example \"select\" - Most common, controls what users can view\n * @example \"all\" - Apply same rule to all operations\n */\n operation: RLSOperation\n .describe('Database operation this policy applies to'),\n\n /**\n * USING clause - Filter condition for SELECT/UPDATE/DELETE.\n * \n * This is a SQL-like expression evaluated for each row.\n * Only rows where this expression returns TRUE are accessible.\n * \n * **Note**: For INSERT-only policies, USING is not required (only CHECK is needed).\n * For SELECT/UPDATE/DELETE operations, USING is required.\n * \n * **Security Note**: RLS conditions are executed at the database level with\n * parameterized queries. The implementation must use prepared statements\n * to prevent SQL injection. Never concatenate user input directly into\n * RLS conditions.\n * \n * **SQL Dialect**: Compatible with PostgreSQL SQL syntax. Implementations\n * may adapt to other databases (MySQL, SQL Server, etc.) but should maintain\n * semantic equivalence.\n * \n * Available context variables:\n * - `current_user.id` - Current user's ID\n * - `current_user.tenant_id` - Current user's tenant (maps to `tenantId` in RLSUserContext)\n * - `current_user.role` - Current user's role\n * - `current_user.department` - Current user's department\n * - `current_user.*` - Any custom user field\n * - `NOW()` - Current timestamp\n * - `CURRENT_DATE` - Current date\n * - `CURRENT_TIME` - Current time\n * \n * **Context Variable Mapping**: The RLSUserContext schema uses camelCase (e.g., `tenantId`),\n * but expressions use snake_case with `current_user.` prefix (e.g., `current_user.tenant_id`).\n * Implementations must handle this mapping.\n * \n * Supported operators:\n * - Comparison: =, !=, <, >, <=, >=, <> (not equal)\n * - Logical: AND, OR, NOT\n * - NULL checks: IS NULL, IS NOT NULL\n * - Set operations: IN, NOT IN\n * - String: LIKE, NOT LIKE, ILIKE (case-insensitive)\n * - Pattern matching: ~ (regex), !~ (not regex)\n * - Subqueries: (SELECT ...)\n * - Array operations: ANY, ALL\n * \n * **Prohibited**: Dynamic SQL, DDL statements, DML statements (INSERT/UPDATE/DELETE)\n * \n * @example \"tenant_id = current_user.tenant_id\"\n * @example \"owner_id = current_user.id OR created_by = current_user.id\"\n * @example \"department IN (SELECT department FROM user_departments WHERE user_id = current_user.id)\"\n * @example \"status = 'active' AND expiry_date > NOW()\"\n */\n using: z.string()\n .optional()\n .describe('Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.'),\n\n /**\n * CHECK clause - Validation for INSERT/UPDATE operations.\n * \n * Similar to USING but applies to new/modified rows.\n * Prevents users from creating/updating rows they wouldn't be able to see.\n * \n * **Default Behavior**: If not specified, implementations should use the\n * USING clause as the CHECK clause. This ensures data integrity by preventing\n * users from creating records they cannot view.\n * \n * Use cases:\n * - Prevent cross-tenant data creation\n * - Enforce mandatory field values\n * - Validate data integrity rules\n * - Restrict certain operations (e.g., only allow creating \"draft\" status)\n * \n * @example \"tenant_id = current_user.tenant_id\"\n * @example \"status IN ('draft', 'pending')\" - Only allow certain statuses\n * @example \"created_by = current_user.id\" - Must be the creator\n */\n check: z.string()\n .optional()\n .describe('Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)'),\n\n /**\n * Restrict this policy to specific roles.\n * If specified, only users with these roles will have this policy applied.\n * If omitted, policy applies to all users (except those with bypassRLS permission).\n * \n * Role names must match defined roles in the system.\n * \n * @example [\"sales_rep\", \"account_manager\"]\n * @example [\"employee\"] - Apply to all employees\n * @example [\"guest\"] - Special restrictions for guests\n */\n roles: z.array(z.string())\n .optional()\n .describe('Roles this policy applies to (omit for all roles)'),\n\n /**\n * Whether this policy is currently active.\n * Disabled policies are not evaluated.\n * Useful for temporary policy changes without deletion.\n * \n * @default true\n */\n enabled: z.boolean()\n .default(true)\n .describe('Whether this policy is active'),\n\n /**\n * Policy priority for conflict resolution.\n * Higher numbers = higher priority.\n * When multiple policies apply, the most permissive wins (OR logic).\n * Priority is only used for ordering evaluation (performance).\n * \n * @default 0\n */\n priority: z.number()\n .int()\n .default(0)\n .describe('Policy evaluation priority (higher = evaluated first)'),\n\n /**\n * Tags for policy categorization and reporting.\n * Useful for governance, compliance, and auditing.\n * \n * @example [\"compliance\", \"gdpr\", \"pci\"]\n * @example [\"multi-tenant\", \"security\"]\n */\n tags: z.array(z.string())\n .optional()\n .describe('Policy categorization tags'),\n}).superRefine((data, ctx) => {\n // Ensure at least one of USING or CHECK is provided\n if (!data.using && !data.check) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'At least one of \"using\" or \"check\" must be specified. For SELECT/UPDATE/DELETE operations, provide \"using\". For INSERT operations, provide \"check\".',\n });\n }\n \n // For non-insert operations, USING should typically be present\n // This is a soft warning through documentation, not enforced here\n // since 'all' and mixed operation types are valid\n});\n\n/**\n * RLS Configuration Schema\n * \n * Global configuration for the Row-Level Security system.\n * Defines how RLS is enforced across the entire platform.\n */\nexport const RLSConfigSchema = z.object({\n /**\n * Global RLS enable/disable flag.\n * When false, all RLS policies are ignored (use with caution!).\n * \n * @default true\n */\n enabled: z.boolean()\n .default(true)\n .describe('Enable RLS enforcement globally'),\n\n /**\n * Default behavior when no policies match.\n * \n * - **deny**: Deny access (secure default)\n * - **allow**: Allow access (permissive mode, not recommended)\n * \n * @default \"deny\"\n */\n defaultPolicy: z.enum(['deny', 'allow'])\n .default('deny')\n .describe('Default action when no policies match'),\n\n /**\n * Whether to allow superusers to bypass RLS.\n * Superusers include system administrators and service accounts.\n * \n * @default true\n */\n allowSuperuserBypass: z.boolean()\n .default(true)\n .describe('Allow superusers to bypass RLS'),\n\n /**\n * List of roles that can bypass RLS.\n * Users with these roles see all records regardless of policies.\n * \n * @example [\"system_admin\", \"data_auditor\"]\n */\n bypassRoles: z.array(z.string())\n .optional()\n .describe('Roles that bypass RLS (see all data)'),\n\n /**\n * Whether to log RLS policy evaluations.\n * Useful for debugging and auditing.\n * Can impact performance if enabled globally.\n * \n * @default false\n */\n logEvaluations: z.boolean()\n .default(false)\n .describe('Log RLS policy evaluations for debugging'),\n\n /**\n * Cache RLS policy evaluation results.\n * Can improve performance for frequently accessed records.\n * Cache is invalidated when policies change or user context changes.\n * \n * @default true\n */\n cacheResults: z.boolean()\n .default(true)\n .describe('Cache RLS evaluation results'),\n\n /**\n * Cache TTL in seconds.\n * How long to cache RLS evaluation results.\n * \n * @default 300 (5 minutes)\n */\n cacheTtlSeconds: z.number()\n .int()\n .positive()\n .default(300)\n .describe('Cache TTL in seconds'),\n\n /**\n * Performance optimization: Pre-fetch user context.\n * Load user context once per request instead of per-query.\n * \n * @default true\n */\n prefetchUserContext: z.boolean()\n .default(true)\n .describe('Pre-fetch user context for performance'),\n});\n\n/**\n * User Context Schema\n * \n * Represents the current user's context for RLS evaluation.\n * This data is used to evaluate USING and CHECK clauses.\n */\nexport const RLSUserContextSchema = z.object({\n /**\n * User ID\n */\n id: z.string()\n .describe('User ID'),\n\n /**\n * User email\n */\n email: z.string()\n .email()\n .optional()\n .describe('User email'),\n\n /**\n * Tenant/Organization ID\n */\n tenantId: z.string()\n .optional()\n .describe('Tenant/Organization ID'),\n\n /**\n * User role(s)\n */\n role: z.union([\n z.string(),\n z.array(z.string()),\n ])\n .optional()\n .describe('User role(s)'),\n\n /**\n * User department\n */\n department: z.string()\n .optional()\n .describe('User department'),\n\n /**\n * Additional custom attributes\n * Can include any custom user fields for RLS evaluation\n */\n attributes: z.record(z.string(), z.unknown())\n .optional()\n .describe('Additional custom user attributes'),\n});\n\n/**\n * RLS Policy Evaluation Result\n * \n * Result of evaluating an RLS policy for a specific record.\n * Used for debugging and audit logging.\n */\nexport const RLSEvaluationResultSchema = z.object({\n /**\n * Policy name that was evaluated\n */\n policyName: z.string()\n .describe('Policy name'),\n\n /**\n * Whether access was granted\n */\n granted: z.boolean()\n .describe('Whether access was granted'),\n\n /**\n * Evaluation duration in milliseconds\n */\n durationMs: z.number()\n .optional()\n .describe('Evaluation duration in milliseconds'),\n\n /**\n * Error message if evaluation failed\n */\n error: z.string()\n .optional()\n .describe('Error message if evaluation failed'),\n\n /**\n * Evaluated USING clause result\n */\n usingResult: z.boolean()\n .optional()\n .describe('USING clause evaluation result'),\n\n /**\n * Evaluated CHECK clause result (for INSERT/UPDATE)\n */\n checkResult: z.boolean()\n .optional()\n .describe('CHECK clause evaluation result'),\n});\n\n/**\n * Type exports\n */\nexport type RowLevelSecurityPolicy = z.infer<typeof RowLevelSecurityPolicySchema>;\nexport type RLSConfig = z.infer<typeof RLSConfigSchema>;\nexport type RLSUserContext = z.infer<typeof RLSUserContextSchema>;\nexport type RLSEvaluationResult = z.infer<typeof RLSEvaluationResultSchema>;\n\n/**\n * Helper factory for creating RLS policies\n */\nexport const RLS = {\n /**\n * Create a simple owner-based policy\n */\n ownerPolicy: (object: string, ownerField: string = 'owner_id'): RowLevelSecurityPolicy => ({\n name: `${object}_owner_access`,\n label: `Owner Access for ${object}`,\n object,\n operation: 'all',\n using: `${ownerField} = current_user.id`,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a tenant isolation policy\n */\n tenantPolicy: (object: string, tenantField: string = 'tenant_id'): RowLevelSecurityPolicy => ({\n name: `${object}_tenant_isolation`,\n label: `Tenant Isolation for ${object}`,\n object,\n operation: 'all',\n using: `${tenantField} = current_user.tenant_id`,\n check: `${tenantField} = current_user.tenant_id`,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a role-based policy\n */\n rolePolicy: (object: string, roles: string[], condition: string): RowLevelSecurityPolicy => ({\n name: `${object}_${roles.join('_')}_access`,\n label: `${roles.join(', ')} Access for ${object}`,\n object,\n operation: 'select',\n using: condition,\n roles,\n enabled: true,\n priority: 0,\n }),\n\n /**\n * Create a permissive policy (allow all for specific roles)\n */\n allowAllPolicy: (object: string, roles: string[]): RowLevelSecurityPolicy => ({\n name: `${object}_${roles.join('_')}_full_access`,\n label: `Full Access for ${roles.join(', ')}`,\n object,\n operation: 'all',\n using: '1 = 1', // Always true\n roles,\n enabled: true,\n priority: 0,\n }),\n} as const;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Organization-Wide Defaults (OWD)\n * The baseline security posture for an object.\n */\nexport const OWDModel = z.enum([\n 'private', // Only owner can see\n 'public_read', // Everyone can see, owner can edit\n 'public_read_write', // Everyone can see and edit\n 'controlled_by_parent' // Access derived from parent record (Master-Detail)\n]);\n\n/**\n * Sharing Rule Type\n * How is the data shared?\n */\nexport const SharingRuleType = z.enum([\n 'owner', // Based on record ownership (Role Hierarchy)\n 'criteria', // Based on field values (e.g. Status = 'Open')\n]);\n\n/**\n * Sharing Level\n * What access is granted?\n */\nexport const SharingLevel = z.enum([\n 'read', // Read Only\n 'edit', // Read / Write\n 'full' // Full Access (Transfer, Share, Delete)\n]);\n\n/**\n * Recipient Type \n * Who receives the access?\n */\nexport const ShareRecipientType = z.enum([\n 'user',\n 'group',\n 'role',\n 'role_and_subordinates',\n 'guest' // for public sharing\n]);\n\n/**\n * Base Sharing Rule\n * Common metadata for all sharing strategies.\n */\nconst BaseSharingRuleSchema = z.object({\n // Identification\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Unique rule name (snake_case)'),\n label: z.string().optional().describe('Human-readable label'),\n description: z.string().optional().describe('Administrative notes'),\n \n // Scope\n object: z.string().describe('Target Object Name'),\n active: z.boolean().default(true),\n \n // Access\n accessLevel: SharingLevel.default('read'),\n \n // Recipient (Whom to share with)\n sharedWith: z.object({\n type: ShareRecipientType,\n value: z.string().describe('ID or Code of the User/Group/Role'),\n }).describe('The recipient of the shared access'),\n});\n\n/**\n * 1. Criteria-Based Sharing Rule\n * Share records that meet specific field criteria.\n */\nexport const CriteriaSharingRuleSchema = BaseSharingRuleSchema.extend({\n type: z.literal('criteria'),\n condition: z.string().describe('Formula condition (e.g. \"department = \\'Sales\\'\")'),\n});\n\n/**\n * 2. Owner-Based Sharing Rule\n * Share records owned by a specific group of users.\n */\nexport const OwnerSharingRuleSchema = BaseSharingRuleSchema.extend({\n type: z.literal('owner'),\n ownedBy: z.object({\n type: ShareRecipientType,\n value: z.string(),\n }).describe('Source group/role whose records are being shared'),\n});\n\n/**\n * Master Sharing Rule Schema\n */\nexport const SharingRuleSchema = z.discriminatedUnion('type', [\n CriteriaSharingRuleSchema,\n OwnerSharingRuleSchema\n]);\n\nexport type SharingRule = z.infer<typeof SharingRuleSchema>;\nexport type CriteriaSharingRule = z.infer<typeof CriteriaSharingRuleSchema>;\nexport type OwnerSharingRule = z.infer<typeof OwnerSharingRuleSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\nimport { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod';\n\n/**\n * Territory Management Protocol\n * Defines a matrix reporting structure that exists parallel to the Role Hierarchy.\n * \n * USE CASE:\n * - Enterprise Sales Teams (Geo-based: \"EMEA\", \"APAC\")\n * - Industry Verticals (Industry-based: \"Healthcare\", \"Financial\")\n * - Strategic Accounts (Account-based: \"Strategic Accounts\")\n * \n * DIFFERENCE FROM ROLE:\n * - Role: Hierarchy of PEOPLE (Who reports to whom). Stable. HR-driven.\n * - Territory: Hierarchy of ACCOUNTS/REVENUE (Who owns which market). Flexible. Sales-driven.\n * - One User can be assigned to MANY Territories (Matrix).\n * - One User has only ONE Role (Tree).\n */\n\nexport const TerritoryType = z.enum([\n 'geography', // Region/Country/City\n 'industry', // Vertical\n 'named_account', // Key Accounts\n 'product_line' // Product Specialty\n]);\n\n/**\n * Territory Model Schema\n * A container for a version of territory planning.\n * (e.g. \"Fiscal Year 2024 Planning\" vs \"Fiscal Year 2025 Planning\")\n */\nexport const TerritoryModelSchema = z.object({\n name: z.string().describe('Model Name (e.g. FY24 Planning)'),\n state: z.enum(['planning', 'active', 'archived']).default('planning'),\n startDate: z.string().optional(),\n endDate: z.string().optional(),\n});\n\n/**\n * Territory Node Schema\n * A single node in the territory tree.\n * \n * **NAMING CONVENTION:**\n * Territory names are machine identifiers and must be lowercase snake_case.\n * \n * @example Good territory names\n * - 'west_coast'\n * - 'emea_region'\n * - 'healthcare_vertical'\n * - 'strategic_accounts'\n * \n * @example Bad territory names (will be rejected)\n * - 'WestCoast' (PascalCase)\n * - 'West Coast' (spaces)\n */\nexport const TerritorySchema = z.object({\n /** Identity */\n name: SnakeCaseIdentifierSchema.describe('Territory unique name (lowercase snake_case)'),\n label: z.string().describe('Territory Label (e.g. \"West Coast\")'),\n \n /** Structure */\n modelId: z.string().describe('Belongs to which Territory Model'),\n parent: z.string().optional().describe('Parent Territory'),\n type: TerritoryType.default('geography'),\n \n /** \n * Assignment Rules (The \"Magic\")\n * How do accounts automatically fall into this territory?\n * e.g. \"BillingCountry = 'US' AND BillingState = 'CA'\"\n */\n assignmentRule: z.string().optional().describe('Criteria based assignment rule'),\n \n /**\n * User Assignment\n * Users assigned to work this territory.\n */\n assignedUsers: z.array(z.string()).optional(),\n \n /** Access Level */\n accountAccess: z.enum(['read', 'edit']).default('read'),\n opportunityAccess: z.enum(['read', 'edit']).default('read'),\n caseAccess: z.enum(['read', 'edit']).default('read'),\n});\n\nexport type Territory = z.infer<typeof TerritorySchema>;\nexport type TerritoryModel = z.infer<typeof TerritoryModelSchema>;\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { z } from 'zod';\n\n/**\n * Password Complexity Policy\n */\nexport const PasswordPolicySchema = z.object({\n minLength: z.number().default(8),\n requireUppercase: z.boolean().default(true),\n requireLowercase: z.boolean().default(true),\n requireNumbers: z.boolean().default(true),\n requireSymbols: z.boolean().default(false),\n expirationDays: z.number().optional().describe('Force password change every X days'),\n historyCount: z.number().default(3).describe('Prevent reusing last X passwords'),\n});\n\n/**\n * Network Access Policy (IP Whitelisting)\n */\nexport const NetworkPolicySchema = z.object({\n trustedRanges: z.array(z.string()).describe('CIDR ranges allowed to access (e.g. 10.0.0.0/8)'),\n blockUnknown: z.boolean().default(false).describe('Block all IPs not in trusted ranges'),\n vpnRequired: z.boolean().default(false),\n});\n\n/**\n * Session Policy\n */\nexport const SessionPolicySchema = z.object({\n idleTimeout: z.number().default(30).describe('Minutes before idle session logout'),\n absoluteTimeout: z.number().default(480).describe('Max session duration (minutes)'),\n forceMfa: z.boolean().default(false).describe('Require 2FA for all users'),\n});\n\n/**\n * Audit Retention Policy\n */\nexport const AuditPolicySchema = z.object({\n logRetentionDays: z.number().default(180),\n sensitiveFields: z.array(z.string()).describe('Fields to redact in logs (e.g. password, ssn)'),\n captureRead: z.boolean().default(false).describe('Log read access (High volume!)'),\n});\n\n/**\n * Security Policy Schema\n * \"The Cloud Compliance Contract\"\n */\nexport const PolicySchema = z.object({\n name: z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('Policy Name'),\n \n password: PasswordPolicySchema.optional(),\n network: NetworkPolicySchema.optional(),\n session: SessionPolicySchema.optional(),\n audit: AuditPolicySchema.optional(),\n\n /** Assignment */\n isDefault: z.boolean().default(false).describe('Apply to all users by default'),\n assignedProfiles: z.array(z.string()).optional().describe('Apply to specific profiles'),\n});\n\nexport type Policy = z.infer<typeof PolicySchema>;\n"],"mappings":";AAEA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AA6CX,IAAM,yBAAyB,EACnC,OAAO,EACP,IAAI,GAAG,EAAE,SAAS,kDAAkD,CAAC,EACrE,MAAM,sBAAsB;AAAA,EAC3B,SACE;AACJ,CAAC,EACA,SAAS,wDAAwD;AAiB7D,IAAM,4BAA4B,EACtC,OAAO,EACP,IAAI,GAAG,EAAE,SAAS,2CAA2C,CAAC,EAC9D,MAAM,qBAAqB;AAAA,EAC1B,SACE;AACJ,CAAC,EACA,SAAS,yDAAyD;AAoB9D,IAAM,kBAAkB,EAC5B,OAAO,EACP,IAAI,GAAG,EAAE,SAAS,2CAA2C,CAAC,EAC9D,MAAM,sBAAsB;AAAA,EAC3B,SACE;AACJ,CAAC,EACA,SAAS,0DAA0D;;;ACvGtE,SAAS,KAAAC,UAAS;AAuGX,IAAM,eAAeA,GAAE,KAAK,CAAC,UAAU,UAAU,UAAU,UAAU,KAAK,CAAC;AAkG3E,IAAM,+BAA+BA,GAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnD,MAAMA,GAAE,OAAO,EACZ,MAAM,oBAAoB,EAC1B,SAAS,uCAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnD,OAAOA,GAAE,OAAO,EACb,SAAS,EACT,SAA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
3
+ "type": "object",
4
+ "properties": {
5
+ "context": {
6
+ "type": "object",
7
+ "properties": {
8
+ "userId": {
9
+ "type": "string"
10
+ },
11
+ "tenantId": {
12
+ "type": "string"
13
+ },
14
+ "roles": {
15
+ "default": [],
16
+ "type": "array",
17
+ "items": {
18
+ "type": "string"
19
+ }
20
+ },
21
+ "permissions": {
22
+ "default": [],
23
+ "type": "array",
24
+ "items": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "isSystem": {
29
+ "default": false,
30
+ "type": "boolean"
31
+ },
32
+ "accessToken": {
33
+ "type": "string"
34
+ },
35
+ "transaction": {},
36
+ "traceId": {
37
+ "type": "string"
38
+ }
39
+ },
40
+ "required": [
41
+ "roles",
42
+ "permissions",
43
+ "isSystem"
44
+ ],
45
+ "additionalProperties": false
46
+ }
47
+ },
48
+ "additionalProperties": false
49
+ }
@@ -2,6 +2,48 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "type": "object",
4
4
  "properties": {
5
+ "context": {
6
+ "type": "object",
7
+ "properties": {
8
+ "userId": {
9
+ "type": "string"
10
+ },
11
+ "tenantId": {
12
+ "type": "string"
13
+ },
14
+ "roles": {
15
+ "default": [],
16
+ "type": "array",
17
+ "items": {
18
+ "type": "string"
19
+ }
20
+ },
21
+ "permissions": {
22
+ "default": [],
23
+ "type": "array",
24
+ "items": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "isSystem": {
29
+ "default": false,
30
+ "type": "boolean"
31
+ },
32
+ "accessToken": {
33
+ "type": "string"
34
+ },
35
+ "transaction": {},
36
+ "traceId": {
37
+ "type": "string"
38
+ }
39
+ },
40
+ "required": [
41
+ "roles",
42
+ "permissions",
43
+ "isSystem"
44
+ ],
45
+ "additionalProperties": false
46
+ },
5
47
  "filter": {
6
48
  "anyOf": [
7
49
  {
@@ -12,6 +12,48 @@
12
12
  "query": {
13
13
  "type": "object",
14
14
  "properties": {
15
+ "context": {
16
+ "type": "object",
17
+ "properties": {
18
+ "userId": {
19
+ "type": "string"
20
+ },
21
+ "tenantId": {
22
+ "type": "string"
23
+ },
24
+ "roles": {
25
+ "default": [],
26
+ "type": "array",
27
+ "items": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "permissions": {
32
+ "default": [],
33
+ "type": "array",
34
+ "items": {
35
+ "type": "string"
36
+ }
37
+ },
38
+ "isSystem": {
39
+ "default": false,
40
+ "type": "boolean"
41
+ },
42
+ "accessToken": {
43
+ "type": "string"
44
+ },
45
+ "transaction": {},
46
+ "traceId": {
47
+ "type": "string"
48
+ }
49
+ },
50
+ "required": [
51
+ "roles",
52
+ "permissions",
53
+ "isSystem"
54
+ ],
55
+ "additionalProperties": false
56
+ },
15
57
  "filter": {
16
58
  "anyOf": [
17
59
  {
@@ -23,6 +23,48 @@
23
23
  "query": {
24
24
  "type": "object",
25
25
  "properties": {
26
+ "context": {
27
+ "type": "object",
28
+ "properties": {
29
+ "userId": {
30
+ "type": "string"
31
+ },
32
+ "tenantId": {
33
+ "type": "string"
34
+ },
35
+ "roles": {
36
+ "default": [],
37
+ "type": "array",
38
+ "items": {
39
+ "type": "string"
40
+ }
41
+ },
42
+ "permissions": {
43
+ "default": [],
44
+ "type": "array",
45
+ "items": {
46
+ "type": "string"
47
+ }
48
+ },
49
+ "isSystem": {
50
+ "default": false,
51
+ "type": "boolean"
52
+ },
53
+ "accessToken": {
54
+ "type": "string"
55
+ },
56
+ "transaction": {},
57
+ "traceId": {
58
+ "type": "string"
59
+ }
60
+ },
61
+ "required": [
62
+ "roles",
63
+ "permissions",
64
+ "isSystem"
65
+ ],
66
+ "additionalProperties": false
67
+ },
26
68
  "filter": {
27
69
  "anyOf": [
28
70
  {
@@ -149,6 +191,48 @@
149
191
  "query": {
150
192
  "type": "object",
151
193
  "properties": {
194
+ "context": {
195
+ "type": "object",
196
+ "properties": {
197
+ "userId": {
198
+ "type": "string"
199
+ },
200
+ "tenantId": {
201
+ "type": "string"
202
+ },
203
+ "roles": {
204
+ "default": [],
205
+ "type": "array",
206
+ "items": {
207
+ "type": "string"
208
+ }
209
+ },
210
+ "permissions": {
211
+ "default": [],
212
+ "type": "array",
213
+ "items": {
214
+ "type": "string"
215
+ }
216
+ },
217
+ "isSystem": {
218
+ "default": false,
219
+ "type": "boolean"
220
+ },
221
+ "accessToken": {
222
+ "type": "string"
223
+ },
224
+ "transaction": {},
225
+ "traceId": {
226
+ "type": "string"
227
+ }
228
+ },
229
+ "required": [
230
+ "roles",
231
+ "permissions",
232
+ "isSystem"
233
+ ],
234
+ "additionalProperties": false
235
+ },
152
236
  "filter": {
153
237
  "anyOf": [
154
238
  {
@@ -296,6 +380,48 @@
296
380
  "options": {
297
381
  "type": "object",
298
382
  "properties": {
383
+ "context": {
384
+ "type": "object",
385
+ "properties": {
386
+ "userId": {
387
+ "type": "string"
388
+ },
389
+ "tenantId": {
390
+ "type": "string"
391
+ },
392
+ "roles": {
393
+ "default": [],
394
+ "type": "array",
395
+ "items": {
396
+ "type": "string"
397
+ }
398
+ },
399
+ "permissions": {
400
+ "default": [],
401
+ "type": "array",
402
+ "items": {
403
+ "type": "string"
404
+ }
405
+ },
406
+ "isSystem": {
407
+ "default": false,
408
+ "type": "boolean"
409
+ },
410
+ "accessToken": {
411
+ "type": "string"
412
+ },
413
+ "transaction": {},
414
+ "traceId": {
415
+ "type": "string"
416
+ }
417
+ },
418
+ "required": [
419
+ "roles",
420
+ "permissions",
421
+ "isSystem"
422
+ ],
423
+ "additionalProperties": false
424
+ },
299
425
  "returning": {
300
426
  "default": true,
301
427
  "type": "boolean"
@@ -343,6 +469,48 @@
343
469
  "options": {
344
470
  "type": "object",
345
471
  "properties": {
472
+ "context": {
473
+ "type": "object",
474
+ "properties": {
475
+ "userId": {
476
+ "type": "string"
477
+ },
478
+ "tenantId": {
479
+ "type": "string"
480
+ },
481
+ "roles": {
482
+ "default": [],
483
+ "type": "array",
484
+ "items": {
485
+ "type": "string"
486
+ }
487
+ },
488
+ "permissions": {
489
+ "default": [],
490
+ "type": "array",
491
+ "items": {
492
+ "type": "string"
493
+ }
494
+ },
495
+ "isSystem": {
496
+ "default": false,
497
+ "type": "boolean"
498
+ },
499
+ "accessToken": {
500
+ "type": "string"
501
+ },
502
+ "transaction": {},
503
+ "traceId": {
504
+ "type": "string"
505
+ }
506
+ },
507
+ "required": [
508
+ "roles",
509
+ "permissions",
510
+ "isSystem"
511
+ ],
512
+ "additionalProperties": false
513
+ },
346
514
  "filter": {
347
515
  "anyOf": [
348
516
  {
@@ -406,6 +574,48 @@
406
574
  "options": {
407
575
  "type": "object",
408
576
  "properties": {
577
+ "context": {
578
+ "type": "object",
579
+ "properties": {
580
+ "userId": {
581
+ "type": "string"
582
+ },
583
+ "tenantId": {
584
+ "type": "string"
585
+ },
586
+ "roles": {
587
+ "default": [],
588
+ "type": "array",
589
+ "items": {
590
+ "type": "string"
591
+ }
592
+ },
593
+ "permissions": {
594
+ "default": [],
595
+ "type": "array",
596
+ "items": {
597
+ "type": "string"
598
+ }
599
+ },
600
+ "isSystem": {
601
+ "default": false,
602
+ "type": "boolean"
603
+ },
604
+ "accessToken": {
605
+ "type": "string"
606
+ },
607
+ "transaction": {},
608
+ "traceId": {
609
+ "type": "string"
610
+ }
611
+ },
612
+ "required": [
613
+ "roles",
614
+ "permissions",
615
+ "isSystem"
616
+ ],
617
+ "additionalProperties": false
618
+ },
409
619
  "filter": {
410
620
  "anyOf": [
411
621
  {
@@ -449,6 +659,48 @@
449
659
  "query": {
450
660
  "type": "object",
451
661
  "properties": {
662
+ "context": {
663
+ "type": "object",
664
+ "properties": {
665
+ "userId": {
666
+ "type": "string"
667
+ },
668
+ "tenantId": {
669
+ "type": "string"
670
+ },
671
+ "roles": {
672
+ "default": [],
673
+ "type": "array",
674
+ "items": {
675
+ "type": "string"
676
+ }
677
+ },
678
+ "permissions": {
679
+ "default": [],
680
+ "type": "array",
681
+ "items": {
682
+ "type": "string"
683
+ }
684
+ },
685
+ "isSystem": {
686
+ "default": false,
687
+ "type": "boolean"
688
+ },
689
+ "accessToken": {
690
+ "type": "string"
691
+ },
692
+ "transaction": {},
693
+ "traceId": {
694
+ "type": "string"
695
+ }
696
+ },
697
+ "required": [
698
+ "roles",
699
+ "permissions",
700
+ "isSystem"
701
+ ],
702
+ "additionalProperties": false
703
+ },
452
704
  "filter": {
453
705
  "anyOf": [
454
706
  {
@@ -488,6 +740,48 @@
488
740
  "query": {
489
741
  "type": "object",
490
742
  "properties": {
743
+ "context": {
744
+ "type": "object",
745
+ "properties": {
746
+ "userId": {
747
+ "type": "string"
748
+ },
749
+ "tenantId": {
750
+ "type": "string"
751
+ },
752
+ "roles": {
753
+ "default": [],
754
+ "type": "array",
755
+ "items": {
756
+ "type": "string"
757
+ }
758
+ },
759
+ "permissions": {
760
+ "default": [],
761
+ "type": "array",
762
+ "items": {
763
+ "type": "string"
764
+ }
765
+ },
766
+ "isSystem": {
767
+ "default": false,
768
+ "type": "boolean"
769
+ },
770
+ "accessToken": {
771
+ "type": "string"
772
+ },
773
+ "transaction": {},
774
+ "traceId": {
775
+ "type": "string"
776
+ }
777
+ },
778
+ "required": [
779
+ "roles",
780
+ "permissions",
781
+ "isSystem"
782
+ ],
783
+ "additionalProperties": false
784
+ },
491
785
  "filter": {
492
786
  "anyOf": [
493
787
  {
@@ -2,6 +2,48 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "type": "object",
4
4
  "properties": {
5
+ "context": {
6
+ "type": "object",
7
+ "properties": {
8
+ "userId": {
9
+ "type": "string"
10
+ },
11
+ "tenantId": {
12
+ "type": "string"
13
+ },
14
+ "roles": {
15
+ "default": [],
16
+ "type": "array",
17
+ "items": {
18
+ "type": "string"
19
+ }
20
+ },
21
+ "permissions": {
22
+ "default": [],
23
+ "type": "array",
24
+ "items": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "isSystem": {
29
+ "default": false,
30
+ "type": "boolean"
31
+ },
32
+ "accessToken": {
33
+ "type": "string"
34
+ },
35
+ "transaction": {},
36
+ "traceId": {
37
+ "type": "string"
38
+ }
39
+ },
40
+ "required": [
41
+ "roles",
42
+ "permissions",
43
+ "isSystem"
44
+ ],
45
+ "additionalProperties": false
46
+ },
5
47
  "filter": {
6
48
  "anyOf": [
7
49
  {