@owlmeans/iam 0.1.18-rc.8 → 0.1.18

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 (110) hide show
  1. package/README.md +185 -15
  2. package/agent-meta/manifest.json +92 -4
  3. package/agent-meta/skills/iam/SKILL.md +91 -177
  4. package/agent-meta/skills/iam/parts/clients.md +93 -0
  5. package/agent-meta/skills/iam/parts/permissions.md +106 -0
  6. package/agent-meta/skills/iam/parts/service.md +115 -0
  7. package/agent-meta/skills/iam/parts/tenancy.md +72 -0
  8. package/build/consts.d.ts +170 -1
  9. package/build/consts.d.ts.map +1 -1
  10. package/build/consts.js +221 -0
  11. package/build/consts.js.map +1 -1
  12. package/build/consts.local.d.ts +58 -0
  13. package/build/consts.local.d.ts.map +1 -0
  14. package/build/consts.local.js +21 -0
  15. package/build/consts.local.js.map +1 -0
  16. package/build/errors.d.ts +26 -0
  17. package/build/errors.d.ts.map +1 -1
  18. package/build/errors.js +38 -0
  19. package/build/errors.js.map +1 -1
  20. package/build/facet.d.ts +10 -0
  21. package/build/facet.d.ts.map +1 -0
  22. package/build/facet.js +16 -0
  23. package/build/facet.js.map +1 -0
  24. package/build/gate/consts.local.d.ts +2 -0
  25. package/build/gate/consts.local.d.ts.map +1 -0
  26. package/build/gate/consts.local.js +3 -0
  27. package/build/gate/consts.local.js.map +1 -0
  28. package/build/gate/index.d.ts +4 -0
  29. package/build/gate/index.d.ts.map +1 -0
  30. package/build/gate/index.js +4 -0
  31. package/build/gate/index.js.map +1 -0
  32. package/build/gate/param.d.ts +6 -0
  33. package/build/gate/param.d.ts.map +1 -0
  34. package/build/gate/param.js +83 -0
  35. package/build/gate/param.js.map +1 -0
  36. package/build/gate/resolve.d.ts +10 -0
  37. package/build/gate/resolve.d.ts.map +1 -0
  38. package/build/gate/resolve.js +93 -0
  39. package/build/gate/resolve.js.map +1 -0
  40. package/build/gate/types.d.ts +109 -0
  41. package/build/gate/types.d.ts.map +1 -0
  42. package/build/gate/types.js +2 -0
  43. package/build/gate/types.js.map +1 -0
  44. package/build/gate/types.local.d.ts +5 -0
  45. package/build/gate/types.local.d.ts.map +1 -0
  46. package/build/gate/types.local.js +2 -0
  47. package/build/gate/types.local.js.map +1 -0
  48. package/build/gate/validate.d.ts +4 -0
  49. package/build/gate/validate.d.ts.map +1 -0
  50. package/build/gate/validate.js +100 -0
  51. package/build/gate/validate.js.map +1 -0
  52. package/build/index.d.ts +9 -0
  53. package/build/index.d.ts.map +1 -1
  54. package/build/index.js +5 -0
  55. package/build/index.js.map +1 -1
  56. package/build/permission/types.d.ts +35 -0
  57. package/build/permission/types.d.ts.map +1 -0
  58. package/build/permission/types.js +2 -0
  59. package/build/permission/types.js.map +1 -0
  60. package/build/permission.d.ts +8 -0
  61. package/build/permission.d.ts.map +1 -0
  62. package/build/permission.js +34 -0
  63. package/build/permission.js.map +1 -0
  64. package/build/runtime/types.d.ts +90 -0
  65. package/build/runtime/types.d.ts.map +1 -0
  66. package/build/runtime/types.js +2 -0
  67. package/build/runtime/types.js.map +1 -0
  68. package/build/runtime.d.ts +75 -0
  69. package/build/runtime.d.ts.map +1 -0
  70. package/build/runtime.js +75 -0
  71. package/build/runtime.js.map +1 -0
  72. package/build/schemas.d.ts +13 -0
  73. package/build/schemas.d.ts.map +1 -0
  74. package/build/schemas.js +108 -0
  75. package/build/schemas.js.map +1 -0
  76. package/build/types.d.ts +429 -30
  77. package/build/types.d.ts.map +1 -1
  78. package/build/utils/types.d.ts +12 -0
  79. package/build/utils/types.d.ts.map +1 -0
  80. package/build/utils/types.js +2 -0
  81. package/build/utils/types.js.map +1 -0
  82. package/build/utils.d.ts +7 -6
  83. package/build/utils.d.ts.map +1 -1
  84. package/build/utils.js +10 -1
  85. package/build/utils.js.map +1 -1
  86. package/package.json +12 -7
  87. package/src/consts.local.ts +26 -0
  88. package/src/consts.ts +241 -1
  89. package/src/errors.ts +44 -0
  90. package/src/facet.ts +17 -0
  91. package/src/gate/consts.local.ts +3 -0
  92. package/src/gate/index.ts +3 -0
  93. package/src/gate/param.ts +108 -0
  94. package/src/gate/resolve.ts +114 -0
  95. package/src/gate/types.local.ts +4 -0
  96. package/src/gate/types.ts +117 -0
  97. package/src/gate/validate.ts +123 -0
  98. package/src/index.ts +9 -0
  99. package/src/permission/types.ts +33 -0
  100. package/src/permission.ts +48 -0
  101. package/src/runtime/types.ts +107 -0
  102. package/src/runtime.ts +142 -0
  103. package/src/schemas.ts +122 -0
  104. package/src/types.ts +492 -31
  105. package/src/utils/types.ts +11 -0
  106. package/src/utils.ts +12 -7
  107. package/tests/gate-param.spec.ts +233 -0
  108. package/tests/runtime.spec.ts +101 -0
  109. package/tests/tsconfig.json +12 -0
  110. package/tests/utils.spec.ts +47 -1
package/src/schemas.ts ADDED
@@ -0,0 +1,122 @@
1
+ import { EntitySlugValueSchema, GroupValueSchema } from '@owlmeans/auth'
2
+ import type { JSONSchemaType } from 'ajv'
3
+ import { IamDefaultClass, IamGrantMode, IamGrantOrigin } from './consts.js'
4
+ import { EmailSchema, PermissionNameSchema, ProfileIdSchema, ResourcesSchema, TitleSchema } from './consts.local.js'
5
+ import type { IamRuntimeGrant, IamRuntimeGrantList, IamRuntimeGrantRequest, IamRuntimeMember, IamRuntimeMemberList, IamRuntimeMemberUpdate, IamRuntimeOrganization, IamRuntimeOrganizationList, IamRuntimePermission, IamRuntimePermissionList } from './runtime/types.js'
6
+
7
+ // ---------------------------------------------------------------------------------------------
8
+ // Wire shapes. Organizations travel by `entitySlug` only; a subject is the CALLING client's
9
+ // pairwise `profileId`. Neither an organization id nor an account id ever appears here.
10
+ // ---------------------------------------------------------------------------------------------
11
+
12
+ // ---------------------------------------------------------------------------------------------
13
+ // Schemas — closed throughout: the server's AJV strips an undeclared key silently, so a field a
14
+ // caller sends and the schema omits would vanish without an error.
15
+ // ---------------------------------------------------------------------------------------------
16
+
17
+ const GroupsSchema = { type: 'array', items: { ...GroupValueSchema }, maxItems: 64 } as const
18
+
19
+ export const IamRuntimeOrganizationSchema: JSONSchemaType<IamRuntimeOrganization> = {
20
+ type: 'object',
21
+ properties: {
22
+ entitySlug: { ...EntitySlugValueSchema },
23
+ title: { ...TitleSchema, nullable: true },
24
+ owner: { type: 'boolean' },
25
+ groups: { ...GroupsSchema, nullable: true },
26
+ home: { type: 'boolean', nullable: true },
27
+ },
28
+ required: ['entitySlug', 'owner'],
29
+ additionalProperties: false,
30
+ }
31
+
32
+ export const IamRuntimeOrganizationListSchema: JSONSchemaType<IamRuntimeOrganizationList> = {
33
+ type: 'object',
34
+ properties: { items: { type: 'array', items: IamRuntimeOrganizationSchema } },
35
+ required: ['items'],
36
+ additionalProperties: false,
37
+ }
38
+
39
+ export const IamRuntimeMemberSchema: JSONSchemaType<IamRuntimeMember> = {
40
+ type: 'object',
41
+ properties: {
42
+ profileId: { ...ProfileIdSchema },
43
+ email: { ...EmailSchema, nullable: true },
44
+ name: { ...TitleSchema, nullable: true },
45
+ owner: { type: 'boolean' },
46
+ groups: { ...GroupsSchema },
47
+ managed: { type: 'boolean', nullable: true },
48
+ },
49
+ required: ['profileId', 'owner', 'groups'],
50
+ additionalProperties: false,
51
+ }
52
+
53
+ export const IamRuntimeMemberListSchema: JSONSchemaType<IamRuntimeMemberList> = {
54
+ type: 'object',
55
+ properties: { items: { type: 'array', items: IamRuntimeMemberSchema } },
56
+ required: ['items'],
57
+ additionalProperties: false,
58
+ }
59
+
60
+ export const IamRuntimeMemberUpdateSchema: JSONSchemaType<IamRuntimeMemberUpdate> = {
61
+ type: 'object',
62
+ properties: {
63
+ owner: { type: 'boolean', nullable: true },
64
+ groups: { ...GroupsSchema, nullable: true },
65
+ },
66
+ required: [],
67
+ additionalProperties: false,
68
+ }
69
+
70
+ export const IamRuntimePermissionSchema: JSONSchemaType<IamRuntimePermission> = {
71
+ type: 'object',
72
+ properties: {
73
+ name: { ...PermissionNameSchema },
74
+ title: { ...TitleSchema, nullable: true },
75
+ area: { type: 'string', minLength: 1, maxLength: 64, nullable: true },
76
+ resourceScoped: { type: 'boolean', nullable: true },
77
+ managed: { type: 'boolean', nullable: true },
78
+ defaultClass: { type: 'string', enum: Object.values(IamDefaultClass), nullable: true },
79
+ },
80
+ required: ['name'],
81
+ additionalProperties: false,
82
+ }
83
+
84
+ export const IamRuntimePermissionListSchema: JSONSchemaType<IamRuntimePermissionList> = {
85
+ type: 'object',
86
+ properties: { items: { type: 'array', items: IamRuntimePermissionSchema } },
87
+ required: ['items'],
88
+ additionalProperties: false,
89
+ }
90
+
91
+ export const IamRuntimeGrantSchema: JSONSchemaType<IamRuntimeGrant> = {
92
+ type: 'object',
93
+ properties: {
94
+ profileId: { ...ProfileIdSchema },
95
+ permission: { ...PermissionNameSchema },
96
+ resources: { ...ResourcesSchema },
97
+ mode: { type: 'string', enum: Object.values(IamGrantMode), nullable: true },
98
+ origin: { type: 'string', enum: Object.values(IamGrantOrigin), nullable: true },
99
+ through: { ...GroupValueSchema, nullable: true },
100
+ },
101
+ required: ['profileId', 'permission'],
102
+ additionalProperties: false,
103
+ }
104
+
105
+ export const IamRuntimeGrantListSchema: JSONSchemaType<IamRuntimeGrantList> = {
106
+ type: 'object',
107
+ properties: { items: { type: 'array', items: IamRuntimeGrantSchema } },
108
+ required: ['items'],
109
+ additionalProperties: false,
110
+ }
111
+
112
+ export const IamRuntimeGrantRequestSchema: JSONSchemaType<IamRuntimeGrantRequest> = {
113
+ type: 'object',
114
+ properties: {
115
+ profileId: { ...ProfileIdSchema },
116
+ permission: { ...PermissionNameSchema },
117
+ resources: { ...ResourcesSchema },
118
+ mode: { type: 'string', enum: Object.values(IamGrantMode), nullable: true },
119
+ },
120
+ required: ['profileId', 'permission'],
121
+ additionalProperties: false,
122
+ }