@objectstack/spec 0.3.3 → 0.4.2

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 (304) hide show
  1. package/dist/ai/conversation.zod.d.ts +14 -14
  2. package/dist/ai/cost.zod.d.ts +112 -112
  3. package/dist/ai/model-registry.zod.d.ts +44 -44
  4. package/dist/ai/nlq.zod.d.ts +2 -2
  5. package/dist/ai/orchestration.zod.d.ts +6 -6
  6. package/dist/ai/predictive.zod.d.ts +8 -8
  7. package/dist/ai/rag-pipeline.zod.d.ts +62 -62
  8. package/dist/api/contract.zod.d.ts +92 -92
  9. package/dist/api/discovery.zod.d.ts +2 -2
  10. package/dist/api/index.d.ts +2 -0
  11. package/dist/api/index.d.ts.map +1 -1
  12. package/dist/api/index.js +2 -0
  13. package/dist/api/odata.zod.d.ts +482 -0
  14. package/dist/api/odata.zod.d.ts.map +1 -0
  15. package/dist/api/odata.zod.js +401 -0
  16. package/dist/api/router.zod.d.ts +4 -4
  17. package/dist/auth/config.zod.d.ts +21 -21
  18. package/dist/auth/index.d.ts +1 -0
  19. package/dist/auth/index.d.ts.map +1 -1
  20. package/dist/auth/index.js +1 -0
  21. package/dist/auth/organization.zod.d.ts +2 -2
  22. package/dist/auth/role.zod.d.ts +14 -0
  23. package/dist/auth/role.zod.d.ts.map +1 -1
  24. package/dist/auth/role.zod.js +16 -1
  25. package/dist/auth/scim.zod.d.ts +2732 -0
  26. package/dist/auth/scim.zod.d.ts.map +1 -0
  27. package/dist/auth/scim.zod.js +811 -0
  28. package/dist/automation/approval.zod.d.ts +643 -0
  29. package/dist/automation/approval.zod.d.ts.map +1 -0
  30. package/dist/automation/approval.zod.js +84 -0
  31. package/dist/automation/connector.zod.d.ts +1284 -0
  32. package/dist/automation/connector.zod.d.ts.map +1 -0
  33. package/dist/automation/connector.zod.js +500 -0
  34. package/dist/automation/etl.zod.d.ts +623 -0
  35. package/dist/automation/etl.zod.d.ts.map +1 -0
  36. package/dist/automation/etl.zod.js +359 -0
  37. package/dist/automation/flow.zod.d.ts +6 -6
  38. package/dist/automation/index.d.ts +4 -0
  39. package/dist/automation/index.d.ts.map +1 -1
  40. package/dist/automation/index.js +4 -0
  41. package/dist/automation/sync.zod.d.ts +854 -0
  42. package/dist/automation/sync.zod.d.ts.map +1 -0
  43. package/dist/automation/sync.zod.js +444 -0
  44. package/dist/automation/webhook.zod.d.ts +24 -1
  45. package/dist/automation/webhook.zod.d.ts.map +1 -1
  46. package/dist/automation/webhook.zod.js +27 -3
  47. package/dist/automation/workflow.zod.d.ts +14 -0
  48. package/dist/automation/workflow.zod.d.ts.map +1 -1
  49. package/dist/automation/workflow.zod.js +16 -1
  50. package/dist/data/field.zod.d.ts +338 -8
  51. package/dist/data/field.zod.d.ts.map +1 -1
  52. package/dist/data/field.zod.js +100 -16
  53. package/dist/data/mapping.zod.d.ts +22 -10
  54. package/dist/data/mapping.zod.d.ts.map +1 -1
  55. package/dist/data/mapping.zod.js +16 -3
  56. package/dist/data/object.zod.d.ts +116 -22
  57. package/dist/data/object.zod.d.ts.map +1 -1
  58. package/dist/data/object.zod.js +4 -4
  59. package/dist/data/validation.zod.d.ts +18 -18
  60. package/dist/hub/composer.zod.d.ts +43 -1940
  61. package/dist/hub/composer.zod.d.ts.map +1 -1
  62. package/dist/hub/composer.zod.js +1 -1
  63. package/dist/hub/license.zod.d.ts +2 -2
  64. package/dist/hub/marketplace.zod.d.ts +6 -6
  65. package/dist/index.d.ts +2 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +6 -3
  68. package/dist/permission/index.d.ts +7 -5
  69. package/dist/permission/index.d.ts.map +1 -1
  70. package/dist/permission/index.js +7 -5
  71. package/dist/permission/permission.zod.d.ts +14 -0
  72. package/dist/permission/permission.zod.d.ts.map +1 -1
  73. package/dist/permission/permission.zod.js +16 -1
  74. package/dist/permission/rls.zod.d.ts +605 -0
  75. package/dist/permission/rls.zod.d.ts.map +1 -0
  76. package/dist/permission/rls.zod.js +615 -0
  77. package/dist/permission/territory.zod.d.ts +13 -0
  78. package/dist/permission/territory.zod.d.ts.map +1 -1
  79. package/dist/permission/territory.zod.js +15 -1
  80. package/dist/shared/identifiers.zod.d.ts +87 -0
  81. package/dist/shared/identifiers.zod.d.ts.map +1 -0
  82. package/dist/shared/identifiers.zod.js +101 -0
  83. package/dist/shared/index.d.ts +6 -0
  84. package/dist/shared/index.d.ts.map +1 -0
  85. package/dist/{driver → shared}/index.js +5 -4
  86. package/dist/stack.zod.d.ts +19869 -0
  87. package/dist/stack.zod.d.ts.map +1 -0
  88. package/dist/stack.zod.js +248 -0
  89. package/dist/system/audit.zod.d.ts +12 -12
  90. package/dist/{kernel → system}/context.zod.d.ts.map +1 -1
  91. package/dist/{driver → system}/datasource.zod.d.ts +2 -2
  92. package/dist/{driver → system}/datasource.zod.d.ts.map +1 -1
  93. package/dist/{driver → system/driver}/mongo.zod.d.ts +2 -2
  94. package/dist/system/driver/mongo.zod.d.ts.map +1 -0
  95. package/dist/{driver → system/driver}/postgres.zod.d.ts +4 -4
  96. package/dist/system/driver/postgres.zod.d.ts.map +1 -0
  97. package/dist/{driver → system}/driver.zod.d.ts +14 -14
  98. package/dist/{driver → system}/driver.zod.d.ts.map +1 -1
  99. package/dist/system/events.zod.d.ts +15 -12
  100. package/dist/system/events.zod.d.ts.map +1 -1
  101. package/dist/system/events.zod.js +5 -1
  102. package/dist/system/feature.zod.d.ts +131 -0
  103. package/dist/system/feature.zod.d.ts.map +1 -0
  104. package/dist/system/feature.zod.js +45 -0
  105. package/dist/system/index.d.ts +10 -0
  106. package/dist/system/index.d.ts.map +1 -1
  107. package/dist/system/index.js +12 -0
  108. package/dist/system/job.zod.d.ts +8 -8
  109. package/dist/{kernel → system}/logger.zod.d.ts +4 -4
  110. package/dist/{kernel → system}/logger.zod.d.ts.map +1 -1
  111. package/dist/system/manifest.zod.d.ts +518 -0
  112. package/dist/system/manifest.zod.d.ts.map +1 -0
  113. package/dist/{kernel → system}/manifest.zod.js +8 -17
  114. package/dist/{kernel → system}/plugin.zod.d.ts.map +1 -1
  115. package/dist/{kernel → system}/scoped-storage.zod.d.ts +2 -2
  116. package/dist/{kernel → system}/scoped-storage.zod.d.ts.map +1 -1
  117. package/dist/ui/action.zod.d.ts +35 -10
  118. package/dist/ui/action.zod.d.ts.map +1 -1
  119. package/dist/ui/action.zod.js +30 -1
  120. package/dist/ui/app.zod.d.ts +23 -8
  121. package/dist/ui/app.zod.d.ts.map +1 -1
  122. package/dist/ui/app.zod.js +32 -4
  123. package/dist/ui/block.zod.d.ts +265 -0
  124. package/dist/ui/block.zod.d.ts.map +1 -0
  125. package/dist/ui/block.zod.js +90 -0
  126. package/dist/ui/component.zod.d.ts +265 -0
  127. package/dist/ui/component.zod.d.ts.map +1 -0
  128. package/dist/ui/component.zod.js +90 -0
  129. package/dist/ui/dashboard.zod.d.ts +15 -15
  130. package/dist/ui/dashboard.zod.d.ts.map +1 -1
  131. package/dist/ui/dashboard.zod.js +18 -8
  132. package/dist/ui/index.d.ts +1 -0
  133. package/dist/ui/index.d.ts.map +1 -1
  134. package/dist/ui/index.js +1 -0
  135. package/dist/ui/page.zod.d.ts +21 -3
  136. package/dist/ui/page.zod.d.ts.map +1 -1
  137. package/dist/ui/page.zod.js +37 -4
  138. package/dist/ui/report.zod.d.ts +7 -7
  139. package/dist/ui/view.zod.d.ts +252 -240
  140. package/dist/ui/view.zod.d.ts.map +1 -1
  141. package/dist/ui/view.zod.js +32 -3
  142. package/dist/ui/widget.zod.d.ts +673 -5
  143. package/dist/ui/widget.zod.d.ts.map +1 -1
  144. package/dist/ui/widget.zod.js +294 -1
  145. package/json-schema/api/ODataError.json +65 -0
  146. package/json-schema/api/ODataFilterFunction.json +39 -0
  147. package/json-schema/api/ODataFilterOperator.json +24 -0
  148. package/json-schema/api/ODataMetadata.json +115 -0
  149. package/json-schema/api/ODataQuery.json +89 -0
  150. package/json-schema/api/ODataResponse.json +37 -0
  151. package/json-schema/auth/Role.json +3 -2
  152. package/json-schema/auth/SCIMAddress.json +50 -0
  153. package/json-schema/auth/SCIMEmail.json +38 -0
  154. package/json-schema/auth/SCIMEnterpriseUser.json +55 -0
  155. package/json-schema/auth/SCIMError.json +52 -0
  156. package/json-schema/auth/SCIMGroup.json +102 -0
  157. package/json-schema/auth/SCIMGroupReference.json +36 -0
  158. package/json-schema/auth/SCIMListResponse.json +606 -0
  159. package/json-schema/auth/SCIMMemberReference.json +36 -0
  160. package/json-schema/auth/SCIMMeta.json +35 -0
  161. package/json-schema/auth/SCIMName.json +36 -0
  162. package/json-schema/auth/SCIMPatchOperation.json +31 -0
  163. package/json-schema/auth/SCIMPatchRequest.json +56 -0
  164. package/json-schema/auth/SCIMPhoneNumber.json +40 -0
  165. package/json-schema/auth/SCIMUser.json +462 -0
  166. package/json-schema/automation/ApprovalAction.json +35 -0
  167. package/json-schema/automation/ApprovalActionType.json +15 -0
  168. package/json-schema/automation/ApprovalProcess.json +326 -0
  169. package/json-schema/automation/ApprovalStep.json +147 -0
  170. package/json-schema/automation/ApproverType.json +16 -0
  171. package/json-schema/automation/AuthField.json +73 -0
  172. package/json-schema/automation/Authentication.json +159 -0
  173. package/json-schema/automation/AuthenticationType.json +18 -0
  174. package/json-schema/automation/ConflictResolution.json +16 -0
  175. package/json-schema/automation/Connector.json +440 -0
  176. package/json-schema/automation/ConnectorCategory.json +26 -0
  177. package/json-schema/automation/ConnectorInstance.json +69 -0
  178. package/json-schema/automation/ConnectorOperation.json +117 -0
  179. package/json-schema/automation/ConnectorTrigger.json +54 -0
  180. package/json-schema/automation/DataDestinationConfig.json +89 -0
  181. package/json-schema/automation/DataSourceConfig.json +34 -0
  182. package/json-schema/automation/DataSyncConfig.json +355 -0
  183. package/json-schema/automation/ETLDestination.json +57 -0
  184. package/json-schema/automation/ETLEndpointType.json +19 -0
  185. package/json-schema/automation/ETLPipeline.json +252 -0
  186. package/json-schema/automation/ETLPipelineRun.json +107 -0
  187. package/json-schema/automation/ETLRunStatus.json +17 -0
  188. package/json-schema/automation/ETLSource.json +60 -0
  189. package/json-schema/automation/ETLSyncMode.json +14 -0
  190. package/json-schema/automation/ETLTransformation.json +46 -0
  191. package/json-schema/automation/ETLTransformationType.json +21 -0
  192. package/json-schema/automation/FieldMapping.json +36 -0
  193. package/json-schema/automation/OAuth2Config.json +43 -0
  194. package/json-schema/automation/OperationParameter.json +59 -0
  195. package/json-schema/automation/OperationType.json +17 -0
  196. package/json-schema/automation/SyncDirection.json +14 -0
  197. package/json-schema/automation/SyncExecutionResult.json +135 -0
  198. package/json-schema/automation/SyncExecutionStatus.json +17 -0
  199. package/json-schema/automation/SyncMode.json +14 -0
  200. package/json-schema/automation/Webhook.json +3 -1
  201. package/json-schema/automation/WebhookReceiver.json +3 -1
  202. package/json-schema/automation/WorkflowRule.json +3 -2
  203. package/json-schema/data/Field.json +62 -4
  204. package/json-schema/data/FieldType.json +12 -2
  205. package/json-schema/data/Object.json +62 -4
  206. package/json-schema/data/SelectOption.json +4 -2
  207. package/json-schema/data/VectorConfig.json +51 -0
  208. package/json-schema/hub/ComposerResponse.json +4 -2163
  209. package/json-schema/permission/PermissionSet.json +3 -1
  210. package/json-schema/permission/RLSConfig.json +59 -0
  211. package/json-schema/permission/RLSEvaluationResult.json +40 -0
  212. package/json-schema/permission/RLSOperation.json +16 -0
  213. package/json-schema/permission/RLSUserContext.json +51 -0
  214. package/json-schema/permission/RowLevelSecurityPolicy.json +77 -0
  215. package/json-schema/permission/Territory.json +3 -1
  216. package/json-schema/shared/EventName.json +12 -0
  217. package/json-schema/shared/SnakeCaseIdentifier.json +12 -0
  218. package/json-schema/shared/SystemIdentifier.json +12 -0
  219. package/json-schema/system/Event.json +3 -2
  220. package/json-schema/system/FeatureFlag.json +87 -0
  221. package/json-schema/system/FeatureStrategy.json +16 -0
  222. package/json-schema/system/Manifest.json +398 -0
  223. package/json-schema/ui/Action.json +25 -4
  224. package/json-schema/ui/ActionParam.json +12 -2
  225. package/json-schema/ui/App.json +18 -7
  226. package/json-schema/ui/ChartType.json +9 -1
  227. package/json-schema/ui/Dashboard.json +9 -1
  228. package/json-schema/ui/DashboardNavItem.json +3 -1
  229. package/json-schema/ui/DashboardWidget.json +9 -1
  230. package/json-schema/ui/FieldWidgetProps.json +62 -4
  231. package/json-schema/ui/FormView.json +4 -1
  232. package/json-schema/ui/GroupNavItem.json +3 -1
  233. package/json-schema/ui/ListView.json +7 -1
  234. package/json-schema/ui/NavigationItem.json +15 -5
  235. package/json-schema/ui/ObjectNavItem.json +3 -1
  236. package/json-schema/ui/Page.json +36 -4
  237. package/json-schema/ui/PageCardProps.json +32 -0
  238. package/json-schema/ui/PageComponent.json +33 -3
  239. package/json-schema/ui/PageComponentType.json +32 -0
  240. package/json-schema/ui/PageHeaderProps.json +39 -0
  241. package/json-schema/ui/PageNavItem.json +3 -1
  242. package/json-schema/ui/PageRegion.json +33 -3
  243. package/json-schema/ui/PageTabsProps.json +55 -0
  244. package/json-schema/ui/RecordDetailsProps.json +37 -0
  245. package/json-schema/ui/RecordHighlightsProps.json +24 -0
  246. package/json-schema/ui/RecordRelatedListProps.json +39 -0
  247. package/json-schema/ui/UrlNavItem.json +3 -1
  248. package/json-schema/ui/View.json +22 -4
  249. package/json-schema/ui/WidgetEvent.json +42 -0
  250. package/json-schema/ui/WidgetLifecycle.json +40 -0
  251. package/json-schema/ui/WidgetManifest.json +262 -0
  252. package/json-schema/ui/WidgetProperty.json +58 -0
  253. package/package.json +1 -1
  254. package/prompts/architecture.md +5 -5
  255. package/prompts/create-new-project.md +85 -0
  256. package/dist/driver/index.d.ts +0 -5
  257. package/dist/driver/index.d.ts.map +0 -1
  258. package/dist/driver/mongo.zod.d.ts.map +0 -1
  259. package/dist/driver/postgres.zod.d.ts.map +0 -1
  260. package/dist/kernel/index.d.ts +0 -12
  261. package/dist/kernel/index.d.ts.map +0 -1
  262. package/dist/kernel/index.js +0 -27
  263. package/dist/kernel/manifest.zod.d.ts +0 -2153
  264. package/dist/kernel/manifest.zod.d.ts.map +0 -1
  265. package/json-schema/kernel/Manifest.json +0 -2557
  266. /package/dist/{kernel → system}/context.zod.d.ts +0 -0
  267. /package/dist/{kernel → system}/context.zod.js +0 -0
  268. /package/dist/{driver → system}/datasource.zod.js +0 -0
  269. /package/dist/{driver → system/driver}/mongo.zod.js +0 -0
  270. /package/dist/{driver → system/driver}/postgres.zod.js +0 -0
  271. /package/dist/{driver → system}/driver.zod.js +0 -0
  272. /package/dist/{kernel → system}/logger.zod.js +0 -0
  273. /package/dist/{kernel → system}/plugin.zod.d.ts +0 -0
  274. /package/dist/{kernel → system}/plugin.zod.js +0 -0
  275. /package/dist/{kernel → system}/scoped-storage.zod.js +0 -0
  276. /package/json-schema/{driver → system}/Datasource.json +0 -0
  277. /package/json-schema/{driver → system}/DatasourceCapabilities.json +0 -0
  278. /package/json-schema/{driver → system}/DriverCapabilities.json +0 -0
  279. /package/json-schema/{driver → system}/DriverDefinition.json +0 -0
  280. /package/json-schema/{driver → system}/DriverInterface.json +0 -0
  281. /package/json-schema/{driver → system}/DriverOptions.json +0 -0
  282. /package/json-schema/{driver → system}/DriverType.json +0 -0
  283. /package/json-schema/{kernel → system}/FileMetadata.json +0 -0
  284. /package/json-schema/{kernel → system}/I18nContext.json +0 -0
  285. /package/json-schema/{kernel → system}/KernelContext.json +0 -0
  286. /package/json-schema/{kernel → system}/LogEntry.json +0 -0
  287. /package/json-schema/{kernel → system}/LogFormat.json +0 -0
  288. /package/json-schema/{kernel → system}/LogLevel.json +0 -0
  289. /package/json-schema/{kernel → system}/Logger.json +0 -0
  290. /package/json-schema/{kernel → system}/LoggerConfig.json +0 -0
  291. /package/json-schema/{driver → system}/MongoConfig.json +0 -0
  292. /package/json-schema/{kernel → system}/ObjectQLClient.json +0 -0
  293. /package/json-schema/{kernel → system}/Plugin.json +0 -0
  294. /package/json-schema/{kernel → system}/PluginContext.json +0 -0
  295. /package/json-schema/{kernel → system}/PluginLifecycle.json +0 -0
  296. /package/json-schema/{driver → system}/PostgresConfig.json +0 -0
  297. /package/json-schema/{kernel → system}/Router.json +0 -0
  298. /package/json-schema/{kernel → system}/RuntimeMode.json +0 -0
  299. /package/json-schema/{kernel → system}/Scheduler.json +0 -0
  300. /package/json-schema/{kernel → system}/ScopedStorage.json +0 -0
  301. /package/json-schema/{kernel → system}/ScopedStorageConfig.json +0 -0
  302. /package/json-schema/{kernel → system}/StorageAdapterType.json +0 -0
  303. /package/json-schema/{kernel → system}/StorageScope.json +0 -0
  304. /package/json-schema/{kernel → system}/SystemAPI.json +0 -0
@@ -0,0 +1,811 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SCIM = exports.SCIMPatchRequestSchema = exports.SCIMPatchOperationSchema = exports.SCIMErrorSchema = exports.SCIMListResponseSchema = exports.SCIMGroupSchema = exports.SCIMMemberReferenceSchema = exports.SCIMUserSchema = exports.SCIMEnterpriseUserSchema = exports.SCIMGroupReferenceSchema = exports.SCIMAddressSchema = exports.SCIMPhoneNumberSchema = exports.SCIMEmailSchema = exports.SCIMNameSchema = exports.SCIMMetaSchema = exports.SCIM_SCHEMAS = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * # SCIM 2.0 Protocol Implementation
7
+ *
8
+ * System for Cross-domain Identity Management (SCIM) 2.0 specification
9
+ * implementation for ObjectStack.
10
+ *
11
+ * ## Overview
12
+ *
13
+ * SCIM 2.0 is an HTTP-based protocol for managing user and group identities
14
+ * across domains. It provides a standardized REST API for user provisioning,
15
+ * de-provisioning, and synchronization.
16
+ *
17
+ * ## Use Cases
18
+ *
19
+ * 1. **Enterprise SSO Integration**
20
+ * - Integrate with Okta, Azure AD, OneLogin
21
+ * - Automatic user provisioning from corporate directory
22
+ * - Just-in-Time (JIT) user creation on first login
23
+ *
24
+ * 2. **User Lifecycle Management**
25
+ * - Automatically create users when they join organization
26
+ * - Update user attributes when they change roles
27
+ * - Deactivate users when they leave organization
28
+ *
29
+ * 3. **Group/Department Synchronization**
30
+ * - Sync organizational structure from AD/LDAP
31
+ * - Maintain group memberships automatically
32
+ * - Map corporate roles to application permissions
33
+ *
34
+ * 4. **Compliance & Audit**
35
+ * - Maintain accurate user directory
36
+ * - Track all identity changes
37
+ * - Meet SOX/HIPAA requirements for user management
38
+ *
39
+ * ## Specification References
40
+ *
41
+ * - **RFC 7643**: SCIM Core Schema
42
+ * - **RFC 7644**: SCIM Protocol
43
+ * - **RFC 7642**: SCIM Requirements
44
+ *
45
+ * ## Industry Implementations
46
+ *
47
+ * - **Okta**: Leading SCIM provider
48
+ * - **Azure AD**: Microsoft's identity platform
49
+ * - **OneLogin**: Enterprise SSO provider
50
+ * - **Google Workspace**: Google's identity management
51
+ *
52
+ * @see https://datatracker.ietf.org/doc/html/rfc7643
53
+ * @see https://datatracker.ietf.org/doc/html/rfc7644
54
+ */
55
+ /**
56
+ * SCIM Schema URIs
57
+ * Standard schema identifiers defined in RFC 7643
58
+ */
59
+ exports.SCIM_SCHEMAS = {
60
+ USER: 'urn:ietf:params:scim:schemas:core:2.0:User',
61
+ GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group',
62
+ ENTERPRISE_USER: 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User',
63
+ RESOURCE_TYPE: 'urn:ietf:params:scim:schemas:core:2.0:ResourceType',
64
+ SERVICE_PROVIDER_CONFIG: 'urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig',
65
+ SCHEMA: 'urn:ietf:params:scim:schemas:core:2.0:Schema',
66
+ LIST_RESPONSE: 'urn:ietf:params:scim:api:messages:2.0:ListResponse',
67
+ PATCH_OP: 'urn:ietf:params:scim:api:messages:2.0:PatchOp',
68
+ BULK_REQUEST: 'urn:ietf:params:scim:api:messages:2.0:BulkRequest',
69
+ BULK_RESPONSE: 'urn:ietf:params:scim:api:messages:2.0:BulkResponse',
70
+ ERROR: 'urn:ietf:params:scim:api:messages:2.0:Error',
71
+ };
72
+ /**
73
+ * SCIM Meta Schema
74
+ * Common metadata for all SCIM resources
75
+ */
76
+ exports.SCIMMetaSchema = zod_1.z.object({
77
+ /**
78
+ * Resource type name
79
+ * @example "User", "Group"
80
+ */
81
+ resourceType: zod_1.z.string()
82
+ .optional()
83
+ .describe('Resource type'),
84
+ /**
85
+ * Resource creation timestamp (ISO 8601)
86
+ */
87
+ created: zod_1.z.string()
88
+ .datetime()
89
+ .optional()
90
+ .describe('Creation timestamp'),
91
+ /**
92
+ * Last modification timestamp (ISO 8601)
93
+ */
94
+ lastModified: zod_1.z.string()
95
+ .datetime()
96
+ .optional()
97
+ .describe('Last modification timestamp'),
98
+ /**
99
+ * Resource location URI
100
+ * Absolute URL to the resource
101
+ */
102
+ location: zod_1.z.string()
103
+ .url()
104
+ .optional()
105
+ .describe('Resource location URI'),
106
+ /**
107
+ * Entity tag for optimistic concurrency control
108
+ * Used with If-Match header for conditional updates
109
+ */
110
+ version: zod_1.z.string()
111
+ .optional()
112
+ .describe('Entity tag (ETag) for concurrency control'),
113
+ });
114
+ /**
115
+ * SCIM Name Schema
116
+ * Structured name components
117
+ */
118
+ exports.SCIMNameSchema = zod_1.z.object({
119
+ /**
120
+ * Full name formatted for display
121
+ * @example "Ms. Barbara Jane Jensen III"
122
+ */
123
+ formatted: zod_1.z.string()
124
+ .optional()
125
+ .describe('Formatted full name'),
126
+ /**
127
+ * Family name (surname)
128
+ * @example "Jensen"
129
+ */
130
+ familyName: zod_1.z.string()
131
+ .optional()
132
+ .describe('Family name (last name)'),
133
+ /**
134
+ * Given name (first name)
135
+ * @example "Barbara"
136
+ */
137
+ givenName: zod_1.z.string()
138
+ .optional()
139
+ .describe('Given name (first name)'),
140
+ /**
141
+ * Middle name
142
+ * @example "Jane"
143
+ */
144
+ middleName: zod_1.z.string()
145
+ .optional()
146
+ .describe('Middle name'),
147
+ /**
148
+ * Honorific prefix
149
+ * @example "Ms.", "Dr.", "Prof."
150
+ */
151
+ honorificPrefix: zod_1.z.string()
152
+ .optional()
153
+ .describe('Honorific prefix (Mr., Ms., Dr.)'),
154
+ /**
155
+ * Honorific suffix
156
+ * @example "III", "Jr.", "Sr."
157
+ */
158
+ honorificSuffix: zod_1.z.string()
159
+ .optional()
160
+ .describe('Honorific suffix (Jr., Sr.)'),
161
+ });
162
+ /**
163
+ * SCIM Email Schema
164
+ * Multi-valued email address
165
+ */
166
+ exports.SCIMEmailSchema = zod_1.z.object({
167
+ /**
168
+ * Email address value
169
+ */
170
+ value: zod_1.z.string()
171
+ .email()
172
+ .describe('Email address'),
173
+ /**
174
+ * Email type
175
+ * @example "work", "home", "other"
176
+ */
177
+ type: zod_1.z.enum(['work', 'home', 'other'])
178
+ .optional()
179
+ .describe('Email type'),
180
+ /**
181
+ * Display label for the email
182
+ */
183
+ display: zod_1.z.string()
184
+ .optional()
185
+ .describe('Display label'),
186
+ /**
187
+ * Whether this is the primary email
188
+ */
189
+ primary: zod_1.z.boolean()
190
+ .optional()
191
+ .default(false)
192
+ .describe('Primary email indicator'),
193
+ });
194
+ /**
195
+ * SCIM Phone Number Schema
196
+ * Multi-valued phone number
197
+ */
198
+ exports.SCIMPhoneNumberSchema = zod_1.z.object({
199
+ /**
200
+ * Phone number value
201
+ * Format is not enforced to support international numbers
202
+ */
203
+ value: zod_1.z.string()
204
+ .describe('Phone number'),
205
+ /**
206
+ * Phone type
207
+ */
208
+ type: zod_1.z.enum(['work', 'home', 'mobile', 'fax', 'pager', 'other'])
209
+ .optional()
210
+ .describe('Phone number type'),
211
+ /**
212
+ * Display label for the phone number
213
+ */
214
+ display: zod_1.z.string()
215
+ .optional()
216
+ .describe('Display label'),
217
+ /**
218
+ * Whether this is the primary phone
219
+ */
220
+ primary: zod_1.z.boolean()
221
+ .optional()
222
+ .default(false)
223
+ .describe('Primary phone indicator'),
224
+ });
225
+ /**
226
+ * SCIM Address Schema
227
+ * Multi-valued physical mailing address
228
+ */
229
+ exports.SCIMAddressSchema = zod_1.z.object({
230
+ /**
231
+ * Full mailing address formatted for display
232
+ */
233
+ formatted: zod_1.z.string()
234
+ .optional()
235
+ .describe('Formatted address'),
236
+ /**
237
+ * Full street address
238
+ */
239
+ streetAddress: zod_1.z.string()
240
+ .optional()
241
+ .describe('Street address'),
242
+ /**
243
+ * City or locality
244
+ */
245
+ locality: zod_1.z.string()
246
+ .optional()
247
+ .describe('City/Locality'),
248
+ /**
249
+ * State or region
250
+ */
251
+ region: zod_1.z.string()
252
+ .optional()
253
+ .describe('State/Region'),
254
+ /**
255
+ * Zip code or postal code
256
+ */
257
+ postalCode: zod_1.z.string()
258
+ .optional()
259
+ .describe('Postal code'),
260
+ /**
261
+ * Country
262
+ */
263
+ country: zod_1.z.string()
264
+ .optional()
265
+ .describe('Country'),
266
+ /**
267
+ * Address type
268
+ */
269
+ type: zod_1.z.enum(['work', 'home', 'other'])
270
+ .optional()
271
+ .describe('Address type'),
272
+ /**
273
+ * Whether this is the primary address
274
+ */
275
+ primary: zod_1.z.boolean()
276
+ .optional()
277
+ .default(false)
278
+ .describe('Primary address indicator'),
279
+ });
280
+ /**
281
+ * SCIM Group Reference
282
+ * Reference to a group the user belongs to
283
+ */
284
+ exports.SCIMGroupReferenceSchema = zod_1.z.object({
285
+ /**
286
+ * Group identifier
287
+ */
288
+ value: zod_1.z.string()
289
+ .describe('Group ID'),
290
+ /**
291
+ * Direct reference to the group resource
292
+ */
293
+ $ref: zod_1.z.string()
294
+ .url()
295
+ .optional()
296
+ .describe('URI reference to the group'),
297
+ /**
298
+ * Human-readable group name
299
+ */
300
+ display: zod_1.z.string()
301
+ .optional()
302
+ .describe('Group display name'),
303
+ /**
304
+ * Type of group
305
+ */
306
+ type: zod_1.z.enum(['direct', 'indirect'])
307
+ .optional()
308
+ .describe('Membership type'),
309
+ });
310
+ /**
311
+ * SCIM Enterprise User Extension
312
+ * Enterprise-specific user attributes
313
+ */
314
+ exports.SCIMEnterpriseUserSchema = zod_1.z.object({
315
+ /**
316
+ * Employee number
317
+ */
318
+ employeeNumber: zod_1.z.string()
319
+ .optional()
320
+ .describe('Employee number'),
321
+ /**
322
+ * Cost center
323
+ */
324
+ costCenter: zod_1.z.string()
325
+ .optional()
326
+ .describe('Cost center'),
327
+ /**
328
+ * Organization unit
329
+ */
330
+ organization: zod_1.z.string()
331
+ .optional()
332
+ .describe('Organization'),
333
+ /**
334
+ * Division
335
+ */
336
+ division: zod_1.z.string()
337
+ .optional()
338
+ .describe('Division'),
339
+ /**
340
+ * Department
341
+ */
342
+ department: zod_1.z.string()
343
+ .optional()
344
+ .describe('Department'),
345
+ /**
346
+ * Manager reference
347
+ */
348
+ manager: zod_1.z.object({
349
+ value: zod_1.z.string().describe('Manager ID'),
350
+ $ref: zod_1.z.string().url().optional().describe('Manager URI'),
351
+ displayName: zod_1.z.string().optional().describe('Manager name'),
352
+ })
353
+ .optional()
354
+ .describe('Manager reference'),
355
+ });
356
+ /**
357
+ * SCIM User Schema (Core)
358
+ * Complete SCIM 2.0 User resource
359
+ */
360
+ exports.SCIMUserSchema = zod_1.z.object({
361
+ /**
362
+ * SCIM schema URIs
363
+ * Must include at minimum the core User schema URI
364
+ */
365
+ schemas: zod_1.z.array(zod_1.z.string())
366
+ .min(1)
367
+ .refine((schemas) => schemas.includes(exports.SCIM_SCHEMAS.USER), 'Must include core User schema URI')
368
+ .default([exports.SCIM_SCHEMAS.USER])
369
+ .describe('SCIM schema URIs (must include User schema)'),
370
+ /**
371
+ * Unique identifier
372
+ */
373
+ id: zod_1.z.string()
374
+ .optional()
375
+ .describe('Unique resource identifier'),
376
+ /**
377
+ * External identifier
378
+ * Identifier from the provisioning client
379
+ */
380
+ externalId: zod_1.z.string()
381
+ .optional()
382
+ .describe('External identifier from client system'),
383
+ /**
384
+ * Unique username
385
+ * REQUIRED for user creation
386
+ */
387
+ userName: zod_1.z.string()
388
+ .describe('Unique username (REQUIRED)'),
389
+ /**
390
+ * Structured name
391
+ */
392
+ name: exports.SCIMNameSchema
393
+ .optional()
394
+ .describe('Structured name components'),
395
+ /**
396
+ * Display name
397
+ */
398
+ displayName: zod_1.z.string()
399
+ .optional()
400
+ .describe('Display name for UI'),
401
+ /**
402
+ * Nickname or casual name
403
+ */
404
+ nickName: zod_1.z.string()
405
+ .optional()
406
+ .describe('Nickname'),
407
+ /**
408
+ * Profile URL
409
+ */
410
+ profileUrl: zod_1.z.string()
411
+ .url()
412
+ .optional()
413
+ .describe('Profile page URL'),
414
+ /**
415
+ * Job title
416
+ */
417
+ title: zod_1.z.string()
418
+ .optional()
419
+ .describe('Job title'),
420
+ /**
421
+ * User type (employee, contractor, etc.)
422
+ */
423
+ userType: zod_1.z.string()
424
+ .optional()
425
+ .describe('User type (employee, contractor)'),
426
+ /**
427
+ * Preferred language (ISO 639-1)
428
+ */
429
+ preferredLanguage: zod_1.z.string()
430
+ .optional()
431
+ .describe('Preferred language (ISO 639-1)'),
432
+ /**
433
+ * Locale (e.g., en-US)
434
+ */
435
+ locale: zod_1.z.string()
436
+ .optional()
437
+ .describe('Locale (e.g., en-US)'),
438
+ /**
439
+ * Timezone (e.g., America/Los_Angeles)
440
+ */
441
+ timezone: zod_1.z.string()
442
+ .optional()
443
+ .describe('Timezone'),
444
+ /**
445
+ * Account active status
446
+ */
447
+ active: zod_1.z.boolean()
448
+ .optional()
449
+ .default(true)
450
+ .describe('Account active status'),
451
+ /**
452
+ * Password (write-only, never returned)
453
+ */
454
+ password: zod_1.z.string()
455
+ .optional()
456
+ .describe('Password (write-only)'),
457
+ /**
458
+ * Email addresses (multi-valued)
459
+ */
460
+ emails: zod_1.z.array(exports.SCIMEmailSchema)
461
+ .optional()
462
+ .describe('Email addresses'),
463
+ /**
464
+ * Phone numbers (multi-valued)
465
+ */
466
+ phoneNumbers: zod_1.z.array(exports.SCIMPhoneNumberSchema)
467
+ .optional()
468
+ .describe('Phone numbers'),
469
+ /**
470
+ * Instant messaging addresses
471
+ */
472
+ ims: zod_1.z.array(zod_1.z.object({
473
+ value: zod_1.z.string(),
474
+ type: zod_1.z.string().optional(),
475
+ primary: zod_1.z.boolean().optional(),
476
+ }))
477
+ .optional()
478
+ .describe('IM addresses'),
479
+ /**
480
+ * Photos (profile pictures)
481
+ */
482
+ photos: zod_1.z.array(zod_1.z.object({
483
+ value: zod_1.z.string().url(),
484
+ type: zod_1.z.enum(['photo', 'thumbnail']).optional(),
485
+ primary: zod_1.z.boolean().optional(),
486
+ }))
487
+ .optional()
488
+ .describe('Photo URLs'),
489
+ /**
490
+ * Physical addresses
491
+ */
492
+ addresses: zod_1.z.array(exports.SCIMAddressSchema)
493
+ .optional()
494
+ .describe('Physical addresses'),
495
+ /**
496
+ * Group memberships
497
+ */
498
+ groups: zod_1.z.array(exports.SCIMGroupReferenceSchema)
499
+ .optional()
500
+ .describe('Group memberships'),
501
+ /**
502
+ * User entitlements
503
+ */
504
+ entitlements: zod_1.z.array(zod_1.z.object({
505
+ value: zod_1.z.string(),
506
+ type: zod_1.z.string().optional(),
507
+ primary: zod_1.z.boolean().optional(),
508
+ }))
509
+ .optional()
510
+ .describe('Entitlements'),
511
+ /**
512
+ * User roles
513
+ */
514
+ roles: zod_1.z.array(zod_1.z.object({
515
+ value: zod_1.z.string(),
516
+ type: zod_1.z.string().optional(),
517
+ primary: zod_1.z.boolean().optional(),
518
+ }))
519
+ .optional()
520
+ .describe('Roles'),
521
+ /**
522
+ * X509 certificates
523
+ */
524
+ x509Certificates: zod_1.z.array(zod_1.z.object({
525
+ value: zod_1.z.string(),
526
+ type: zod_1.z.string().optional(),
527
+ primary: zod_1.z.boolean().optional(),
528
+ }))
529
+ .optional()
530
+ .describe('X509 certificates'),
531
+ /**
532
+ * Resource metadata
533
+ */
534
+ meta: exports.SCIMMetaSchema
535
+ .optional()
536
+ .describe('Resource metadata'),
537
+ /**
538
+ * Enterprise user extension
539
+ * Only present when enterprise extension is used
540
+ */
541
+ [exports.SCIM_SCHEMAS.ENTERPRISE_USER]: exports.SCIMEnterpriseUserSchema
542
+ .optional()
543
+ .describe('Enterprise user attributes'),
544
+ }).superRefine((data, ctx) => {
545
+ // Validate that enterprise extension schema URI is present when extension data is provided
546
+ const hasEnterpriseExtension = data[exports.SCIM_SCHEMAS.ENTERPRISE_USER] != null;
547
+ if (!hasEnterpriseExtension) {
548
+ return;
549
+ }
550
+ const schemas = data.schemas || [];
551
+ if (!schemas.includes(exports.SCIM_SCHEMAS.ENTERPRISE_USER)) {
552
+ ctx.addIssue({
553
+ code: zod_1.z.ZodIssueCode.custom,
554
+ path: ['schemas'],
555
+ message: `schemas must include "${exports.SCIM_SCHEMAS.ENTERPRISE_USER}" when enterprise user extension attributes are present`,
556
+ });
557
+ }
558
+ });
559
+ /**
560
+ * SCIM Member Reference
561
+ * Reference to a member in a group
562
+ */
563
+ exports.SCIMMemberReferenceSchema = zod_1.z.object({
564
+ /**
565
+ * Member identifier
566
+ */
567
+ value: zod_1.z.string()
568
+ .describe('Member ID'),
569
+ /**
570
+ * Direct reference to the member resource
571
+ */
572
+ $ref: zod_1.z.string()
573
+ .url()
574
+ .optional()
575
+ .describe('URI reference to the member'),
576
+ /**
577
+ * Member type (User or Group for nested groups)
578
+ */
579
+ type: zod_1.z.enum(['User', 'Group'])
580
+ .optional()
581
+ .describe('Member type'),
582
+ /**
583
+ * Human-readable member name
584
+ */
585
+ display: zod_1.z.string()
586
+ .optional()
587
+ .describe('Member display name'),
588
+ });
589
+ /**
590
+ * SCIM Group Schema
591
+ * Complete SCIM 2.0 Group resource
592
+ */
593
+ exports.SCIMGroupSchema = zod_1.z.object({
594
+ /**
595
+ * SCIM schema URIs
596
+ * Must include at minimum the core Group schema URI
597
+ */
598
+ schemas: zod_1.z.array(zod_1.z.string())
599
+ .min(1)
600
+ .refine((schemas) => schemas.includes(exports.SCIM_SCHEMAS.GROUP), 'Must include core Group schema URI')
601
+ .default([exports.SCIM_SCHEMAS.GROUP])
602
+ .describe('SCIM schema URIs (must include Group schema)'),
603
+ /**
604
+ * Unique identifier
605
+ */
606
+ id: zod_1.z.string()
607
+ .optional()
608
+ .describe('Unique resource identifier'),
609
+ /**
610
+ * External identifier
611
+ */
612
+ externalId: zod_1.z.string()
613
+ .optional()
614
+ .describe('External identifier from client system'),
615
+ /**
616
+ * Group display name
617
+ * REQUIRED for group creation
618
+ */
619
+ displayName: zod_1.z.string()
620
+ .describe('Group display name (REQUIRED)'),
621
+ /**
622
+ * Group members
623
+ */
624
+ members: zod_1.z.array(exports.SCIMMemberReferenceSchema)
625
+ .optional()
626
+ .describe('Group members'),
627
+ /**
628
+ * Resource metadata
629
+ */
630
+ meta: exports.SCIMMetaSchema
631
+ .optional()
632
+ .describe('Resource metadata'),
633
+ });
634
+ /**
635
+ * SCIM List Response
636
+ * Paginated list of resources
637
+ *
638
+ * Generic type T allows for type-safe responses when the resource type is known.
639
+ * For mixed resource types, use SCIMResource union.
640
+ */
641
+ exports.SCIMListResponseSchema = zod_1.z.object({
642
+ /**
643
+ * SCIM schema URI
644
+ */
645
+ schemas: zod_1.z.array(zod_1.z.string())
646
+ .min(1)
647
+ .refine((schemas) => schemas.includes(exports.SCIM_SCHEMAS.LIST_RESPONSE), { message: `schemas must include ${exports.SCIM_SCHEMAS.LIST_RESPONSE}` })
648
+ .default([exports.SCIM_SCHEMAS.LIST_RESPONSE])
649
+ .describe('SCIM schema URIs'),
650
+ /**
651
+ * Total number of results matching the query
652
+ */
653
+ totalResults: zod_1.z.number()
654
+ .int()
655
+ .min(0)
656
+ .describe('Total results count'),
657
+ /**
658
+ * Resources returned in this response
659
+ * Use SCIMListResponseOf<T> for type-safe responses
660
+ */
661
+ Resources: zod_1.z.array(zod_1.z.union([exports.SCIMUserSchema, exports.SCIMGroupSchema, zod_1.z.record(zod_1.z.any())]))
662
+ .describe('Resources array (Users, Groups, or custom resources)'),
663
+ /**
664
+ * 1-based index of the first result
665
+ */
666
+ startIndex: zod_1.z.number()
667
+ .int()
668
+ .min(1)
669
+ .optional()
670
+ .describe('Start index (1-based)'),
671
+ /**
672
+ * Number of resources per page
673
+ */
674
+ itemsPerPage: zod_1.z.number()
675
+ .int()
676
+ .min(0)
677
+ .optional()
678
+ .describe('Items per page'),
679
+ });
680
+ /**
681
+ * SCIM Error Response
682
+ * Error response format
683
+ */
684
+ exports.SCIMErrorSchema = zod_1.z.object({
685
+ /**
686
+ * SCIM schema URI
687
+ */
688
+ schemas: zod_1.z.array(zod_1.z.string())
689
+ .min(1)
690
+ .refine((schemas) => schemas.includes(exports.SCIM_SCHEMAS.ERROR), { message: `schemas must include ${exports.SCIM_SCHEMAS.ERROR}` })
691
+ .default([exports.SCIM_SCHEMAS.ERROR])
692
+ .describe('SCIM schema URIs'),
693
+ /**
694
+ * HTTP status code
695
+ */
696
+ status: zod_1.z.number()
697
+ .int()
698
+ .min(400)
699
+ .max(599)
700
+ .describe('HTTP status code'),
701
+ /**
702
+ * SCIM error type
703
+ */
704
+ scimType: zod_1.z.enum([
705
+ 'invalidFilter',
706
+ 'tooMany',
707
+ 'uniqueness',
708
+ 'mutability',
709
+ 'invalidSyntax',
710
+ 'invalidPath',
711
+ 'noTarget',
712
+ 'invalidValue',
713
+ 'invalidVers',
714
+ 'sensitive',
715
+ ])
716
+ .optional()
717
+ .describe('SCIM error type'),
718
+ /**
719
+ * Human-readable error description
720
+ */
721
+ detail: zod_1.z.string()
722
+ .optional()
723
+ .describe('Error detail message'),
724
+ });
725
+ /**
726
+ * SCIM Patch Operation
727
+ * For PATCH requests
728
+ */
729
+ exports.SCIMPatchOperationSchema = zod_1.z.object({
730
+ /**
731
+ * Operation type
732
+ */
733
+ op: zod_1.z.enum(['add', 'remove', 'replace'])
734
+ .describe('Operation type'),
735
+ /**
736
+ * Attribute path to modify
737
+ */
738
+ path: zod_1.z.string()
739
+ .optional()
740
+ .describe('Attribute path (optional for add)'),
741
+ /**
742
+ * Value to set
743
+ */
744
+ value: zod_1.z.any()
745
+ .optional()
746
+ .describe('Value to set'),
747
+ });
748
+ /**
749
+ * SCIM Patch Request
750
+ */
751
+ exports.SCIMPatchRequestSchema = zod_1.z.object({
752
+ /**
753
+ * SCIM schema URI
754
+ */
755
+ schemas: zod_1.z.array(zod_1.z.string())
756
+ .min(1)
757
+ .refine((schemas) => schemas.includes(exports.SCIM_SCHEMAS.PATCH_OP), { message: 'SCIM PATCH requests must include the PatchOp schema URI' })
758
+ .default([exports.SCIM_SCHEMAS.PATCH_OP])
759
+ .describe('SCIM schema URIs'),
760
+ /**
761
+ * Array of patch operations
762
+ */
763
+ Operations: zod_1.z.array(exports.SCIMPatchOperationSchema)
764
+ .min(1)
765
+ .describe('Patch operations'),
766
+ });
767
+ /**
768
+ * Helper factory for creating SCIM resources
769
+ */
770
+ exports.SCIM = {
771
+ /**
772
+ * Create a basic SCIM user
773
+ */
774
+ user: (userName, email, givenName, familyName) => ({
775
+ schemas: [exports.SCIM_SCHEMAS.USER],
776
+ userName,
777
+ emails: [{ value: email, type: 'work', primary: true }],
778
+ name: {
779
+ givenName,
780
+ familyName,
781
+ },
782
+ active: true,
783
+ }),
784
+ /**
785
+ * Create a SCIM group
786
+ */
787
+ group: (displayName, members) => ({
788
+ schemas: [exports.SCIM_SCHEMAS.GROUP],
789
+ displayName,
790
+ members: members || [],
791
+ }),
792
+ /**
793
+ * Create a list response
794
+ */
795
+ listResponse: (resources, totalResults) => ({
796
+ schemas: [exports.SCIM_SCHEMAS.LIST_RESPONSE],
797
+ totalResults: totalResults ?? resources.length,
798
+ Resources: resources,
799
+ startIndex: 1,
800
+ itemsPerPage: resources.length,
801
+ }),
802
+ /**
803
+ * Create an error response
804
+ */
805
+ error: (status, detail, scimType) => ({
806
+ schemas: [exports.SCIM_SCHEMAS.ERROR],
807
+ status,
808
+ detail,
809
+ scimType,
810
+ }),
811
+ };