@furo/open-models 0.0.0-alpha.0

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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/dist/CustomPrototypes.d.ts +6 -0
  4. package/dist/CustomPrototypes.js +4 -0
  5. package/dist/CustomPrototypes.js.map +1 -0
  6. package/dist/FDM_OPTIONS.d.ts +16 -0
  7. package/dist/FDM_OPTIONS.js +8 -0
  8. package/dist/FDM_OPTIONS.js.map +1 -0
  9. package/dist/FieldConstraints.d.ts +15 -0
  10. package/dist/FieldConstraints.js +3 -0
  11. package/dist/FieldConstraints.js.map +1 -0
  12. package/dist/FieldNode.d.ts +339 -0
  13. package/dist/FieldNode.js +835 -0
  14. package/dist/FieldNode.js.map +1 -0
  15. package/dist/OM_OPTIONS.d.ts +16 -0
  16. package/dist/OM_OPTIONS.js +8 -0
  17. package/dist/OM_OPTIONS.js.map +1 -0
  18. package/dist/OPEN_MODELS_OPTIONS.d.ts +16 -0
  19. package/dist/OPEN_MODELS_OPTIONS.js +8 -0
  20. package/dist/OPEN_MODELS_OPTIONS.js.map +1 -0
  21. package/dist/OPTIONS.d.ts +16 -0
  22. package/dist/OPTIONS.js +8 -0
  23. package/dist/OPTIONS.js.map +1 -0
  24. package/dist/Registry.d.ts +17 -0
  25. package/dist/Registry.js +29 -0
  26. package/dist/Registry.js.map +1 -0
  27. package/dist/Validator.d.ts +7 -0
  28. package/dist/Validator.js +3 -0
  29. package/dist/Validator.js.map +1 -0
  30. package/dist/ValueState.d.ts +37 -0
  31. package/dist/ValueState.js +39 -0
  32. package/dist/ValueState.js.map +1 -0
  33. package/dist/index.d.ts +21 -0
  34. package/dist/index.js +19 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/primitives/BOOLEAN.d.ts +14 -0
  37. package/dist/primitives/BOOLEAN.js +56 -0
  38. package/dist/primitives/BOOLEAN.js.map +1 -0
  39. package/dist/primitives/ENUM.d.ts +17 -0
  40. package/dist/primitives/ENUM.js +76 -0
  41. package/dist/primitives/ENUM.js.map +1 -0
  42. package/dist/primitives/INT32.d.ts +18 -0
  43. package/dist/primitives/INT32.js +98 -0
  44. package/dist/primitives/INT32.js.map +1 -0
  45. package/dist/primitives/STRING.d.ts +16 -0
  46. package/dist/primitives/STRING.js +99 -0
  47. package/dist/primitives/STRING.js.map +1 -0
  48. package/dist/proxies/ARRAY.d.ts +165 -0
  49. package/dist/proxies/ARRAY.js +398 -0
  50. package/dist/proxies/ARRAY.js.map +1 -0
  51. package/dist/proxies/MAP.d.ts +101 -0
  52. package/dist/proxies/MAP.js +225 -0
  53. package/dist/proxies/MAP.js.map +1 -0
  54. package/dist/proxies/RECURSION.d.ts +13 -0
  55. package/dist/proxies/RECURSION.js +51 -0
  56. package/dist/proxies/RECURSION.js.map +1 -0
  57. package/dist/well_known/ANY.d.ts +20 -0
  58. package/dist/well_known/ANY.js +91 -0
  59. package/dist/well_known/ANY.js.map +1 -0
  60. package/dist/well_known/Int32Value.d.ts +17 -0
  61. package/dist/well_known/Int32Value.js +115 -0
  62. package/dist/well_known/Int32Value.js.map +1 -0
  63. package/dist/well_known/Int64Value.d.ts +16 -0
  64. package/dist/well_known/Int64Value.js +105 -0
  65. package/dist/well_known/Int64Value.js.map +1 -0
  66. package/package.json +83 -0
@@ -0,0 +1,105 @@
1
+ import { FieldNode } from '../FieldNode.js';
2
+ import { Registry } from '../Registry.js';
3
+ import { OPEN_MODELS_OPTIONS } from '../OPEN_MODELS_OPTIONS.js';
4
+ export class Int64Value extends FieldNode {
5
+ get value() {
6
+ return this._value;
7
+ }
8
+ set value(value) {
9
+ this._value = value;
10
+ if (OPEN_MODELS_OPTIONS.EmitDefaultValues ||
11
+ OPEN_MODELS_OPTIONS.EmitUnpopulated) {
12
+ this.__isEmpty = false;
13
+ }
14
+ else {
15
+ this.__isEmpty = value === null;
16
+ }
17
+ this.__climbUpValidation();
18
+ this.__notifyFieldValueChange(true);
19
+ }
20
+ constructor(initData, parent, parentAttributeName) {
21
+ super(undefined, parent, parentAttributeName);
22
+ this._value = null;
23
+ this.__isEmpty = !(OPEN_MODELS_OPTIONS.EmitDefaultValues ||
24
+ OPEN_MODELS_OPTIONS.EmitUnpopulated);
25
+ this._value = Number.isInteger(initData) ? initData : null;
26
+ this.__meta.typeName = 'google.protobuf.Int64Value';
27
+ }
28
+ __updateWithLiteral(v) {
29
+ this._value = v;
30
+ if (OPEN_MODELS_OPTIONS.EmitDefaultValues ||
31
+ OPEN_MODELS_OPTIONS.EmitUnpopulated) {
32
+ this.__isEmpty = false;
33
+ }
34
+ else {
35
+ this.__isEmpty = v === null;
36
+ }
37
+ this.__notifyFieldValueChange(false);
38
+ }
39
+ // eslint-disable-next-line class-methods-use-this
40
+ __mapJsonToLiteral(data) {
41
+ return data;
42
+ }
43
+ __toJson() {
44
+ return this.__toLiteral();
45
+ }
46
+ valueOf() {
47
+ return this._value || NaN;
48
+ }
49
+ __toLiteral() {
50
+ return this._value;
51
+ }
52
+ __checkConstraints(fieldConstraints) {
53
+ // eslint-disable-next-line guard-for-in
54
+ for (const [constraint, value] of Object.entries(fieldConstraints)) {
55
+ if (constraint === 'maximum') {
56
+ // By default, the minimum and maximum values are included in the range. ">" is used to check.
57
+ if (fieldConstraints.exclusive_maximum &&
58
+ this._value !== null &&
59
+ this._value >= value) {
60
+ return ['constraint.violation.exclusive_maximum', value, this._value];
61
+ }
62
+ if (this._value !== null && this._value > value) {
63
+ return ['constraint.violation.maximum', value];
64
+ }
65
+ }
66
+ if (constraint === 'minimum') {
67
+ // By default, the minimum and maximum values are included in the range. "<" is used to check.
68
+ if (fieldConstraints.exclusive_minimum &&
69
+ this._value !== null &&
70
+ this._value <= value) {
71
+ return ['constraint.violation.exclusive_minimum', value, this._value];
72
+ }
73
+ if (this._value !== null && this._value < value) {
74
+ return ['constraint.violation.minimum', value];
75
+ }
76
+ }
77
+ if (constraint === 'multiple_of') {
78
+ // Use the multiple_of keyword to specify that a number must be the multiple of another number
79
+ // use this to define the step ??
80
+ if (this._value !== null && this._value % value !== 0) {
81
+ return ['constraint.violation.multiple_of', value];
82
+ }
83
+ }
84
+ if (constraint === 'required') {
85
+ if (this._value === null) {
86
+ return ['constraint.violation.required'];
87
+ }
88
+ }
89
+ }
90
+ return undefined;
91
+ }
92
+ toString() {
93
+ if (this._value !== null && !Number.isNaN(this._value)) {
94
+ return this._value.toString();
95
+ }
96
+ return '';
97
+ }
98
+ __clear() {
99
+ this._value = null;
100
+ this.__isEmpty = !(OPEN_MODELS_OPTIONS.EmitDefaultValues ||
101
+ OPEN_MODELS_OPTIONS.EmitUnpopulated);
102
+ }
103
+ }
104
+ Registry.register('Int64Value', Int64Value);
105
+ //# sourceMappingURL=Int64Value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Int64Value.js","sourceRoot":"","sources":["../../src/well_known/Int64Value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,OAAO,UAAW,SAAQ,SAAS;IACvC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,KAAoB;QAC5B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IACE,mBAAmB,CAAC,iBAAiB;YACrC,mBAAmB,CAAC,eAAe,EACnC,CAAC;YACD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,GAAG,KAAK,KAAK,IAAI,CAAC;QAClC,CAAC;QAED,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAID,YACE,QAAwB,EACx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AED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACvD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAChC,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,CAAC,CAChB,mBAAmB,CAAC,iBAAiB;YACrC,mBAAmB,CAAC,eAAe,CACpC,CAAC;IACJ,CAAC;CACF;AAED,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { FieldNode } from '../FieldNode';\nimport { Registry } from '../Registry';\nimport { FieldConstraints } from '../FieldConstraints';\nimport { OPEN_MODELS_OPTIONS } from '../OPEN_MODELS_OPTIONS';\n\nexport class Int64Value extends FieldNode {\n get value(): number | null {\n return this._value;\n }\n\n set value(value: number | null) {\n this._value = value;\n if (\n OPEN_MODELS_OPTIONS.EmitDefaultValues ||\n OPEN_MODELS_OPTIONS.EmitUnpopulated\n ) {\n this.__isEmpty = false;\n } else {\n this.__isEmpty = value === null;\n }\n\n this.__climbUpValidation();\n this.__notifyFieldValueChange(true);\n }\n\n public _value: number | null = null;\n\n constructor(\n initData?: number | null,\n parent?: FieldNode,\n parentAttributeName?: string,\n ) {\n super(undefined, parent, parentAttributeName);\n\n this.__isEmpty = !(\n OPEN_MODELS_OPTIONS.EmitDefaultValues ||\n OPEN_MODELS_OPTIONS.EmitUnpopulated\n );\n this._value = Number.isInteger(initData) ? (initData as number) : null;\n this.__meta.typeName = 'google.protobuf.Int64Value';\n }\n\n __updateWithLiteral(v: number | null) {\n this._value = v;\n if (\n OPEN_MODELS_OPTIONS.EmitDefaultValues ||\n OPEN_MODELS_OPTIONS.EmitUnpopulated\n ) {\n this.__isEmpty = false;\n } else {\n this.__isEmpty = v === null;\n }\n this.__notifyFieldValueChange(false);\n }\n\n // eslint-disable-next-line class-methods-use-this\n __mapJsonToLiteral(data: number): number {\n return data;\n }\n\n __toJson(): number | null {\n return this.__toLiteral();\n }\n\n valueOf(): number {\n return this._value || NaN;\n }\n\n __toLiteral() {\n return this._value;\n }\n\n protected __checkConstraints(\n fieldConstraints: FieldConstraints,\n ): string[] | undefined {\n // eslint-disable-next-line guard-for-in\n for (const [constraint, value] of Object.entries(fieldConstraints)) {\n if (constraint === 'maximum') {\n // By default, the minimum and maximum values are included in the range. \">\" is used to check.\n if (\n fieldConstraints.exclusive_maximum &&\n this._value !== null &&\n this._value >= value\n ) {\n return ['constraint.violation.exclusive_maximum', value, this._value];\n }\n if (this._value !== null && this._value > value) {\n return ['constraint.violation.maximum', value];\n }\n }\n if (constraint === 'minimum') {\n // By default, the minimum and maximum values are included in the range. \"<\" is used to check.\n if (\n fieldConstraints.exclusive_minimum &&\n this._value !== null &&\n this._value <= value\n ) {\n return ['constraint.violation.exclusive_minimum', value, this._value];\n }\n if (this._value !== null && this._value < value) {\n return ['constraint.violation.minimum', value];\n }\n }\n if (constraint === 'multiple_of') {\n // Use the multiple_of keyword to specify that a number must be the multiple of another number\n // use this to define the step ??\n if (this._value !== null && this._value % value !== 0) {\n return ['constraint.violation.multiple_of', value];\n }\n }\n if (constraint === 'required') {\n if (this._value === null) {\n return ['constraint.violation.required'];\n }\n }\n }\n\n return undefined;\n }\n\n toString(): string {\n if (this._value !== null && !Number.isNaN(this._value)) {\n return this._value.toString();\n }\n return '';\n }\n\n __clear() {\n this._value = null;\n this.__isEmpty = !(\n OPEN_MODELS_OPTIONS.EmitDefaultValues ||\n OPEN_MODELS_OPTIONS.EmitUnpopulated\n );\n }\n}\n\nRegistry.register('Int64Value', Int64Value);\n"]}
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@furo/open-models",
3
+ "description": "open-models ",
4
+ "license": "MIT",
5
+ "homepage": "https://github.com/eclipse/eclipsefuro-web/tree/main/packages",
6
+ "repository": "git@github.com:eclipse/eclipsefuro-web.git",
7
+ "author": "eclipse furo",
8
+ "version": "0.0.0-alpha.0",
9
+ "type": "module",
10
+ "main": "dist/index.js",
11
+ "module": "dist/index.js",
12
+ "scripts": {
13
+ "start": "npm run build && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"tsc -p ./tsconfig.test.components.json --watch --preserveWatchOutput\" \"web-dev-server\"",
14
+ "build": "npm run build:src && npm run build:transport && npm run build:model",
15
+ "build:src": "tsc && tsc-alias -p ./tsconfig.json",
16
+ "build:model": "tsc -p ./tsconfig.models.json && tsc-alias -p ./tsconfig.models.json",
17
+ "build:pages:components": "tsc -p ./tsconfig.test.components.json && tsc-alias -p ./tsconfig.test.components.json",
18
+ "build:transport": "tsc -p ./tsconfig.transport.json && tsc-alias -p ./tsconfig.transport.json",
19
+ "buf:transport": "buf generate",
20
+ "clean": "rm -rf ./dist && rm -rf ./test/.test && rm -rf ./coverage",
21
+ "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
22
+ "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
23
+ "prepare": "husky",
24
+ "test": "rm -rf test/.unit_tests && npm run build && tsc -p ./test/unit_tests && wtr --coverage",
25
+ "test:watch": "rm -rf test/.unit_tests && npm run build && tsc -p ./test/unit_tests && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"tsc -p ./tsconfig.models.json --watch --preserveWatchOutput\" \"tsc -p ./test/unit_tests --watch --preserveWatchOutput\" \"wtr --watch\"",
26
+ "bootstrap": "npm install && npm link && npm link @furo/open-models"
27
+ },
28
+ "dependencies": {
29
+
30
+ },
31
+ "files": [
32
+ "./dist/*",
33
+ "./dist/primitives",
34
+ "./dist/proxies",
35
+ "./dist/well_known",
36
+ "icon.svg",
37
+ "README.md",
38
+ "custom-elements.json",
39
+ "web-types.json"
40
+ ],
41
+ "devDependencies": {
42
+ "lit": "^3.1.4",
43
+ "@bufbuild/buf": "^1.38.0",
44
+ "@bufbuild/protobuf": "^2.0.0",
45
+ "@bufbuild/protoc-gen-es": "^2.0.0",
46
+ "@custom-elements-manifest/analyzer": "^0.10.3",
47
+ "@furo/fbp": "^6.13.0",
48
+ "@open-wc/eslint-config": "^12.0.3",
49
+ "@open-wc/testing": "^4.0.0",
50
+ "@rollup/plugin-json": "^6.1.0",
51
+ "@rollup/plugin-replace": "^5.0.7",
52
+ "@types/mocha": "^10.0.7",
53
+ "@typescript-eslint/eslint-plugin": "^7.16.1",
54
+ "@typescript-eslint/parser": "^7.16.0",
55
+ "@web/dev-server": "^0.4.6",
56
+ "@web/test-runner": "^0.18.2",
57
+ "@web/test-runner-junit-reporter": "^0.7.1",
58
+ "@web/test-runner-playwright": "^0.11.0",
59
+ "concurrently": "^8.2.2",
60
+ "eslint": "^8.57.0",
61
+ "eslint-config-prettier": "^9.1.0",
62
+ "husky": "^9.0.11",
63
+ "lint-staged": "^15.2.7",
64
+ "prettier": "^3.3.2",
65
+ "ts-proto": "^1.181.1",
66
+ "tslib": "^2.6.3",
67
+ "typescript": "^5.5.3"
68
+ },
69
+ "customElements": "custom-elements.json",
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
73
+ "prettier": {
74
+ "singleQuote": true,
75
+ "arrowParens": "avoid"
76
+ },
77
+ "lint-staged": {
78
+ "*.ts": [
79
+ "eslint --fix",
80
+ "prettier --write"
81
+ ]
82
+ }
83
+ }