@live-change/locale-settings-service 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/definition.js +12 -0
  2. package/index.js +57 -0
  3. package/package.json +29 -0
package/definition.js ADDED
@@ -0,0 +1,12 @@
1
+ import App from '@live-change/framework'
2
+ const app = App.app()
3
+
4
+ import relationsPlugin from '@live-change/relations-plugin'
5
+ import userService from '@live-change/user-service'
6
+
7
+ const definition = app.createServiceDefinition({
8
+ name: "localeSettings",
9
+ use: [ relationsPlugin, userService ]
10
+ })
11
+
12
+ export default definition
package/index.js ADDED
@@ -0,0 +1,57 @@
1
+ import App from '@live-change/framework'
2
+ const app = App.app()
3
+
4
+ import definition from './definition.js'
5
+
6
+ const LocaleSettings = definition.model({
7
+ name: 'LocaleSettings',
8
+ sessionOrUserProperty: {
9
+ ownerReadAccess: () => true,
10
+ ownerWriteAccess: () => true,
11
+ },
12
+ properties: {
13
+ locale: {
14
+ type: String,
15
+ validation: ['nonEmpty']
16
+ },
17
+ timeZone: {
18
+ type: String,
19
+ validation: ['nonEmpty']
20
+ },
21
+ language: {
22
+ type: String,
23
+ validation: ['nonEmpty']
24
+ },
25
+ currency: {
26
+ type: String,
27
+ validation: ['nonEmpty']
28
+ }
29
+ }
30
+ })
31
+
32
+ definition.view({
33
+ name: "localeSettings",
34
+ global: true,
35
+ internal: true,
36
+ properties: {
37
+ sessionOrUserType: {
38
+ type: String,
39
+ validation: ['nonEmpty']
40
+ },
41
+ sessionOrUser: {
42
+ validation: ['nonEmpty']
43
+ }
44
+ },
45
+ returns: {
46
+ type: Object
47
+ },
48
+ async daoPath({ sessionOrUserType, sessionOrUser }, { client, service }) {
49
+ const owner = [sessionOrUserType, sessionOrUser]
50
+ const id = owner.map(p => JSON.stringify(p)).join(':')
51
+ return LocaleSettings.path(id)
52
+ }
53
+ })
54
+
55
+ export { LocaleSettings }
56
+
57
+ export default definition
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@live-change/locale-settings-service",
3
+ "version": "0.8.9",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "NODE_ENV=test tape tests/*"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/live-change/live-change-services.git"
12
+ },
13
+ "license": "MIT",
14
+ "bugs": {
15
+ "url": "https://github.com/live-change/live-change-services/issues"
16
+ },
17
+ "homepage": "https://github.com/live-change/live-change-services",
18
+ "author": {
19
+ "email": "michal@laszczewski.pl",
20
+ "name": "Michał Łaszczewski",
21
+ "url": "https://www.viamage.com/"
22
+ },
23
+ "type": "module",
24
+ "dependencies": {
25
+ "@live-change/framework": "^0.8.9",
26
+ "@live-change/relations-plugin": "^0.8.9"
27
+ },
28
+ "gitHead": "362dd55bd2773195e4cefd84080c10bd9fbaaf45"
29
+ }