@craftercms/models
Advanced tools
Comparing version 1.1.2 to 1.2.0
/* | ||
* Copyright (C) 2007-2018 Crafter Software Corporation. All rights reserved. | ||
* Copyright (C) 2007-2020 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* it under the terms of the GNU General Public License version 3 as published by | ||
* the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
@@ -20,20 +19,19 @@ (function (global, factory) { | ||
typeof define === 'function' && define.amd ? define('@craftercms/models', ['exports'], factory) : | ||
(factory((global.craftercms = global.craftercms || {}, global.craftercms.models = {}))); | ||
(global = global || self, factory((global.craftercms = global.craftercms || {}, global.craftercms.models = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
/* | ||
* Copyright (C) 2007-2018 Crafter Software Corporation. All rights reserved. | ||
* Copyright (C) 2007-2020 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* it under the terms of the GNU General Public License version 3 as published by | ||
* the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
@@ -40,0 +38,0 @@ /* |
@@ -1,1 +0,1 @@ | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define("@craftercms/models",["exports"],factory):factory((global.craftercms=global.craftercms||{},global.craftercms.models={}))}(this,function(exports){"use strict";var MessageScope,MessageTopic;(MessageScope=exports.MessageScope||(exports.MessageScope={})).ALL="ALL",MessageScope.Local="LOCAL",MessageScope.External="EXTERNAL",MessageScope.Broadcast="BROADCAST",(MessageTopic=exports.MessageTopic||(exports.MessageTopic={})).ALL="ALL",MessageTopic.GUEST_CHECK_IN="GUEST_CHECK_IN",MessageTopic.GUEST_LOAD_EVENT="GUEST_LOAD_EVENT",MessageTopic.HOST_ICE_START_REQUEST="HOST_ICE_START_REQUEST",MessageTopic.HOST_END_ICE_REQUEST="HOST_END_ICE_REQUEST",MessageTopic.HOST_RELOAD_REQUEST="HOST_RELOAD_REQUEST",MessageTopic.HOST_NAV_REQUEST="HOST_NAV_REQUEST",MessageTopic.NAV_REQUEST="NAV_REQUEST",MessageTopic.PROJECT_CREATED="PROJECT_CREATED",MessageTopic.PROJECT_UPDATED="PROJECT_UPDATED",MessageTopic.PROJECT_DELETED="PROJECT_DELETED",Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define("@craftercms/models",["exports"],factory):factory(((global=global||self).craftercms=global.craftercms||{},global.craftercms.models={}))}(this,function(exports){"use strict";var MessageScope,MessageTopic;(MessageScope=exports.MessageScope||(exports.MessageScope={})).ALL="ALL",MessageScope.Local="LOCAL",MessageScope.External="EXTERNAL",MessageScope.Broadcast="BROADCAST",(MessageTopic=exports.MessageTopic||(exports.MessageTopic={})).ALL="ALL",MessageTopic.GUEST_CHECK_IN="GUEST_CHECK_IN",MessageTopic.GUEST_LOAD_EVENT="GUEST_LOAD_EVENT",MessageTopic.HOST_ICE_START_REQUEST="HOST_ICE_START_REQUEST",MessageTopic.HOST_END_ICE_REQUEST="HOST_END_ICE_REQUEST",MessageTopic.HOST_RELOAD_REQUEST="HOST_RELOAD_REQUEST",MessageTopic.HOST_NAV_REQUEST="HOST_NAV_REQUEST",MessageTopic.NAV_REQUEST="NAV_REQUEST",MessageTopic.PROJECT_CREATED="PROJECT_CREATED",MessageTopic.PROJECT_UPDATED="PROJECT_UPDATED",MessageTopic.PROJECT_DELETED="PROJECT_DELETED",Object.defineProperty(exports,"__esModule",{value:!0})}); |
/* | ||
* Copyright (C) 2007-2018 Crafter Software Corporation. All rights reserved. | ||
* Copyright (C) 2007-2020 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* it under the terms of the GNU General Public License version 3 as published by | ||
* the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
@@ -55,20 +54,3 @@ /* | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export { MessageScope, MessageTopic }; | ||
//# sourceMappingURL=models.js.map |
/* | ||
* Copyright (C) 2007-2018 Crafter Software Corporation. All rights reserved. | ||
* Copyright (C) 2007-2020 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* it under the terms of the GNU General Public License version 3 as published by | ||
* the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
@@ -55,20 +54,3 @@ /* | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export { MessageScope, MessageTopic }; | ||
//# sourceMappingURL=models.js.map |
@@ -9,1 +9,2 @@ export * from './src/crafter-config'; | ||
export * from './src/message'; | ||
export * from './src/ContentInstance'; |
{ | ||
"name": "@craftercms/models", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Crafter CMS data model definitions", | ||
@@ -26,3 +26,14 @@ "main": "./bundles/models.umd.js", | ||
"build": "npm run build:ts && npm run rollup && npm run clean:ts" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^11.0.2", | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"rollup": "^1.31.1", | ||
"rollup-plugin-sourcemaps": "^0.5.0", | ||
"typescript": "^3.7.5", | ||
"uglify-es": "^3.3.9" | ||
}, | ||
"dependencies": { | ||
"tslib": "^1.10.0" | ||
} | ||
} |
189
README.md
# @craftercms/models | ||
This package contains data model definitions of different structures of Crafter CMS. This interfaces are useful when developing in typescript. | ||
This package contains data model definitions of different structures of Crafter CMS. This interfaces are useful when developing in TypeScript. | ||
@@ -11,188 +11,1 @@ ## Usage | ||
- Import and use the models you need | ||
## Models | ||
--- | ||
## - CrafterConfig | ||
Crafter configuration model for modules to work | ||
### Example | ||
- Default values: | ||
```json | ||
{ | ||
site: "editorial", | ||
searchId: "editorial", | ||
baseUrl: "http://localhost:8080" | ||
} | ||
``` | ||
- Defining an object of type CrafterConfig: | ||
```ts | ||
import { CrafterConfig } from "@craftercms/models"; | ||
const config: CrafterConfig = { | ||
site: "editorial", | ||
searchId: 'editorial' // if searchId is the same as site, this parameters is not needed | ||
baseUrl: "http://localhost:8090" | ||
}; | ||
``` | ||
## - Item | ||
Crafter item model with its base properties | ||
### Example | ||
- Defining an object of type Item: | ||
```ts | ||
import { Item } from "@craftercms/models"; | ||
const item: Item = { | ||
name: "index.xml", | ||
url: "/site/website/index.xml", | ||
descriptorUrl: "/site/website/index.xml", | ||
descriptorDom: { ... }, | ||
folder: false | ||
}; | ||
``` | ||
## - Descriptor | ||
Crafter descriptor model with its base properties | ||
### Example | ||
- Defining an object of type Descriptor: | ||
```ts | ||
import { Descriptor } from "@craftercms/models"; | ||
const item: Descriptor = { | ||
page: { ... } | ||
}; | ||
``` | ||
## - NavigationItem | ||
Crafter navigation item model with its base properties | ||
### Example | ||
- Defining an object of type NavigationItem: | ||
```ts | ||
import { NavigationItem } from "@craftercms/models"; | ||
const item: NavigationItem = { | ||
url: "/site/website", | ||
active: boolean, | ||
subItems: [ | ||
{ | ||
//Each Item is a NavigationItem | ||
} | ||
] | ||
}; | ||
``` | ||
## - StateContainer | ||
Describes the container of a redux state, with entries and optional childIds. | ||
### Example | ||
- Defining an object of type StateContainer: | ||
```ts | ||
import { StateContainer } from "@craftercms/models"; | ||
const item: StateContainer = { | ||
entries: { /* type = LookupTable */ }, | ||
loading: { /* type = LookupTable */ } | ||
childIds: { /* type = LookupTable */ } | ||
}; | ||
``` | ||
Every property value in a state container is a [LookupTable](#lookupTable) | ||
## - CrafterState | ||
Describes the crafter state, each entry is as [StateContainer](#stateContainer) | ||
### Example | ||
- Defining an object of type CrafterState: | ||
```ts | ||
import { CrafterState } from "@craftercms/models"; | ||
const item: CrafterState = { | ||
items: { /* type = StateContainer */ } | ||
}; | ||
``` | ||
## - CrafterNamespacedState | ||
Describes a namespaced state, with a [CrafterState](#CrafterState) under the namespace | ||
### Example | ||
- Defining an object of type CrafterNamespacedState: | ||
```ts | ||
import { CrafterNamespacedState } from "@craftercms/models"; | ||
const item: CrafterNamespacedState = { | ||
craftercms: { /* type = CrafterState */ } | ||
}; | ||
``` | ||
## - LookupTable | ||
Describes an object consisting on keys (item id property) and values (content itself) | ||
### Example | ||
- Defining an object of type LookupTable: | ||
```ts | ||
import { LookupTable } from "@craftercms/models"; | ||
const item: LookupTable = { | ||
/site/website/index.xml: { | ||
name: "index.xml", | ||
url: "/site/website/index.xml", | ||
descriptorUrl: "/site/website/index.xml", | ||
descriptorDom: { ... }, | ||
folder: false | ||
} | ||
}; | ||
``` | ||
## Utils | ||
--- | ||
## createLookupTable | ||
Creates a lookup table based on an array of items (of a type) and the items id identifier. | ||
### Example | ||
- Create a lookupTable of type Item: | ||
```ts | ||
import { createLookupTable } from "@craftercms/models"; | ||
import { Item } from "@craftercms/models"; | ||
// item (type Item) - Defined on previous example | ||
const channelsTable = createLookupTable<Item>([item], 'url'); | ||
``` | ||
The lookupTable will look like this: | ||
```json | ||
{ | ||
/site/website/index.xml: { | ||
name: "index.xml", | ||
url: "/site/website/index.xml", | ||
descriptorUrl: "/site/website/index.xml", | ||
descriptorDom: { ... }, | ||
folder: false | ||
} | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
77880
69
800
1
6
11
1
+ Addedtslib@^1.10.0
+ Addedtslib@1.14.1(transitive)