@sitecore/sc-contenthub-webclient-sdk 0.9.7
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/LICENSE +24 -0
- package/dist/api/api-info-resource.d.ts +8 -0
- package/dist/api/api-info-resource.js +42 -0
- package/dist/api/api-info.d.ts +29 -0
- package/dist/api/api-info.js +14 -0
- package/dist/api/api-resource.d.ts +4 -0
- package/dist/api/api-resource.js +16 -0
- package/dist/api/api-routes-dictionary.d.ts +8 -0
- package/dist/api/api-routes-dictionary.js +10 -0
- package/dist/authentication/oauth-grant-base.d.ts +6 -0
- package/dist/authentication/oauth-grant-base.js +42 -0
- package/dist/authentication/oauth-grant-type.d.ts +4 -0
- package/dist/authentication/oauth-grant-type.js +8 -0
- package/dist/authentication/oauth-password-grant.d.ts +8 -0
- package/dist/authentication/oauth-password-grant.js +45 -0
- package/dist/authentication/oauth-refreshtoken-grant.d.ts +7 -0
- package/dist/authentication/oauth-refreshtoken-grant.js +39 -0
- package/dist/authentication/token-info.d.ts +6 -0
- package/dist/authentication/token-info.js +35 -0
- package/dist/base-types.d.ts +56 -0
- package/dist/base-types.js +32 -0
- package/dist/caches/culture-cache.d.ts +8 -0
- package/dist/caches/culture-cache.js +21 -0
- package/dist/caches/entity-definition-cache.d.ts +44 -0
- package/dist/caches/entity-definition-cache.js +96 -0
- package/dist/clients/api-client.d.ts +56 -0
- package/dist/clients/api-client.js +107 -0
- package/dist/clients/commands-client.d.ts +16 -0
- package/dist/clients/commands-client.js +40 -0
- package/dist/clients/content-hub-client.d.ts +75 -0
- package/dist/clients/content-hub-client.js +66 -0
- package/dist/clients/culture-client.d.ts +36 -0
- package/dist/clients/culture-client.js +43 -0
- package/dist/clients/culture-loader.d.ts +41 -0
- package/dist/clients/culture-loader.js +103 -0
- package/dist/clients/entities-client.d.ts +201 -0
- package/dist/clients/entities-client.js +271 -0
- package/dist/clients/entity-definitions-client.d.ts +87 -0
- package/dist/clients/entity-definitions-client.js +354 -0
- package/dist/clients/extended-client.d.ts +11 -0
- package/dist/clients/extended-client.js +2 -0
- package/dist/clients/internal-client.d.ts +46 -0
- package/dist/clients/internal-client.js +240 -0
- package/dist/clients/notifications-client.d.ts +35 -0
- package/dist/clients/notifications-client.js +128 -0
- package/dist/clients/option-list-client.d.ts +49 -0
- package/dist/clients/option-list-client.js +85 -0
- package/dist/clients/pages-client.d.ts +36 -0
- package/dist/clients/pages-client.js +52 -0
- package/dist/clients/policies-client.d.ts +47 -0
- package/dist/clients/policies-client.js +92 -0
- package/dist/clients/querying-client.d.ts +34 -0
- package/dist/clients/querying-client.js +95 -0
- package/dist/clients/raw-client.d.ts +29 -0
- package/dist/clients/raw-client.js +79 -0
- package/dist/clients/request-message.d.ts +25 -0
- package/dist/clients/request-message.js +12 -0
- package/dist/clients/response-handler.d.ts +30 -0
- package/dist/clients/response-handler.js +145 -0
- package/dist/clients/response-message.d.ts +45 -0
- package/dist/clients/response-message.js +34 -0
- package/dist/clients/schema-querying.d.ts +16 -0
- package/dist/clients/schema-querying.js +70 -0
- package/dist/clients/search-client.d.ts +16 -0
- package/dist/clients/search-client.js +36 -0
- package/dist/clients/settings-client.d.ts +37 -0
- package/dist/clients/settings-client.js +126 -0
- package/dist/clients/users-client.d.ts +150 -0
- package/dist/clients/users-client.js +317 -0
- package/dist/clients/web-content-hub-client.d.ts +13 -0
- package/dist/clients/web-content-hub-client.js +2 -0
- package/dist/constants/api.d.ts +130 -0
- package/dist/constants/api.js +133 -0
- package/dist/constants/defaults.d.ts +7 -0
- package/dist/constants/defaults.js +10 -0
- package/dist/constants/definitions.d.ts +62 -0
- package/dist/constants/definitions.js +88 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/index.js +30 -0
- package/dist/constants/notifications.d.ts +7 -0
- package/dist/constants/notifications.js +10 -0
- package/dist/contracts/base/culture-insensitive-property.d.ts +28 -0
- package/dist/contracts/base/culture-insensitive-property.js +47 -0
- package/dist/contracts/base/culture-sensitive-property.d.ts +49 -0
- package/dist/contracts/base/culture-sensitive-property.js +113 -0
- package/dist/contracts/base/data-type.d.ts +18 -0
- package/dist/contracts/base/data-type.js +24 -0
- package/dist/contracts/base/entity-base.d.ts +65 -0
- package/dist/contracts/base/entity-base.js +362 -0
- package/dist/contracts/base/entity-construction-args.d.ts +15 -0
- package/dist/contracts/base/entity-construction-args.js +16 -0
- package/dist/contracts/base/entity-definition.d.ts +108 -0
- package/dist/contracts/base/entity-definition.js +126 -0
- package/dist/contracts/base/entity.d.ts +237 -0
- package/dist/contracts/base/entity.js +76 -0
- package/dist/contracts/base/index.d.ts +14 -0
- package/dist/contracts/base/index.js +26 -0
- package/dist/contracts/base/json-content-type.d.ts +9 -0
- package/dist/contracts/base/json-content-type.js +13 -0
- package/dist/contracts/base/lazy-loading-manager.d.ts +4 -0
- package/dist/contracts/base/lazy-loading-manager.js +17 -0
- package/dist/contracts/base/member-condition.d.ts +48 -0
- package/dist/contracts/base/member-condition.js +125 -0
- package/dist/contracts/base/member-definition-type.d.ts +13 -0
- package/dist/contracts/base/member-definition-type.js +17 -0
- package/dist/contracts/base/member-definition.d.ts +77 -0
- package/dist/contracts/base/member-definition.js +101 -0
- package/dist/contracts/base/member-group.d.ts +54 -0
- package/dist/contracts/base/member-group.js +61 -0
- package/dist/contracts/base/member.d.ts +32 -0
- package/dist/contracts/base/member.js +26 -0
- package/dist/contracts/base/option-lists/flat-option-list-value.d.ts +4 -0
- package/dist/contracts/base/option-lists/flat-option-list-value.js +9 -0
- package/dist/contracts/base/option-lists/flat-option-list.d.ts +9 -0
- package/dist/contracts/base/option-lists/flat-option-list.js +11 -0
- package/dist/contracts/base/option-lists/hierarchical-option-list.d.ts +9 -0
- package/dist/contracts/base/option-lists/hierarchical-option-list.js +11 -0
- package/dist/contracts/base/option-lists/hierarchical-options-list-value.d.ts +7 -0
- package/dist/contracts/base/option-lists/hierarchical-options-list-value.js +14 -0
- package/dist/contracts/base/option-lists/option-list-base.d.ts +23 -0
- package/dist/contracts/base/option-lists/option-list-base.js +33 -0
- package/dist/contracts/base/option-lists/option-list-type.d.ts +13 -0
- package/dist/contracts/base/option-lists/option-list-type.js +17 -0
- package/dist/contracts/base/option-lists/option-list-value-base.d.ts +7 -0
- package/dist/contracts/base/option-lists/option-list-value-base.js +14 -0
- package/dist/contracts/base/option-lists/option-list-value.d.ts +30 -0
- package/dist/contracts/base/option-lists/option-list-value.js +2 -0
- package/dist/contracts/base/option-lists/option-list.d.ts +40 -0
- package/dist/contracts/base/option-lists/option-list.js +2 -0
- package/dist/contracts/base/property-definition.d.ts +61 -0
- package/dist/contracts/base/property-definition.js +76 -0
- package/dist/contracts/base/property-definitions/boolean-property-definition.d.ts +7 -0
- package/dist/contracts/base/property-definitions/boolean-property-definition.js +33 -0
- package/dist/contracts/base/property-definitions/datetime-property-definition.d.ts +7 -0
- package/dist/contracts/base/property-definitions/datetime-property-definition.js +33 -0
- package/dist/contracts/base/property-definitions/datetimeoffset-property-definition.d.ts +7 -0
- package/dist/contracts/base/property-definitions/datetimeoffset-property-definition.js +33 -0
- package/dist/contracts/base/property-definitions/decimal-property-definition.d.ts +7 -0
- package/dist/contracts/base/property-definitions/decimal-property-definition.js +33 -0
- package/dist/contracts/base/property-definitions/index.d.ts +8 -0
- package/dist/contracts/base/property-definitions/index.js +20 -0
- package/dist/contracts/base/property-definitions/integer-property-definition.d.ts +7 -0
- package/dist/contracts/base/property-definitions/integer-property-definition.js +33 -0
- package/dist/contracts/base/property-definitions/json-property-definition.d.ts +10 -0
- package/dist/contracts/base/property-definitions/json-property-definition.js +38 -0
- package/dist/contracts/base/property-definitions/long-property-definition.d.ts +7 -0
- package/dist/contracts/base/property-definitions/long-property-definition.js +33 -0
- package/dist/contracts/base/property-definitions/string-property-definition.d.ts +33 -0
- package/dist/contracts/base/property-definitions/string-property-definition.js +55 -0
- package/dist/contracts/base/property-manager.d.ts +19 -0
- package/dist/contracts/base/property-manager.js +114 -0
- package/dist/contracts/base/property.d.ts +21 -0
- package/dist/contracts/base/property.js +30 -0
- package/dist/contracts/base/relation-cardinality.d.ts +19 -0
- package/dist/contracts/base/relation-cardinality.js +22 -0
- package/dist/contracts/base/relation-container.d.ts +40 -0
- package/dist/contracts/base/relation-container.js +118 -0
- package/dist/contracts/base/relation-definition.d.ts +123 -0
- package/dist/contracts/base/relation-definition.js +116 -0
- package/dist/contracts/base/relation-manager.d.ts +70 -0
- package/dist/contracts/base/relation-manager.js +197 -0
- package/dist/contracts/base/relation-role.d.ts +14 -0
- package/dist/contracts/base/relation-role.js +17 -0
- package/dist/contracts/base/relation.d.ts +74 -0
- package/dist/contracts/base/relation.js +40 -0
- package/dist/contracts/base/relations/child-to-many-parents-relation.d.ts +27 -0
- package/dist/contracts/base/relations/child-to-many-parents-relation.js +67 -0
- package/dist/contracts/base/relations/child-to-one-parent-relation.d.ts +26 -0
- package/dist/contracts/base/relations/child-to-one-parent-relation.js +74 -0
- package/dist/contracts/base/relations/parent-to-many-children-relation.d.ts +27 -0
- package/dist/contracts/base/relations/parent-to-many-children-relation.js +67 -0
- package/dist/contracts/base/relations/parent-to-one-child-relation.d.ts +29 -0
- package/dist/contracts/base/relations/parent-to-one-child-relation.js +74 -0
- package/dist/contracts/base/relations/to-many-relation.d.ts +16 -0
- package/dist/contracts/base/relations/to-many-relation.js +2 -0
- package/dist/contracts/base/relations/to-one-relation.d.ts +18 -0
- package/dist/contracts/base/relations/to-one-relation.js +2 -0
- package/dist/contracts/base/rendition.d.ts +14 -0
- package/dist/contracts/base/rendition.js +13 -0
- package/dist/contracts/base/resource.d.ts +21 -0
- package/dist/contracts/base/resource.js +2 -0
- package/dist/contracts/base/string-content-type.d.ts +21 -0
- package/dist/contracts/base/string-content-type.js +25 -0
- package/dist/contracts/base/typed-entity.d.ts +11 -0
- package/dist/contracts/base/typed-entity.js +2 -0
- package/dist/contracts/base/users.d.ts +0 -0
- package/dist/contracts/base/users.js +1 -0
- package/dist/contracts/base/view-mode.d.ts +4 -0
- package/dist/contracts/base/view-mode.js +8 -0
- package/dist/contracts/content/asset.d.ts +22 -0
- package/dist/contracts/content/asset.js +67 -0
- package/dist/contracts/content/final-life-cycle-status.d.ts +7 -0
- package/dist/contracts/content/final-life-cycle-status.js +11 -0
- package/dist/contracts/dirty-tracking/dirty-tracking.d.ts +10 -0
- package/dist/contracts/dirty-tracking/dirty-tracking.js +2 -0
- package/dist/contracts/notifications/mail-template.d.ts +44 -0
- package/dist/contracts/notifications/mail-template.js +2 -0
- package/dist/contracts/policies/condition.d.ts +16 -0
- package/dist/contracts/policies/condition.js +10 -0
- package/dist/contracts/policies/member-policy.d.ts +31 -0
- package/dist/contracts/policies/member-policy.js +12 -0
- package/dist/contracts/policies/policy.d.ts +19 -0
- package/dist/contracts/policies/policy.js +11 -0
- package/dist/contracts/policies/rule-type.d.ts +7 -0
- package/dist/contracts/policies/rule-type.js +11 -0
- package/dist/contracts/policies/rule.d.ts +58 -0
- package/dist/contracts/policies/rule.js +19 -0
- package/dist/contracts/policies/user-group-policy.d.ts +10 -0
- package/dist/contracts/policies/user-group-policy.js +17 -0
- package/dist/contracts/policies/user-policy.d.ts +10 -0
- package/dist/contracts/policies/user-policy.js +17 -0
- package/dist/contracts/querying/culture-load-option.d.ts +35 -0
- package/dist/contracts/querying/culture-load-option.js +69 -0
- package/dist/contracts/querying/entity-definition-id-iterator.d.ts +9 -0
- package/dist/contracts/querying/entity-definition-id-iterator.js +30 -0
- package/dist/contracts/querying/entity-definition-id-query-result.d.ts +10 -0
- package/dist/contracts/querying/entity-definition-id-query-result.js +22 -0
- package/dist/contracts/querying/entity-definition-iterator.d.ts +16 -0
- package/dist/contracts/querying/entity-definition-iterator.js +30 -0
- package/dist/contracts/querying/entity-definition-query-result.d.ts +21 -0
- package/dist/contracts/querying/entity-definition-query-result.js +22 -0
- package/dist/contracts/querying/entity-iterator.d.ts +13 -0
- package/dist/contracts/querying/entity-iterator.js +30 -0
- package/dist/contracts/querying/entity-load-configuration-builder.d.ts +76 -0
- package/dist/contracts/querying/entity-load-configuration-builder.js +101 -0
- package/dist/contracts/querying/entity-load-configuration.d.ts +51 -0
- package/dist/contracts/querying/entity-load-configuration.js +67 -0
- package/dist/contracts/querying/entity-load-option.d.ts +35 -0
- package/dist/contracts/querying/entity-load-option.js +94 -0
- package/dist/contracts/querying/entity-query-result.d.ts +23 -0
- package/dist/contracts/querying/entity-query-result.js +33 -0
- package/dist/contracts/querying/filters/comparison-operator.d.ts +11 -0
- package/dist/contracts/querying/filters/comparison-operator.js +15 -0
- package/dist/contracts/querying/filters/composite-filter-operator.d.ts +4 -0
- package/dist/contracts/querying/filters/composite-filter-operator.js +8 -0
- package/dist/contracts/querying/filters/composite-query-filter.d.ts +19 -0
- package/dist/contracts/querying/filters/composite-query-filter.js +49 -0
- package/dist/contracts/querying/filters/createdby-query-filter.d.ts +5 -0
- package/dist/contracts/querying/filters/createdby-query-filter.js +30 -0
- package/dist/contracts/querying/filters/createdon-query-filter.d.ts +19 -0
- package/dist/contracts/querying/filters/createdon-query-filter.js +45 -0
- package/dist/contracts/querying/filters/definition-query-filter.d.ts +34 -0
- package/dist/contracts/querying/filters/definition-query-filter.js +58 -0
- package/dist/contracts/querying/filters/filter-data-type.d.ts +11 -0
- package/dist/contracts/querying/filters/filter-data-type.js +15 -0
- package/dist/contracts/querying/filters/filter-type.d.ts +18 -0
- package/dist/contracts/querying/filters/filter-type.js +22 -0
- package/dist/contracts/querying/filters/id-query-filter.d.ts +25 -0
- package/dist/contracts/querying/filters/id-query-filter.js +49 -0
- package/dist/contracts/querying/filters/identifier-query-filter.d.ts +25 -0
- package/dist/contracts/querying/filters/identifier-query-filter.js +49 -0
- package/dist/contracts/querying/filters/index.d.ts +20 -0
- package/dist/contracts/querying/filters/index.js +32 -0
- package/dist/contracts/querying/filters/modifiedby-query-filter.d.ts +5 -0
- package/dist/contracts/querying/filters/modifiedby-query-filter.js +30 -0
- package/dist/contracts/querying/filters/modifiedon-query-filter.d.ts +19 -0
- package/dist/contracts/querying/filters/modifiedon-query-filter.js +45 -0
- package/dist/contracts/querying/filters/modules-query-filter.d.ts +14 -0
- package/dist/contracts/querying/filters/modules-query-filter.js +43 -0
- package/dist/contracts/querying/filters/not-query-filter.d.ts +14 -0
- package/dist/contracts/querying/filters/not-query-filter.js +39 -0
- package/dist/contracts/querying/filters/property-query-filter.d.ts +38 -0
- package/dist/contracts/querying/filters/property-query-filter.js +63 -0
- package/dist/contracts/querying/filters/query-filter.d.ts +10 -0
- package/dist/contracts/querying/filters/query-filter.js +28 -0
- package/dist/contracts/querying/filters/relation-connection-type.d.ts +15 -0
- package/dist/contracts/querying/filters/relation-connection-type.js +19 -0
- package/dist/contracts/querying/filters/relation-query-filter.d.ts +23 -0
- package/dist/contracts/querying/filters/relation-query-filter.js +48 -0
- package/dist/contracts/querying/filters/secured-ancestors-query-filter.d.ts +24 -0
- package/dist/contracts/querying/filters/secured-ancestors-query-filter.js +53 -0
- package/dist/contracts/querying/filters/user-query-filter.d.ts +37 -0
- package/dist/contracts/querying/filters/user-query-filter.js +61 -0
- package/dist/contracts/querying/id-iterator.d.ts +11 -0
- package/dist/contracts/querying/id-iterator.js +19 -0
- package/dist/contracts/querying/id-query-result.d.ts +17 -0
- package/dist/contracts/querying/id-query-result.js +24 -0
- package/dist/contracts/querying/iterator.d.ts +9 -0
- package/dist/contracts/querying/iterator.js +2 -0
- package/dist/contracts/querying/load-option.d.ts +4 -0
- package/dist/contracts/querying/load-option.js +2 -0
- package/dist/contracts/querying/load-options.d.ts +6 -0
- package/dist/contracts/querying/load-options.js +10 -0
- package/dist/contracts/querying/loading-query-iterator.d.ts +17 -0
- package/dist/contracts/querying/loading-query-iterator.js +57 -0
- package/dist/contracts/querying/member-load-option.d.ts +11 -0
- package/dist/contracts/querying/member-load-option.js +15 -0
- package/dist/contracts/querying/minimal-schema.d.ts +8 -0
- package/dist/contracts/querying/minimal-schema.js +48 -0
- package/dist/contracts/querying/property-data.d.ts +8 -0
- package/dist/contracts/querying/property-data.js +43 -0
- package/dist/contracts/querying/property-load-option.d.ts +30 -0
- package/dist/contracts/querying/property-load-option.js +70 -0
- package/dist/contracts/querying/query-iterator.d.ts +18 -0
- package/dist/contracts/querying/query-iterator.js +54 -0
- package/dist/contracts/querying/query-load-configuration.d.ts +39 -0
- package/dist/contracts/querying/query-load-configuration.js +86 -0
- package/dist/contracts/querying/query-request.d.ts +6 -0
- package/dist/contracts/querying/query-request.js +30 -0
- package/dist/contracts/querying/query-result-paging-manager.d.ts +9 -0
- package/dist/contracts/querying/query-result-paging-manager.js +22 -0
- package/dist/contracts/querying/query-result.d.ts +5 -0
- package/dist/contracts/querying/query-result.js +2 -0
- package/dist/contracts/querying/query-sort-order.d.ts +13 -0
- package/dist/contracts/querying/query-sort-order.js +17 -0
- package/dist/contracts/querying/query.d.ts +23 -0
- package/dist/contracts/querying/query.js +56 -0
- package/dist/contracts/querying/relation-data.d.ts +7 -0
- package/dist/contracts/querying/relation-data.js +38 -0
- package/dist/contracts/querying/relation-load-option.d.ts +31 -0
- package/dist/contracts/querying/relation-load-option.js +74 -0
- package/dist/contracts/querying/relation-specification.d.ts +33 -0
- package/dist/contracts/querying/relation-specification.js +52 -0
- package/dist/contracts/querying/schema-querying.d.ts +20 -0
- package/dist/contracts/querying/schema-querying.js +2 -0
- package/dist/contracts/querying/scroll-request.d.ts +7 -0
- package/dist/contracts/querying/scroll-request.js +33 -0
- package/dist/contracts/querying/skip-take-iterator-base.d.ts +14 -0
- package/dist/contracts/querying/skip-take-iterator-base.js +60 -0
- package/dist/contracts/querying/sort-field-type.d.ts +13 -0
- package/dist/contracts/querying/sort-field-type.js +17 -0
- package/dist/contracts/querying/sorting.d.ts +25 -0
- package/dist/contracts/querying/sorting.js +44 -0
- package/dist/contracts/users/user-group-combine-method.d.ts +4 -0
- package/dist/contracts/users/user-group-combine-method.js +8 -0
- package/dist/contracts/users/user-group-configuration.d.ts +11 -0
- package/dist/contracts/users/user-group-configuration.js +35 -0
- package/dist/contracts/users/user-profile.d.ts +4 -0
- package/dist/contracts/users/user-profile.js +2 -0
- package/dist/contracts/users/user.d.ts +24 -0
- package/dist/contracts/users/user.js +64 -0
- package/dist/converters/api-resource-converter.d.ts +16 -0
- package/dist/converters/api-resource-converter.js +45 -0
- package/dist/converters/file-version-converter.d.ts +22 -0
- package/dist/converters/file-version-converter.js +43 -0
- package/dist/converters/index.d.ts +6 -0
- package/dist/converters/index.js +18 -0
- package/dist/converters/member-condition-converter.d.ts +20 -0
- package/dist/converters/member-condition-converter.js +50 -0
- package/dist/converters/member-condition-resource-converter.d.ts +21 -0
- package/dist/converters/member-condition-resource-converter.js +53 -0
- package/dist/converters/minimal-schema-relation-cardinality-converter.d.ts +11 -0
- package/dist/converters/minimal-schema-relation-cardinality-converter.js +33 -0
- package/dist/converters/page-resource-menus-converter.d.ts +19 -0
- package/dist/converters/page-resource-menus-converter.js +45 -0
- package/dist/converters/page-resource-zones-converter.d.ts +19 -0
- package/dist/converters/page-resource-zones-converter.js +45 -0
- package/dist/converters/relation-map-resource-converter.d.ts +6 -0
- package/dist/converters/relation-map-resource-converter.js +38 -0
- package/dist/converters/relation-resource-converter.d.ts +22 -0
- package/dist/converters/relation-resource-converter.js +51 -0
- package/dist/converters/renditions-converter.d.ts +20 -0
- package/dist/converters/renditions-converter.js +44 -0
- package/dist/converters/string-to-any-map-converter.d.ts +20 -0
- package/dist/converters/string-to-any-map-converter.js +34 -0
- package/dist/culture-info.d.ts +5 -0
- package/dist/culture-info.js +7 -0
- package/dist/dirty-value-calculator.d.ts +7 -0
- package/dist/dirty-value-calculator.js +29 -0
- package/dist/entity-link.d.ts +8 -0
- package/dist/entity-link.js +40 -0
- package/dist/error-messages.d.ts +57 -0
- package/dist/error-messages.js +64 -0
- package/dist/errors/argument-error.d.ts +4 -0
- package/dist/errors/argument-error.js +11 -0
- package/dist/errors/authentication-error.d.ts +5 -0
- package/dist/errors/authentication-error.js +12 -0
- package/dist/errors/bad-request-error.d.ts +5 -0
- package/dist/errors/bad-request-error.js +11 -0
- package/dist/errors/forbidden-error.d.ts +4 -0
- package/dist/errors/forbidden-error.js +11 -0
- package/dist/errors/internal-error.d.ts +4 -0
- package/dist/errors/internal-error.js +11 -0
- package/dist/errors/invalid-operation-error.d.ts +4 -0
- package/dist/errors/invalid-operation-error.js +11 -0
- package/dist/errors/not-found-error.d.ts +5 -0
- package/dist/errors/not-found-error.js +11 -0
- package/dist/errors/not-implemented-error.d.ts +4 -0
- package/dist/errors/not-implemented-error.js +11 -0
- package/dist/errors/not-loaded-error.d.ts +4 -0
- package/dist/errors/not-loaded-error.js +11 -0
- package/dist/errors/not-supported-error.d.ts +4 -0
- package/dist/errors/not-supported-error.js +11 -0
- package/dist/errors/schema-error.d.ts +4 -0
- package/dist/errors/schema-error.js +11 -0
- package/dist/errors/validation-error.d.ts +6 -0
- package/dist/errors/validation-error.js +12 -0
- package/dist/errors/validation-failure.d.ts +7 -0
- package/dist/errors/validation-failure.js +14 -0
- package/dist/errors/web-api-error.d.ts +13 -0
- package/dist/errors/web-api-error.js +13 -0
- package/dist/factories/entity-factory.d.ts +38 -0
- package/dist/factories/entity-factory.js +76 -0
- package/dist/factories/option-list-factory.d.ts +26 -0
- package/dist/factories/option-list-factory.js +22 -0
- package/dist/factories/property-factory.d.ts +10 -0
- package/dist/factories/property-factory.js +54 -0
- package/dist/factories/relation-factory.d.ts +55 -0
- package/dist/factories/relation-factory.js +70 -0
- package/dist/fileversion.d.ts +78 -0
- package/dist/fileversion.js +144 -0
- package/dist/guard.d.ts +29 -0
- package/dist/guard.js +142 -0
- package/dist/http-method.d.ts +9 -0
- package/dist/http-method.js +13 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +22 -0
- package/dist/link-helper.d.ts +209 -0
- package/dist/link-helper.js +371 -0
- package/dist/link.d.ts +9 -0
- package/dist/link.js +78 -0
- package/dist/logging/log-level.d.ts +6 -0
- package/dist/logging/log-level.js +10 -0
- package/dist/logging/logger-base.d.ts +26 -0
- package/dist/logging/logger-base.js +98 -0
- package/dist/logging/logger.d.ts +16 -0
- package/dist/logging/logger.js +2 -0
- package/dist/logging/null-logger.d.ts +7 -0
- package/dist/logging/null-logger.js +13 -0
- package/dist/mappers/api-resource-mapper.d.ts +5 -0
- package/dist/mappers/api-resource-mapper.js +16 -0
- package/dist/mappers/condition-mapper.d.ts +36 -0
- package/dist/mappers/condition-mapper.js +112 -0
- package/dist/mappers/entity-definition-mapper.d.ts +13 -0
- package/dist/mappers/entity-definition-mapper.js +88 -0
- package/dist/mappers/entity-mapper.d.ts +19 -0
- package/dist/mappers/entity-mapper.js +134 -0
- package/dist/mappers/final-life-cycle-status-mapper.d.ts +6 -0
- package/dist/mappers/final-life-cycle-status-mapper.js +51 -0
- package/dist/mappers/load-options-mapper.d.ts +16 -0
- package/dist/mappers/load-options-mapper.js +100 -0
- package/dist/mappers/mapping-utilities.d.ts +7 -0
- package/dist/mappers/mapping-utilities.js +19 -0
- package/dist/mappers/member-condition-mapper.d.ts +12 -0
- package/dist/mappers/member-condition-mapper.js +119 -0
- package/dist/mappers/member-definition-mapper.d.ts +19 -0
- package/dist/mappers/member-definition-mapper.js +266 -0
- package/dist/mappers/member-group-mapper.d.ts +14 -0
- package/dist/mappers/member-group-mapper.js +95 -0
- package/dist/mappers/member-security-mapper.d.ts +34 -0
- package/dist/mappers/member-security-mapper.js +101 -0
- package/dist/mappers/notification-mapper.d.ts +5 -0
- package/dist/mappers/notification-mapper.js +17 -0
- package/dist/mappers/option-list-mapper.d.ts +18 -0
- package/dist/mappers/option-list-mapper.js +131 -0
- package/dist/mappers/policy-mapper.d.ts +29 -0
- package/dist/mappers/policy-mapper.js +124 -0
- package/dist/mappers/property-mapper.d.ts +21 -0
- package/dist/mappers/property-mapper.js +339 -0
- package/dist/mappers/querying-mapper.d.ts +16 -0
- package/dist/mappers/querying-mapper.js +96 -0
- package/dist/mappers/relation-cardinality-mapper.d.ts +5 -0
- package/dist/mappers/relation-cardinality-mapper.js +37 -0
- package/dist/mappers/relation-mapper.d.ts +16 -0
- package/dist/mappers/relation-mapper.js +202 -0
- package/dist/mappers/relation-role-mapper.d.ts +5 -0
- package/dist/mappers/relation-role-mapper.js +29 -0
- package/dist/mappers/rendition-mapper.d.ts +9 -0
- package/dist/mappers/rendition-mapper.js +34 -0
- package/dist/mappers/rule-type-mapper.d.ts +6 -0
- package/dist/mappers/rule-type-mapper.js +33 -0
- package/dist/mappers/rules-mapper.d.ts +35 -0
- package/dist/mappers/rules-mapper.js +123 -0
- package/dist/mappers/typed-entity-creator.d.ts +27 -0
- package/dist/mappers/typed-entity-creator.js +76 -0
- package/dist/models/entity-definition-collection-resource.d.ts +5 -0
- package/dist/models/entity-definition-collection-resource.js +26 -0
- package/dist/models/entity-definition-resource.d.ts +23 -0
- package/dist/models/entity-definition-resource.js +98 -0
- package/dist/models/entity-list-resource.d.ts +5 -0
- package/dist/models/entity-list-resource.js +26 -0
- package/dist/models/entity-resource.d.ts +36 -0
- package/dist/models/entity-resource.js +142 -0
- package/dist/models/list-resource.d.ts +13 -0
- package/dist/models/list-resource.js +50 -0
- package/dist/models/member-condition-resource.d.ts +32 -0
- package/dist/models/member-condition-resource.js +95 -0
- package/dist/models/member-definition-resource.d.ts +15 -0
- package/dist/models/member-definition-resource.js +71 -0
- package/dist/models/member-group-resource.d.ts +14 -0
- package/dist/models/member-group-resource.js +61 -0
- package/dist/models/notifications/distribute-notification-resource.d.ts +7 -0
- package/dist/models/notifications/distribute-notification-resource.js +37 -0
- package/dist/models/notifications/mail-request-broadcast.d.ts +7 -0
- package/dist/models/notifications/mail-request-broadcast.js +18 -0
- package/dist/models/notifications/mail-request-by-id.d.ts +9 -0
- package/dist/models/notifications/mail-request-by-id.js +28 -0
- package/dist/models/notifications/mail-request-by-username.d.ts +9 -0
- package/dist/models/notifications/mail-request-by-username.js +28 -0
- package/dist/models/notifications/mail-request.d.ts +26 -0
- package/dist/models/notifications/mail-request.js +12 -0
- package/dist/models/notifications/notification-level.d.ts +8 -0
- package/dist/models/notifications/notification-level.js +12 -0
- package/dist/models/notifications/realtime-request-broadcast.d.ts +7 -0
- package/dist/models/notifications/realtime-request-broadcast.js +18 -0
- package/dist/models/notifications/realtime-request-by-id.d.ts +9 -0
- package/dist/models/notifications/realtime-request-by-id.js +28 -0
- package/dist/models/notifications/realtime-request-by-username.d.ts +9 -0
- package/dist/models/notifications/realtime-request-by-username.js +28 -0
- package/dist/models/notifications/realtime-request.d.ts +60 -0
- package/dist/models/notifications/realtime-request.js +41 -0
- package/dist/models/notifications/request-by-id.d.ts +13 -0
- package/dist/models/notifications/request-by-id.js +2 -0
- package/dist/models/notifications/request-by-username.d.ts +13 -0
- package/dist/models/notifications/request-by-username.js +2 -0
- package/dist/models/notifications/validators/mail-validator.d.ts +6 -0
- package/dist/models/notifications/validators/mail-validator.js +23 -0
- package/dist/models/notifications/validators/realtime-validator.d.ts +5 -0
- package/dist/models/notifications/validators/realtime-validator.js +14 -0
- package/dist/models/notifications/validators/request-by-id-validator.d.ts +6 -0
- package/dist/models/notifications/validators/request-by-id-validator.js +31 -0
- package/dist/models/notifications/validators/request-by-username-validator.d.ts +6 -0
- package/dist/models/notifications/validators/request-by-username-validator.js +31 -0
- package/dist/models/notifications/validators/validator-base.d.ts +6 -0
- package/dist/models/notifications/validators/validator-base.js +16 -0
- package/dist/models/option-lists/flat-option-list-value.d.ts +4 -0
- package/dist/models/option-lists/flat-option-list-value.js +9 -0
- package/dist/models/option-lists/hierarchical-options-list-value.d.ts +7 -0
- package/dist/models/option-lists/hierarchical-options-list-value.js +14 -0
- package/dist/models/option-lists/option-list-collection-resource.d.ts +6 -0
- package/dist/models/option-lists/option-list-collection-resource.js +32 -0
- package/dist/models/option-lists/option-list-description-resource.d.ts +5 -0
- package/dist/models/option-lists/option-list-description-resource.js +31 -0
- package/dist/models/option-lists/option-list-resource.d.ts +16 -0
- package/dist/models/option-lists/option-list-resource.js +62 -0
- package/dist/models/option-lists/option-list-value-resource.d.ts +6 -0
- package/dist/models/option-lists/option-list-value-resource.js +32 -0
- package/dist/models/pages/component-visualization.d.ts +10 -0
- package/dist/models/pages/component-visualization.js +54 -0
- package/dist/models/pages/language-resource.d.ts +10 -0
- package/dist/models/pages/language-resource.js +47 -0
- package/dist/models/pages/menu-item.d.ts +12 -0
- package/dist/models/pages/menu-item.js +66 -0
- package/dist/models/pages/page-component-resource.d.ts +20 -0
- package/dist/models/pages/page-component-resource.js +87 -0
- package/dist/models/pages/page-resource.d.ts +23 -0
- package/dist/models/pages/page-resource.js +100 -0
- package/dist/models/pages/page-row-settings.d.ts +27 -0
- package/dist/models/pages/page-row-settings.js +119 -0
- package/dist/models/pages/portal-column-resource.d.ts +6 -0
- package/dist/models/pages/portal-column-resource.js +37 -0
- package/dist/models/pages/portal-row-resource.d.ts +7 -0
- package/dist/models/pages/portal-row-resource.js +38 -0
- package/dist/models/pages/portal-section-resource.d.ts +6 -0
- package/dist/models/pages/portal-section-resource.js +37 -0
- package/dist/models/permissions-resource.d.ts +4 -0
- package/dist/models/permissions-resource.js +28 -0
- package/dist/models/policies/condition-resource.d.ts +21 -0
- package/dist/models/policies/condition-resource.js +53 -0
- package/dist/models/policies/member-policy-resource.d.ts +8 -0
- package/dist/models/policies/member-policy-resource.js +43 -0
- package/dist/models/policies/policy-resource.d.ts +50 -0
- package/dist/models/policies/policy-resource.js +89 -0
- package/dist/models/policies/rule-resource.d.ts +49 -0
- package/dist/models/policies/rule-resource.js +78 -0
- package/dist/models/property-definition-resource.d.ts +45 -0
- package/dist/models/property-definition-resource.js +198 -0
- package/dist/models/query-loading-resource.d.ts +4 -0
- package/dist/models/query-loading-resource.js +28 -0
- package/dist/models/query-result-resource.d.ts +9 -0
- package/dist/models/query-result-resource.js +34 -0
- package/dist/models/relation-definition-resource.d.ts +29 -0
- package/dist/models/relation-definition-resource.js +115 -0
- package/dist/models/relation-map-resource.d.ts +6 -0
- package/dist/models/relation-map-resource.js +16 -0
- package/dist/models/relation-resource.d.ts +21 -0
- package/dist/models/relation-resource.js +93 -0
- package/dist/models/resource-containers/entity-definition-resource-container.d.ts +8 -0
- package/dist/models/resource-containers/entity-definition-resource-container.js +2 -0
- package/dist/models/resource-containers/entity-resource-container.d.ts +8 -0
- package/dist/models/resource-containers/entity-resource-container.js +2 -0
- package/dist/models/resource.d.ts +4 -0
- package/dist/models/resource.js +26 -0
- package/dist/models/search/aggregation-request-resource.d.ts +16 -0
- package/dist/models/search/aggregation-request-resource.js +72 -0
- package/dist/models/search/aggregation-response-resource.d.ts +8 -0
- package/dist/models/search/aggregation-response-resource.js +41 -0
- package/dist/models/search/bucket-response-resource.d.ts +8 -0
- package/dist/models/search/bucket-response-resource.js +46 -0
- package/dist/models/search/date-interval.d.ts +10 -0
- package/dist/models/search/date-interval.js +14 -0
- package/dist/models/search/facet-response-resource.d.ts +20 -0
- package/dist/models/search/facet-response-resource.js +98 -0
- package/dist/models/search/field-filter-request-resource.d.ts +16 -0
- package/dist/models/search/field-filter-request-resource.js +76 -0
- package/dist/models/search/field-filter-response-resource.d.ts +17 -0
- package/dist/models/search/field-filter-response-resource.js +84 -0
- package/dist/models/search/field-filter-value-response-resource.d.ts +6 -0
- package/dist/models/search/field-filter-value-response-resource.js +31 -0
- package/dist/models/search/filter-operator.d.ts +86 -0
- package/dist/models/search/filter-operator.js +90 -0
- package/dist/models/search/full-text-response-resource.d.ts +4 -0
- package/dist/models/search/full-text-response-resource.js +27 -0
- package/dist/models/search/group-category.d.ts +6 -0
- package/dist/models/search/group-category.js +35 -0
- package/dist/models/search/group-config.d.ts +4 -0
- package/dist/models/search/group-config.js +27 -0
- package/dist/models/search/group-item.d.ts +10 -0
- package/dist/models/search/group-item.js +44 -0
- package/dist/models/search/grouped-view-response-resource.d.ts +15 -0
- package/dist/models/search/grouped-view-response-resource.js +65 -0
- package/dist/models/search/metric-option-request-resource.d.ts +7 -0
- package/dist/models/search/metric-option-request-resource.js +37 -0
- package/dist/models/search/metric-option-response-resource.d.ts +5 -0
- package/dist/models/search/metric-option-response-resource.js +31 -0
- package/dist/models/search/nested-relation-info.d.ts +11 -0
- package/dist/models/search/nested-relation-info.js +96 -0
- package/dist/models/search/requested-aggregation-type.d.ts +5 -0
- package/dist/models/search/requested-aggregation-type.js +9 -0
- package/dist/models/search/requested-filter-type.d.ts +6 -0
- package/dist/models/search/requested-filter-type.js +10 -0
- package/dist/models/search/search-group-request-resource.d.ts +5 -0
- package/dist/models/search/search-group-request-resource.js +31 -0
- package/dist/models/search/search-request.d.ts +41 -0
- package/dist/models/search/search-request.js +131 -0
- package/dist/models/search/search-response.d.ts +36 -0
- package/dist/models/search/search-response.js +123 -0
- package/dist/models/search/selection-pool-filter-resource.d.ts +7 -0
- package/dist/models/search/selection-pool-filter-resource.js +38 -0
- package/dist/models/search/sorting-request-resource.d.ts +5 -0
- package/dist/models/search/sorting-request-resource.js +32 -0
- package/dist/models/search/sorting-response-resource.d.ts +6 -0
- package/dist/models/search/sorting-response-resource.js +34 -0
- package/dist/models/search-document-resource.d.ts +7 -0
- package/dist/models/search-document-resource.js +33 -0
- package/dist/models/set-password-request-resource.d.ts +5 -0
- package/dist/models/set-password-request-resource.js +31 -0
- package/dist/settings/fetch-setting.d.ts +12 -0
- package/dist/settings/fetch-setting.js +61 -0
- package/dist/settings/super-user-excluded-privileges.d.ts +3 -0
- package/dist/settings/super-user-excluded-privileges.js +27 -0
- package/dist/settings/usage-rights-configuration.d.ts +24 -0
- package/dist/settings/usage-rights-configuration.js +90 -0
- package/dist/type-guards.d.ts +20 -0
- package/dist/type-guards.js +28 -0
- package/package.json +78 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ApiResourceConverter = void 0;
|
|
7
|
+
const api_resource_1 = require("../api/api-resource");
|
|
8
|
+
const invalid_operation_error_1 = require("../errors/invalid-operation-error");
|
|
9
|
+
const not_implemented_error_1 = require("../errors/not-implemented-error");
|
|
10
|
+
const link_1 = __importDefault(require("../link"));
|
|
11
|
+
class ApiResourceConverter {
|
|
12
|
+
/**
|
|
13
|
+
* Not implemented.
|
|
14
|
+
*/
|
|
15
|
+
serialize(value) {
|
|
16
|
+
throw new not_implemented_error_1.NotImplementedError("Serialization of an API resource is not implemented.");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Deserializes a JSON object into an ApiResource instance.
|
|
20
|
+
*
|
|
21
|
+
* @param value - A JSON object
|
|
22
|
+
*
|
|
23
|
+
* @returns An ApiResource instance.
|
|
24
|
+
*/
|
|
25
|
+
deserialize(value) {
|
|
26
|
+
if (!value) {
|
|
27
|
+
throw new invalid_operation_error_1.InvalidOperationError("Can't deserialize falsy value.");
|
|
28
|
+
}
|
|
29
|
+
else if (typeof value !== "object" || value instanceof Array) {
|
|
30
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Expected a value of type 'object', but value was of type '${typeof value}'.`);
|
|
31
|
+
}
|
|
32
|
+
return Object.keys(value).reduce((apiResource, routeName) => {
|
|
33
|
+
// We will use the Link type purely to be able to access the correct properties and avoid using any.
|
|
34
|
+
const route = value[routeName];
|
|
35
|
+
// We skip empty entries or entries that don't have an href property.
|
|
36
|
+
if (route == null || !route.href) {
|
|
37
|
+
return apiResource;
|
|
38
|
+
}
|
|
39
|
+
// Create proper instances for the route link.
|
|
40
|
+
apiResource[routeName] = new link_1.default(route.href, route.title, route.templated);
|
|
41
|
+
return apiResource;
|
|
42
|
+
}, new api_resource_1.ApiResource());
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ApiResourceConverter = ApiResourceConverter;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IPropertyConverter } from "ta-json";
|
|
2
|
+
import { Nullable } from "../base-types";
|
|
3
|
+
import { FileVersion } from "../fileversion";
|
|
4
|
+
export declare class FileVersionConverter implements IPropertyConverter {
|
|
5
|
+
private isFileversion;
|
|
6
|
+
/**
|
|
7
|
+
* Serializes a Filversion into a string.
|
|
8
|
+
*
|
|
9
|
+
* @param version - A Fileversion
|
|
10
|
+
*
|
|
11
|
+
* @returns A string.
|
|
12
|
+
*/
|
|
13
|
+
serialize(version: FileVersion): Nullable<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Deserializes a string into a FileVersion instance.
|
|
16
|
+
*
|
|
17
|
+
* @param value - A string
|
|
18
|
+
*
|
|
19
|
+
* @returns A Fileversion instance or null.
|
|
20
|
+
*/
|
|
21
|
+
deserialize(value: string): FileVersion;
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileVersionConverter = void 0;
|
|
4
|
+
const invalid_operation_error_1 = require("../errors/invalid-operation-error");
|
|
5
|
+
const fileversion_1 = require("../fileversion");
|
|
6
|
+
class FileVersionConverter {
|
|
7
|
+
isFileversion(arg) {
|
|
8
|
+
return arg.major !== undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Serializes a Filversion into a string.
|
|
12
|
+
*
|
|
13
|
+
* @param version - A Fileversion
|
|
14
|
+
*
|
|
15
|
+
* @returns A string.
|
|
16
|
+
*/
|
|
17
|
+
serialize(version) {
|
|
18
|
+
if (!version) {
|
|
19
|
+
throw new invalid_operation_error_1.InvalidOperationError("Can't serialize falsy value.");
|
|
20
|
+
}
|
|
21
|
+
else if (!this.isFileversion(version)) {
|
|
22
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Expected a value of type 'Fileversion', but value was of type '${typeof version}'.`);
|
|
23
|
+
}
|
|
24
|
+
return version.toString();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Deserializes a string into a FileVersion instance.
|
|
28
|
+
*
|
|
29
|
+
* @param value - A string
|
|
30
|
+
*
|
|
31
|
+
* @returns A Fileversion instance or null.
|
|
32
|
+
*/
|
|
33
|
+
deserialize(value) {
|
|
34
|
+
if (!value) {
|
|
35
|
+
throw new invalid_operation_error_1.InvalidOperationError("Can't deserialize falsy value.");
|
|
36
|
+
}
|
|
37
|
+
else if (typeof value !== "string") {
|
|
38
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Expected a value of type 'string', but value was of type '${typeof value}'.`);
|
|
39
|
+
}
|
|
40
|
+
return fileversion_1.FileVersion.parse(value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.FileVersionConverter = FileVersionConverter;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./api-resource-converter";
|
|
2
|
+
export * from "./file-version-converter";
|
|
3
|
+
export * from "./relation-resource-converter";
|
|
4
|
+
export * from "./relation-map-resource-converter";
|
|
5
|
+
export * from "./renditions-converter";
|
|
6
|
+
export * from "./string-to-any-map-converter";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./api-resource-converter"), exports);
|
|
14
|
+
__exportStar(require("./file-version-converter"), exports);
|
|
15
|
+
__exportStar(require("./relation-resource-converter"), exports);
|
|
16
|
+
__exportStar(require("./relation-map-resource-converter"), exports);
|
|
17
|
+
__exportStar(require("./renditions-converter"), exports);
|
|
18
|
+
__exportStar(require("./string-to-any-map-converter"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IPropertyConverter, JsonValue } from "ta-json";
|
|
2
|
+
import { MemberCondition } from "../contracts/base";
|
|
3
|
+
export declare class MemberConditionConverter implements IPropertyConverter {
|
|
4
|
+
/**
|
|
5
|
+
* Serializes a MemberCondition instance into JSON Value.
|
|
6
|
+
*
|
|
7
|
+
* @param value - A MemberCondition instance
|
|
8
|
+
*
|
|
9
|
+
* @returns An JSON Value.
|
|
10
|
+
*/
|
|
11
|
+
serialize(value: MemberCondition): JsonValue;
|
|
12
|
+
/**
|
|
13
|
+
* Deserializes a JSON Value into a MemberCondition instance.
|
|
14
|
+
*
|
|
15
|
+
* @param value - A JSON Value
|
|
16
|
+
*
|
|
17
|
+
* @returns A MemberCondition instance.
|
|
18
|
+
*/
|
|
19
|
+
deserialize(value: JsonValue): MemberCondition;
|
|
20
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemberConditionConverter = void 0;
|
|
4
|
+
const ta_json_1 = require("ta-json");
|
|
5
|
+
const base_1 = require("../contracts/base");
|
|
6
|
+
const invalid_operation_error_1 = require("../errors/invalid-operation-error");
|
|
7
|
+
class MemberConditionConverter {
|
|
8
|
+
/**
|
|
9
|
+
* Serializes a MemberCondition instance into JSON Value.
|
|
10
|
+
*
|
|
11
|
+
* @param value - A MemberCondition instance
|
|
12
|
+
*
|
|
13
|
+
* @returns An JSON Value.
|
|
14
|
+
*/
|
|
15
|
+
serialize(value) {
|
|
16
|
+
return ta_json_1.TaJson.serialize(value);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Deserializes a JSON Value into a MemberCondition instance.
|
|
20
|
+
*
|
|
21
|
+
* @param value - A JSON Value
|
|
22
|
+
*
|
|
23
|
+
* @returns A MemberCondition instance.
|
|
24
|
+
*/
|
|
25
|
+
deserialize(value) {
|
|
26
|
+
if (!value) {
|
|
27
|
+
throw new invalid_operation_error_1.InvalidOperationError("Can't deserialize falsy value.");
|
|
28
|
+
}
|
|
29
|
+
else if (typeof value !== "object" || value instanceof Array) {
|
|
30
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Expected a value of type 'object', but value was of type '${typeof value}'.`);
|
|
31
|
+
}
|
|
32
|
+
const obj = typeof value === "string" ? JSON.parse(value) : value;
|
|
33
|
+
if (obj.definitionId) {
|
|
34
|
+
return ta_json_1.TaJson.deserialize(value, base_1.NoAncestorMemberCondition);
|
|
35
|
+
}
|
|
36
|
+
else if (typeof obj.value === "string") {
|
|
37
|
+
return ta_json_1.TaJson.deserialize(value, base_1.StringMemberCondition);
|
|
38
|
+
}
|
|
39
|
+
else if (typeof obj.value === "boolean") {
|
|
40
|
+
return ta_json_1.TaJson.deserialize(value, base_1.BooleanMemberCondition);
|
|
41
|
+
}
|
|
42
|
+
else if (obj.entityId) {
|
|
43
|
+
return ta_json_1.TaJson.deserialize(value, base_1.RelationMemberCondition);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new invalid_operation_error_1.InvalidOperationError("Not a known condition format");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.MemberConditionConverter = MemberConditionConverter;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IPropertyConverter, JsonValue } from "ta-json";
|
|
2
|
+
import { MemberConditionResource } from "../models/member-condition-resource";
|
|
3
|
+
export declare class MemberConditionResourceConverter implements IPropertyConverter {
|
|
4
|
+
/**
|
|
5
|
+
* Serializes a MemberConditionResource instance into JSON Value.
|
|
6
|
+
*
|
|
7
|
+
* @param value - A MemberConditionResource instance
|
|
8
|
+
*
|
|
9
|
+
* @returns An JSON Value.
|
|
10
|
+
*/
|
|
11
|
+
serialize(value: MemberConditionResource): JsonValue;
|
|
12
|
+
/**
|
|
13
|
+
* Deserializes a JSON Value into a MemberConditionResource instance.
|
|
14
|
+
*
|
|
15
|
+
* @param value - A JSON Value
|
|
16
|
+
*
|
|
17
|
+
* @returns A MemberConditionResource instance.
|
|
18
|
+
*/
|
|
19
|
+
deserialize(value: JsonValue): MemberConditionResource;
|
|
20
|
+
private isLink;
|
|
21
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemberConditionResourceConverter = void 0;
|
|
4
|
+
const ta_json_1 = require("ta-json");
|
|
5
|
+
const invalid_operation_error_1 = require("../errors/invalid-operation-error");
|
|
6
|
+
const member_condition_resource_1 = require("../models/member-condition-resource");
|
|
7
|
+
class MemberConditionResourceConverter {
|
|
8
|
+
/**
|
|
9
|
+
* Serializes a MemberConditionResource instance into JSON Value.
|
|
10
|
+
*
|
|
11
|
+
* @param value - A MemberConditionResource instance
|
|
12
|
+
*
|
|
13
|
+
* @returns An JSON Value.
|
|
14
|
+
*/
|
|
15
|
+
serialize(value) {
|
|
16
|
+
return ta_json_1.TaJson.serialize(value);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Deserializes a JSON Value into a MemberConditionResource instance.
|
|
20
|
+
*
|
|
21
|
+
* @param value - A JSON Value
|
|
22
|
+
*
|
|
23
|
+
* @returns A MemberConditionResource instance.
|
|
24
|
+
*/
|
|
25
|
+
deserialize(value) {
|
|
26
|
+
if (!value) {
|
|
27
|
+
throw new invalid_operation_error_1.InvalidOperationError("Can't deserialize falsy value.");
|
|
28
|
+
}
|
|
29
|
+
else if (typeof value !== "object" || value instanceof Array) {
|
|
30
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Expected a value of type 'object', but value was of type '${typeof value}'.`);
|
|
31
|
+
}
|
|
32
|
+
const obj = typeof value === "string" ? JSON.parse(value) : value;
|
|
33
|
+
if (obj.definition) {
|
|
34
|
+
return ta_json_1.TaJson.deserialize(value, member_condition_resource_1.NoAncestorMemberConditionResource);
|
|
35
|
+
}
|
|
36
|
+
else if (typeof obj.value === "string") {
|
|
37
|
+
return ta_json_1.TaJson.deserialize(value, member_condition_resource_1.StringMemberConditionResource);
|
|
38
|
+
}
|
|
39
|
+
else if (typeof obj.value === "boolean") {
|
|
40
|
+
return ta_json_1.TaJson.deserialize(value, member_condition_resource_1.BooleanMemberConditionResource);
|
|
41
|
+
}
|
|
42
|
+
else if (this.isLink(obj.value)) {
|
|
43
|
+
return ta_json_1.TaJson.deserialize(value, member_condition_resource_1.RelationMemberConditionResource);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new invalid_operation_error_1.InvalidOperationError("Not a known condition format");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
isLink(arg) {
|
|
50
|
+
return arg.href !== undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.MemberConditionResourceConverter = MemberConditionResourceConverter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RelationCardinality } from "../contracts/base";
|
|
2
|
+
declare enum Cardinality {
|
|
3
|
+
OneToOne = 0,
|
|
4
|
+
OneToMany = 1,
|
|
5
|
+
ManyToMany = 2
|
|
6
|
+
}
|
|
7
|
+
export declare class MinimalSchemaRelationCardinalityConverter {
|
|
8
|
+
serialize(value: RelationCardinality): Cardinality;
|
|
9
|
+
deserialize(value: Cardinality): RelationCardinality;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MinimalSchemaRelationCardinalityConverter = void 0;
|
|
4
|
+
const base_1 = require("../contracts/base");
|
|
5
|
+
var Cardinality;
|
|
6
|
+
(function (Cardinality) {
|
|
7
|
+
Cardinality[Cardinality["OneToOne"] = 0] = "OneToOne";
|
|
8
|
+
Cardinality[Cardinality["OneToMany"] = 1] = "OneToMany";
|
|
9
|
+
Cardinality[Cardinality["ManyToMany"] = 2] = "ManyToMany";
|
|
10
|
+
})(Cardinality || (Cardinality = {}));
|
|
11
|
+
class MinimalSchemaRelationCardinalityConverter {
|
|
12
|
+
serialize(value) {
|
|
13
|
+
switch (value) {
|
|
14
|
+
case base_1.RelationCardinality.ManyToMany:
|
|
15
|
+
return Cardinality.ManyToMany;
|
|
16
|
+
case base_1.RelationCardinality.OneToMany:
|
|
17
|
+
return Cardinality.OneToMany;
|
|
18
|
+
case base_1.RelationCardinality.OneToOne:
|
|
19
|
+
return Cardinality.OneToOne;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
deserialize(value) {
|
|
23
|
+
switch (value) {
|
|
24
|
+
case Cardinality.ManyToMany:
|
|
25
|
+
return base_1.RelationCardinality.ManyToMany;
|
|
26
|
+
case Cardinality.OneToMany:
|
|
27
|
+
return base_1.RelationCardinality.OneToMany;
|
|
28
|
+
case Cardinality.OneToOne:
|
|
29
|
+
return base_1.RelationCardinality.OneToOne;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.MinimalSchemaRelationCardinalityConverter = MinimalSchemaRelationCardinalityConverter;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IPropertyConverter, JsonValueObject } from "ta-json";
|
|
2
|
+
import { MapStringTo } from "../base-types";
|
|
3
|
+
import { MenuItem } from "../models/pages/menu-item";
|
|
4
|
+
export declare class PageResourceMenusConverter implements IPropertyConverter {
|
|
5
|
+
/**
|
|
6
|
+
* Serializes a string map of arrays of {@link MenuItem}s.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The map of strings to arrays of {@link MenuItem}s
|
|
9
|
+
* @returns A JSON value object.
|
|
10
|
+
*/
|
|
11
|
+
serialize(value: MapStringTo<Array<MenuItem>>): JsonValueObject;
|
|
12
|
+
/**
|
|
13
|
+
* Deserializes a JSON object into a string map of arrays of {@link MenuItem}s.
|
|
14
|
+
*
|
|
15
|
+
* @param value - A JSON object
|
|
16
|
+
* @returns A mapping of strings to arrays of {@link MenuItem}s.
|
|
17
|
+
*/
|
|
18
|
+
deserialize(value: JsonValueObject): MapStringTo<Array<MenuItem>>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageResourceMenusConverter = void 0;
|
|
4
|
+
const ta_json_1 = require("ta-json");
|
|
5
|
+
const menu_item_1 = require("../models/pages/menu-item");
|
|
6
|
+
class PageResourceMenusConverter {
|
|
7
|
+
/**
|
|
8
|
+
* Serializes a string map of arrays of {@link MenuItem}s.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The map of strings to arrays of {@link MenuItem}s
|
|
11
|
+
* @returns A JSON value object.
|
|
12
|
+
*/
|
|
13
|
+
serialize(value) {
|
|
14
|
+
const result = {};
|
|
15
|
+
Object.keys(value).forEach(menuName => {
|
|
16
|
+
const menu = value[menuName];
|
|
17
|
+
result[menuName] = menu.map(menuItem => {
|
|
18
|
+
return ta_json_1.TaJson.serialize(menuItem);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Deserializes a JSON object into a string map of arrays of {@link MenuItem}s.
|
|
25
|
+
*
|
|
26
|
+
* @param value - A JSON object
|
|
27
|
+
* @returns A mapping of strings to arrays of {@link MenuItem}s.
|
|
28
|
+
*/
|
|
29
|
+
deserialize(value) {
|
|
30
|
+
if (!value) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
const result = {};
|
|
34
|
+
Object.keys(value).forEach(menuName => {
|
|
35
|
+
const menu = value[menuName];
|
|
36
|
+
if (Array.isArray(menu)) {
|
|
37
|
+
result[menuName] = menu.map(menuItem => {
|
|
38
|
+
return ta_json_1.TaJson.deserialize(menuItem, menu_item_1.MenuItem);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.PageResourceMenusConverter = PageResourceMenusConverter;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IPropertyConverter, JsonValueObject } from "ta-json";
|
|
2
|
+
import { MapStringTo } from "../base-types";
|
|
3
|
+
import { PageComponentResource } from "../models/pages/page-component-resource";
|
|
4
|
+
export declare class PageResourceZonesConverter implements IPropertyConverter {
|
|
5
|
+
/**
|
|
6
|
+
* Serializes a string map of arrays of {@link PageComponentResource}s.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The map of strings to arrays of {@link PageComponentResource}s
|
|
9
|
+
* @returns A JSON value object.
|
|
10
|
+
*/
|
|
11
|
+
serialize(value: MapStringTo<Array<PageComponentResource>>): JsonValueObject;
|
|
12
|
+
/**
|
|
13
|
+
* Deserializes a JSON object into a string map of arrays of {@link PageComponentResource}s.
|
|
14
|
+
*
|
|
15
|
+
* @param value - A JSON object
|
|
16
|
+
* @returns A mapping of strings to arrays of {@link PageComponentResource}s.
|
|
17
|
+
*/
|
|
18
|
+
deserialize(value: JsonValueObject): MapStringTo<Array<PageComponentResource>>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageResourceZonesConverter = void 0;
|
|
4
|
+
const ta_json_1 = require("ta-json");
|
|
5
|
+
const page_component_resource_1 = require("../models/pages/page-component-resource");
|
|
6
|
+
class PageResourceZonesConverter {
|
|
7
|
+
/**
|
|
8
|
+
* Serializes a string map of arrays of {@link PageComponentResource}s.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The map of strings to arrays of {@link PageComponentResource}s
|
|
11
|
+
* @returns A JSON value object.
|
|
12
|
+
*/
|
|
13
|
+
serialize(value) {
|
|
14
|
+
const result = {};
|
|
15
|
+
Object.keys(value).forEach(zoneName => {
|
|
16
|
+
const zone = value[zoneName];
|
|
17
|
+
result[zoneName] = zone.map(pageComponentResource => {
|
|
18
|
+
return ta_json_1.TaJson.serialize(pageComponentResource);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Deserializes a JSON object into a string map of arrays of {@link PageComponentResource}s.
|
|
25
|
+
*
|
|
26
|
+
* @param value - A JSON object
|
|
27
|
+
* @returns A mapping of strings to arrays of {@link PageComponentResource}s.
|
|
28
|
+
*/
|
|
29
|
+
deserialize(value) {
|
|
30
|
+
if (!value) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
const result = {};
|
|
34
|
+
Object.keys(value).forEach(zoneName => {
|
|
35
|
+
const zone = value[zoneName];
|
|
36
|
+
if (Array.isArray(zone)) {
|
|
37
|
+
result[zoneName] = zone.map(pageComponentResource => {
|
|
38
|
+
return ta_json_1.TaJson.deserialize(pageComponentResource, page_component_resource_1.PageComponentResource);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.PageResourceZonesConverter = PageResourceZonesConverter;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IPropertyConverter, JsonValue } from "ta-json";
|
|
2
|
+
import { RelationMapResource } from "../models/relation-map-resource";
|
|
3
|
+
export declare class RelationMapResourceConverter implements IPropertyConverter {
|
|
4
|
+
serialize(value: RelationMapResource): JsonValue;
|
|
5
|
+
deserialize(value: JsonValue): RelationMapResource;
|
|
6
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RelationMapResourceConverter = void 0;
|
|
7
|
+
const ta_json_1 = require("ta-json");
|
|
8
|
+
const invalid_operation_error_1 = require("../errors/invalid-operation-error");
|
|
9
|
+
const link_1 = __importDefault(require("../link"));
|
|
10
|
+
const relation_resource_1 = require("../models/relation-resource");
|
|
11
|
+
class RelationMapResourceConverter {
|
|
12
|
+
serialize(value) {
|
|
13
|
+
return ta_json_1.TaJson.serialize(value);
|
|
14
|
+
}
|
|
15
|
+
deserialize(value) {
|
|
16
|
+
if (!value) {
|
|
17
|
+
throw new invalid_operation_error_1.InvalidOperationError("Can't deserialize falsy value.");
|
|
18
|
+
}
|
|
19
|
+
else if (typeof value !== "object" || value instanceof Array) {
|
|
20
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Expected a value of type 'JSON', but value was of type '${typeof value}'.`);
|
|
21
|
+
}
|
|
22
|
+
let obj = null;
|
|
23
|
+
typeof value === "string" ? (obj = JSON.parse(value)) : (obj = JSON.parse(JSON.stringify(value)));
|
|
24
|
+
try {
|
|
25
|
+
return Object.keys(obj).reduce((map, relationName) => {
|
|
26
|
+
const resource = obj[relationName];
|
|
27
|
+
map[relationName] = resource.href
|
|
28
|
+
? ta_json_1.TaJson.deserialize(resource, link_1.default)
|
|
29
|
+
: ta_json_1.TaJson.deserialize(resource, relation_resource_1.RelationResource);
|
|
30
|
+
return map;
|
|
31
|
+
}, {});
|
|
32
|
+
}
|
|
33
|
+
catch (ex) {
|
|
34
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Couldn't deserialize this JsonValue - ${ex}.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.RelationMapResourceConverter = RelationMapResourceConverter;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IPropertyConverter, JsonValue } from "ta-json";
|
|
2
|
+
import Link from "../link";
|
|
3
|
+
import { RelationResource } from "../models/relation-resource";
|
|
4
|
+
export declare class RelationResourceConverter implements IPropertyConverter {
|
|
5
|
+
/**
|
|
6
|
+
* Serializes a RelationResource or a Link into a JsonValue.
|
|
7
|
+
*
|
|
8
|
+
* @param value - A RelationResource or a Link
|
|
9
|
+
*
|
|
10
|
+
* @returns A Json Value.
|
|
11
|
+
*/
|
|
12
|
+
serialize(value: RelationResource | Link): JsonValue;
|
|
13
|
+
/**
|
|
14
|
+
* Deserializes a JsonValue into a RelationResource or a Link.
|
|
15
|
+
*
|
|
16
|
+
* @param value - A Json Value
|
|
17
|
+
*
|
|
18
|
+
* @returns A RelationResource or a Link.
|
|
19
|
+
*/
|
|
20
|
+
deserialize(value: JsonValue): RelationResource | Link;
|
|
21
|
+
private isRelationResource;
|
|
22
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RelationResourceConverter = void 0;
|
|
7
|
+
const ta_json_1 = require("ta-json");
|
|
8
|
+
const invalid_operation_error_1 = require("../errors/invalid-operation-error");
|
|
9
|
+
const link_1 = __importDefault(require("../link"));
|
|
10
|
+
const relation_resource_1 = require("../models/relation-resource");
|
|
11
|
+
class RelationResourceConverter {
|
|
12
|
+
/**
|
|
13
|
+
* Serializes a RelationResource or a Link into a JsonValue.
|
|
14
|
+
*
|
|
15
|
+
* @param value - A RelationResource or a Link
|
|
16
|
+
*
|
|
17
|
+
* @returns A Json Value.
|
|
18
|
+
*/
|
|
19
|
+
serialize(value) {
|
|
20
|
+
return ta_json_1.TaJson.serialize(value);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Deserializes a JsonValue into a RelationResource or a Link.
|
|
24
|
+
*
|
|
25
|
+
* @param value - A Json Value
|
|
26
|
+
*
|
|
27
|
+
* @returns A RelationResource or a Link.
|
|
28
|
+
*/
|
|
29
|
+
deserialize(value) {
|
|
30
|
+
if (!value) {
|
|
31
|
+
throw new invalid_operation_error_1.InvalidOperationError("Can't deserialize falsy value.");
|
|
32
|
+
}
|
|
33
|
+
else if (typeof value !== "object" || value instanceof Array) {
|
|
34
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Expected a value of type 'JSON', but value was of type '${typeof value}'.`);
|
|
35
|
+
}
|
|
36
|
+
const obj = typeof value === "string" ? JSON.parse(value) : JSON.parse(JSON.stringify(value));
|
|
37
|
+
if (obj.href) {
|
|
38
|
+
return ta_json_1.TaJson.deserialize(obj, link_1.default);
|
|
39
|
+
}
|
|
40
|
+
else if (this.isRelationResource(obj)) {
|
|
41
|
+
return ta_json_1.TaJson.deserialize(value, relation_resource_1.RelationResource);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
throw new invalid_operation_error_1.InvalidOperationError("Not a known format");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
isRelationResource(arg) {
|
|
48
|
+
return arg.self !== undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.RelationResourceConverter = RelationResourceConverter;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IPropertyConverter, JsonValue } from "ta-json";
|
|
2
|
+
import { IRendition } from "../contracts/base/rendition";
|
|
3
|
+
export declare class RenditionsConverter implements IPropertyConverter {
|
|
4
|
+
/**
|
|
5
|
+
* Serializes an array of renditions into a Json Value.
|
|
6
|
+
*
|
|
7
|
+
* @param value - An array of renditions
|
|
8
|
+
*
|
|
9
|
+
* @returns A Json Value.
|
|
10
|
+
*/
|
|
11
|
+
serialize(renditions: Array<IRendition>): JsonValue;
|
|
12
|
+
/**
|
|
13
|
+
* Deserializes a Json Value into an array of renditions.
|
|
14
|
+
*
|
|
15
|
+
* @param value - A Json Value
|
|
16
|
+
*
|
|
17
|
+
* @returns An array with Renditions.
|
|
18
|
+
*/
|
|
19
|
+
deserialize(value: JsonValue): Array<IRendition>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenditionsConverter = void 0;
|
|
4
|
+
const rendition_1 = require("../contracts/base/rendition");
|
|
5
|
+
const invalid_operation_error_1 = require("../errors/invalid-operation-error");
|
|
6
|
+
class RenditionsConverter {
|
|
7
|
+
/**
|
|
8
|
+
* Serializes an array of renditions into a Json Value.
|
|
9
|
+
*
|
|
10
|
+
* @param value - An array of renditions
|
|
11
|
+
*
|
|
12
|
+
* @returns A Json Value.
|
|
13
|
+
*/
|
|
14
|
+
serialize(renditions) {
|
|
15
|
+
const result = {};
|
|
16
|
+
renditions.forEach(rendition => {
|
|
17
|
+
result[rendition.name] = rendition.items;
|
|
18
|
+
});
|
|
19
|
+
return JSON.stringify(result);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Deserializes a Json Value into an array of renditions.
|
|
23
|
+
*
|
|
24
|
+
* @param value - A Json Value
|
|
25
|
+
*
|
|
26
|
+
* @returns An array with Renditions.
|
|
27
|
+
*/
|
|
28
|
+
deserialize(value) {
|
|
29
|
+
if (!value) {
|
|
30
|
+
throw new invalid_operation_error_1.InvalidOperationError("Can't deserialize falsy value.");
|
|
31
|
+
}
|
|
32
|
+
else if (typeof value !== "object") {
|
|
33
|
+
throw new invalid_operation_error_1.InvalidOperationError(`Expected a value of type 'JSON', but value was of type '${typeof value}'.`);
|
|
34
|
+
}
|
|
35
|
+
const renditions = typeof value === "string" ? JSON.parse(value) : JSON.parse(JSON.stringify(value));
|
|
36
|
+
const result = [];
|
|
37
|
+
Object.keys(renditions).forEach(renditionName => {
|
|
38
|
+
const items = renditions[renditionName];
|
|
39
|
+
result.push(rendition_1.Rendition.createRendition(renditionName, items));
|
|
40
|
+
});
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.RenditionsConverter = RenditionsConverter;
|