@api-client/core 0.19.21 → 0.19.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/modeling/ApiModel.d.ts.map +1 -1
- package/build/src/modeling/ApiModel.js +37 -13
- package/build/src/modeling/ApiModel.js.map +1 -1
- package/build/src/modeling/ExposedEntity.d.ts +9 -0
- package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
- package/build/src/modeling/ExposedEntity.js +90 -14
- package/build/src/modeling/ExposedEntity.js.map +1 -1
- package/build/src/modeling/actions/Action.js +2 -2
- package/build/src/modeling/actions/Action.js.map +1 -1
- package/build/src/modeling/rules/AccessRule.d.ts +5 -1
- package/build/src/modeling/rules/AccessRule.d.ts.map +1 -1
- package/build/src/modeling/rules/AccessRule.js +4 -1
- package/build/src/modeling/rules/AccessRule.js.map +1 -1
- package/build/src/modeling/rules/AllowAuthenticated.d.ts +4 -1
- package/build/src/modeling/rules/AllowAuthenticated.d.ts.map +1 -1
- package/build/src/modeling/rules/AllowAuthenticated.js +2 -2
- package/build/src/modeling/rules/AllowAuthenticated.js.map +1 -1
- package/build/src/modeling/rules/AllowPublic.d.ts +4 -1
- package/build/src/modeling/rules/AllowPublic.d.ts.map +1 -1
- package/build/src/modeling/rules/AllowPublic.js +2 -2
- package/build/src/modeling/rules/AllowPublic.js.map +1 -1
- package/build/src/modeling/rules/MatchEmailDomain.d.ts +4 -1
- package/build/src/modeling/rules/MatchEmailDomain.d.ts.map +1 -1
- package/build/src/modeling/rules/MatchEmailDomain.js +2 -2
- package/build/src/modeling/rules/MatchEmailDomain.js.map +1 -1
- package/build/src/modeling/rules/MatchResourceOwner.d.ts +4 -1
- package/build/src/modeling/rules/MatchResourceOwner.d.ts.map +1 -1
- package/build/src/modeling/rules/MatchResourceOwner.js +2 -2
- package/build/src/modeling/rules/MatchResourceOwner.js.map +1 -1
- package/build/src/modeling/rules/MatchUserProperty.d.ts +4 -1
- package/build/src/modeling/rules/MatchUserProperty.d.ts.map +1 -1
- package/build/src/modeling/rules/MatchUserProperty.js +2 -2
- package/build/src/modeling/rules/MatchUserProperty.js.map +1 -1
- package/build/src/modeling/rules/MatchUserRole.d.ts +4 -1
- package/build/src/modeling/rules/MatchUserRole.d.ts.map +1 -1
- package/build/src/modeling/rules/MatchUserRole.js +2 -2
- package/build/src/modeling/rules/MatchUserRole.js.map +1 -1
- package/build/src/modeling/rules/index.d.ts +4 -1
- package/build/src/modeling/rules/index.d.ts.map +1 -1
- package/build/src/modeling/rules/index.js +7 -7
- package/build/src/modeling/rules/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/modeling/ApiModel.ts +37 -13
- package/src/modeling/ExposedEntity.ts +98 -15
- package/src/modeling/actions/Action.ts +2 -2
- package/src/modeling/rules/AccessRule.ts +8 -1
- package/src/modeling/rules/AllowAuthenticated.ts +5 -2
- package/src/modeling/rules/AllowPublic.ts +5 -2
- package/src/modeling/rules/MatchEmailDomain.ts +5 -2
- package/src/modeling/rules/MatchResourceOwner.ts +5 -2
- package/src/modeling/rules/MatchUserProperty.ts +5 -2
- package/src/modeling/rules/MatchUserRole.ts +5 -2
- package/tests/unit/modeling/actions/Action.spec.ts +13 -10
- package/tests/unit/modeling/actions/CreateAction.spec.ts +7 -6
- package/tests/unit/modeling/actions/DeleteAction.spec.ts +7 -6
- package/tests/unit/modeling/actions/ListAction.spec.ts +5 -4
- package/tests/unit/modeling/actions/ReadAction.spec.ts +9 -8
- package/tests/unit/modeling/actions/SearchAction.spec.ts +5 -4
- package/tests/unit/modeling/actions/UpdateAction.spec.ts +7 -6
- package/tests/unit/modeling/actions/helpers.ts +7 -0
- package/tests/unit/modeling/api_model.spec.ts +3 -1
- package/tests/unit/modeling/api_model_expose_entity.spec.ts +5 -17
- package/tests/unit/modeling/exposed_entity.spec.ts +150 -3
- package/tests/unit/modeling/exposed_entity_actions.spec.ts +0 -4
- package/tests/unit/modeling/rules/AccessRule.spec.ts +6 -5
- package/tests/unit/modeling/rules/AllowAuthenticated.spec.ts +4 -3
- package/tests/unit/modeling/rules/AllowPublic.spec.ts +4 -3
- package/tests/unit/modeling/rules/MatchEmailDomain.spec.ts +6 -5
- package/tests/unit/modeling/rules/MatchResourceOwner.spec.ts +7 -6
- package/tests/unit/modeling/rules/MatchUserProperty.spec.ts +6 -5
- package/tests/unit/modeling/rules/MatchUserRole.spec.ts +6 -5
- package/tests/unit/modeling/rules/restoring_rules.spec.ts +19 -21
|
@@ -17,20 +17,20 @@ export { AllowAuthenticatedAccessRule, AllowPublicAccessRule, MatchEmailDomainAc
|
|
|
17
17
|
* @param schema The schema to restore the access rule from.
|
|
18
18
|
* @returns The restored access rule.
|
|
19
19
|
*/
|
|
20
|
-
export function restoreAccessRule(schema) {
|
|
20
|
+
export function restoreAccessRule(parent, schema) {
|
|
21
21
|
switch (schema.type) {
|
|
22
22
|
case 'allowAuthenticated':
|
|
23
|
-
return new AllowAuthenticatedAccessRule(schema);
|
|
23
|
+
return new AllowAuthenticatedAccessRule(parent, schema);
|
|
24
24
|
case 'allowPublic':
|
|
25
|
-
return new AllowPublicAccessRule(schema);
|
|
25
|
+
return new AllowPublicAccessRule(parent, schema);
|
|
26
26
|
case 'matchEmailDomain':
|
|
27
|
-
return new MatchEmailDomainAccessRule(schema);
|
|
27
|
+
return new MatchEmailDomainAccessRule(parent, schema);
|
|
28
28
|
case 'matchResourceOwner':
|
|
29
|
-
return new MatchResourceOwnerAccessRule(schema);
|
|
29
|
+
return new MatchResourceOwnerAccessRule(parent, schema);
|
|
30
30
|
case 'matchUserProperty':
|
|
31
|
-
return new MatchUserPropertyAccessRule(schema);
|
|
31
|
+
return new MatchUserPropertyAccessRule(parent, schema);
|
|
32
32
|
case 'matchUserRole':
|
|
33
|
-
return new MatchUserRoleAccessRule(schema);
|
|
33
|
+
return new MatchUserRoleAccessRule(parent, schema);
|
|
34
34
|
default:
|
|
35
35
|
throw new Exception('Unknown access rule kind', {
|
|
36
36
|
code: 'E_UNKNOWN_ACCESS_RULE_KIND',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modeling/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAwC,MAAM,gCAAgC,CAAA;AAChH,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modeling/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,yBAAyB,EAAwC,MAAM,gCAAgC,CAAA;AAChH,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAKzD,OAAO,EAAE,4BAA4B,EAA2C,MAAM,yBAAyB,CAAA;AAC/G,OAAO,EAAE,qBAAqB,EAAoC,MAAM,kBAAkB,CAAA;AAC1F,OAAO,EAAE,0BAA0B,EAAyC,MAAM,uBAAuB,CAAA;AACzG,OAAO,EAAE,4BAA4B,EAA2C,MAAM,yBAAyB,CAAA;AAC/G,OAAO,EAAE,2BAA2B,EAA0C,MAAM,wBAAwB,CAAA;AAC5G,OAAO,EAAE,uBAAuB,EAAsC,MAAM,oBAAoB,CAAA;AAChG,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,uBAAuB,EACvB,aAAa,GACd,CAAA;AAkCD;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAyC,EAAE,MAAwB;IACnG,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,oBAAoB;YACvB,OAAO,IAAI,4BAA4B,CAAC,MAAM,EAAE,MAA4C,CAAC,CAAA;QAC/F,KAAK,aAAa;YAChB,OAAO,IAAI,qBAAqB,CAAC,MAAM,EAAE,MAAqC,CAAC,CAAA;QACjF,KAAK,kBAAkB;YACrB,OAAO,IAAI,0BAA0B,CAAC,MAAM,EAAE,MAA0C,CAAC,CAAA;QAC3F,KAAK,oBAAoB;YACvB,OAAO,IAAI,4BAA4B,CAAC,MAAM,EAAE,MAA4C,CAAC,CAAA;QAC/F,KAAK,mBAAmB;YACtB,OAAO,IAAI,2BAA2B,CAAC,MAAM,EAAE,MAA2C,CAAC,CAAA;QAC7F,KAAK,eAAe;YAClB,OAAO,IAAI,uBAAuB,CAAC,MAAM,EAAE,MAAuC,CAAC,CAAA;QACrF;YACE,MAAM,IAAI,SAAS,CAAC,0BAA0B,EAAE;gBAC9C,IAAI,EAAE,4BAA4B;gBAClC,MAAM,EAAE,GAAG;aACZ,CAAC,CAAA;IACN,CAAC;AACH,CAAC","sourcesContent":["export { AccessRule, type AccessRuleSchema } from './AccessRule.js'\nexport { RateLimitingConfiguration, type RateLimitingConfigurationSchema } from './RateLimitingConfiguration.js'\nimport { Exception } from '../../exceptions/exception.js'\nimport type { Action } from '../actions/Action.js'\nimport type { ApiModel } from '../ApiModel.js'\nimport type { ExposedEntity } from '../ExposedEntity.js'\nimport { AccessRuleSchema } from './AccessRule.js'\nimport { AllowAuthenticatedAccessRule, type AllowAuthenticatedAccessRuleSchema } from './AllowAuthenticated.js'\nimport { AllowPublicAccessRule, type AllowPublicAccessRuleSchema } from './AllowPublic.js'\nimport { MatchEmailDomainAccessRule, type MatchEmailDomainAccessRuleSchema } from './MatchEmailDomain.js'\nimport { MatchResourceOwnerAccessRule, type MatchResourceOwnerAccessRuleSchema } from './MatchResourceOwner.js'\nimport { MatchUserPropertyAccessRule, type MatchUserPropertyAccessRuleSchema } from './MatchUserProperty.js'\nimport { MatchUserRoleAccessRule, type MatchUserRoleAccessRuleSchema } from './MatchUserRole.js'\nimport { RateLimitRule, type RateLimitRuleSchema } from './RateLimitRule.js'\n\nexport {\n AllowAuthenticatedAccessRule,\n AllowPublicAccessRule,\n MatchEmailDomainAccessRule,\n MatchResourceOwnerAccessRule,\n MatchUserPropertyAccessRule,\n MatchUserRoleAccessRule,\n RateLimitRule,\n}\nexport type {\n AllowAuthenticatedAccessRuleSchema,\n AllowPublicAccessRuleSchema,\n MatchEmailDomainAccessRuleSchema,\n MatchResourceOwnerAccessRuleSchema,\n MatchUserPropertyAccessRuleSchema,\n MatchUserRoleAccessRuleSchema,\n RateLimitRuleSchema,\n}\n\nexport type ApiAccessRule =\n | AllowAuthenticatedAccessRule\n | AllowPublicAccessRule\n | MatchEmailDomainAccessRule\n | MatchResourceOwnerAccessRule\n | MatchUserPropertyAccessRule\n | MatchUserRoleAccessRule\nexport type ApiAccessRuleSchema =\n | AllowAuthenticatedAccessRuleSchema\n | AllowPublicAccessRuleSchema\n | MatchEmailDomainAccessRuleSchema\n | MatchResourceOwnerAccessRuleSchema\n | MatchUserPropertyAccessRuleSchema\n | MatchUserRoleAccessRuleSchema\n\nexport type RuleType =\n | 'allowAuthenticated'\n | 'allowPublic'\n | 'matchEmailDomain'\n | 'matchResourceOwner'\n | 'matchUserProperty'\n | 'matchUserRole'\n\n/**\n * Restores an access rule from a schema.\n *\n * It is a helper function to restore access rules from a schema.\n *\n * @param schema The schema to restore the access rule from.\n * @returns The restored access rule.\n */\nexport function restoreAccessRule(parent: ExposedEntity | ApiModel | Action, schema: AccessRuleSchema): ApiAccessRule {\n switch (schema.type) {\n case 'allowAuthenticated':\n return new AllowAuthenticatedAccessRule(parent, schema as AllowAuthenticatedAccessRuleSchema)\n case 'allowPublic':\n return new AllowPublicAccessRule(parent, schema as AllowPublicAccessRuleSchema)\n case 'matchEmailDomain':\n return new MatchEmailDomainAccessRule(parent, schema as MatchEmailDomainAccessRuleSchema)\n case 'matchResourceOwner':\n return new MatchResourceOwnerAccessRule(parent, schema as MatchResourceOwnerAccessRuleSchema)\n case 'matchUserProperty':\n return new MatchUserPropertyAccessRule(parent, schema as MatchUserPropertyAccessRuleSchema)\n case 'matchUserRole':\n return new MatchUserRoleAccessRule(parent, schema as MatchUserRoleAccessRuleSchema)\n default:\n throw new Exception('Unknown access rule kind', {\n code: 'E_UNKNOWN_ACCESS_RULE_KIND',\n status: 422,\n })\n }\n}\n"]}
|