@furo/open-models 0.0.0-alpha.3 → 0.0.0-alpha.4
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/custom-elements.json +43 -0
- package/dist/RpcStatusApplier.d.ts +12 -0
- package/dist/RpcStatusApplier.js +21 -0
- package/dist/RpcStatusApplier.js.map +1 -0
- package/package.json +1 -1
- package/dist/FDM_OPTIONS.d.ts +0 -16
- package/dist/FDM_OPTIONS.js +0 -8
- package/dist/FDM_OPTIONS.js.map +0 -1
- package/dist/OM_OPTIONS.d.ts +0 -16
- package/dist/OM_OPTIONS.js +0 -8
- package/dist/OM_OPTIONS.js.map +0 -1
- package/dist/OPTIONS.d.ts +0 -16
- package/dist/OPTIONS.js +0 -8
- package/dist/OPTIONS.js.map +0 -1
package/custom-elements.json
CHANGED
|
@@ -976,6 +976,49 @@
|
|
|
976
976
|
}
|
|
977
977
|
]
|
|
978
978
|
},
|
|
979
|
+
{
|
|
980
|
+
"kind": "javascript-module",
|
|
981
|
+
"path": "src/RpcStatusApplier.ts",
|
|
982
|
+
"declarations": [
|
|
983
|
+
{
|
|
984
|
+
"kind": "class",
|
|
985
|
+
"description": "",
|
|
986
|
+
"name": "RpcStatusApplier",
|
|
987
|
+
"members": [
|
|
988
|
+
{
|
|
989
|
+
"kind": "method",
|
|
990
|
+
"name": "apply",
|
|
991
|
+
"privacy": "public",
|
|
992
|
+
"static": true,
|
|
993
|
+
"parameters": [
|
|
994
|
+
{
|
|
995
|
+
"name": "target",
|
|
996
|
+
"type": {
|
|
997
|
+
"text": "FieldNode"
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
"name": "status",
|
|
1002
|
+
"type": {
|
|
1003
|
+
"text": "IStatus"
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
]
|
|
1007
|
+
}
|
|
1008
|
+
]
|
|
1009
|
+
}
|
|
1010
|
+
],
|
|
1011
|
+
"exports": [
|
|
1012
|
+
{
|
|
1013
|
+
"kind": "js",
|
|
1014
|
+
"name": "RpcStatusApplier",
|
|
1015
|
+
"declaration": {
|
|
1016
|
+
"name": "RpcStatusApplier",
|
|
1017
|
+
"module": "src/RpcStatusApplier.ts"
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
]
|
|
1021
|
+
},
|
|
979
1022
|
{
|
|
980
1023
|
"kind": "javascript-module",
|
|
981
1024
|
"path": "src/Validator.ts",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FieldNode } from './FieldNode.js';
|
|
2
|
+
import { IAny } from './index.js';
|
|
3
|
+
interface IStatus {
|
|
4
|
+
error: string;
|
|
5
|
+
message: string;
|
|
6
|
+
code: number;
|
|
7
|
+
details: IAny[];
|
|
8
|
+
}
|
|
9
|
+
export declare class RpcStatusApplier {
|
|
10
|
+
static apply(target: FieldNode, status: IStatus): void;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ValueState } from './ValueState.js';
|
|
2
|
+
export class RpcStatusApplier {
|
|
3
|
+
static apply(target, status) {
|
|
4
|
+
const localizedMessage = status.details.filter(lm => lm['@type'] === 'type.googleapis.com/google.rpc.LocalizedMessage')[0];
|
|
5
|
+
if (localizedMessage) {
|
|
6
|
+
target.__setValueState(ValueState.Error, [localizedMessage.message]);
|
|
7
|
+
}
|
|
8
|
+
const badRequest = status.details.filter(lm => lm['@type'] === 'type.googleapis.com/google.rpc.BadRequest')[0];
|
|
9
|
+
if (badRequest) {
|
|
10
|
+
const v = badRequest.field_violations.map(violation => {
|
|
11
|
+
return {
|
|
12
|
+
field: violation.field,
|
|
13
|
+
state: ValueState.Error,
|
|
14
|
+
message: violation.description
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
target.__applyValueStates(...v);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=RpcStatusApplier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RpcStatusApplier.js","sourceRoot":"","sources":["../src/RpcStatusApplier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU1C,MAAM,OAAO,gBAAgB;IACpB,MAAM,CAAC,KAAK,CAAC,MAAiB,EAAE,MAAe;QACpD,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,iDAAiD,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3H,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,gBAAgB,CAAC,OAAiB,CAAC,CAAC,CAAC;QACjF,CAAC;QACD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,2CAA2C,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/G,IAAI,UAAU,EAAE,CAAC;YAEf,MAAM,CAAC,GAAI,UAAU,CAAC,gBAA8B,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;gBAAE,OAAO;oBAC5E,KAAK,EAAG,SAAoC,CAAC,KAAK;oBAClD,KAAK,EAAE,UAAU,CAAC,KAAK;oBACvB,OAAO,EAAG,SAAoC,CAAC,WAAW;iBAC3D,CAAA;YAAA,CAAC,CAAwB,CAAA;YAG1B,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;QAElC,CAAC;IAEH,CAAC;CACF","sourcesContent":["import { FieldNode, ValueStateSummary } from './FieldNode';\nimport { ValueState } from './ValueState';\nimport { IAny } from './index';\n\ninterface IStatus {\n error: string;\n message: string;\n code: number;\n details: IAny[];\n}\n\nexport class RpcStatusApplier {\n public static apply(target: FieldNode, status: IStatus) {\n const localizedMessage = status.details.filter(lm => lm['@type'] === 'type.googleapis.com/google.rpc.LocalizedMessage')[0];\n if (localizedMessage) {\n target.__setValueState(ValueState.Error, [localizedMessage.message as string]);\n }\n const badRequest = status.details.filter(lm => lm['@type'] === 'type.googleapis.com/google.rpc.BadRequest')[0];\n if (badRequest) {\n\n const v = (badRequest.field_violations as unknown[]).map(violation => {return {\n field: (violation as Record<string, string>).field,\n state: ValueState.Error,\n message: (violation as Record<string, string>).description\n }}) as ValueStateSummary[]\n\n\n target.__applyValueStates(...v);\n\n }\n\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"homepage": "https://github.com/eclipse/eclipsefuro-web/tree/main/packages",
|
|
6
6
|
"repository": "git@github.com:eclipse/eclipsefuro-web.git",
|
|
7
7
|
"author": "eclipse furo",
|
|
8
|
-
"version": "0.0.0-alpha.
|
|
8
|
+
"version": "0.0.0-alpha.4",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"module": "dist/index.js",
|
package/dist/FDM_OPTIONS.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface Options {
|
|
2
|
-
UseProtoNames: boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Replace with your own label formatter, if you want to use translations for the labels.
|
|
5
|
-
* @param key
|
|
6
|
-
*/
|
|
7
|
-
labelFormatter: (key: string) => string;
|
|
8
|
-
EmitUnpopulated: boolean;
|
|
9
|
-
EmitDefaultValues: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Use this method to translate the value state messages.
|
|
12
|
-
* @param key
|
|
13
|
-
*/
|
|
14
|
-
valueStateMessageFormatter: (key: string[]) => string;
|
|
15
|
-
}
|
|
16
|
-
export declare const FDM_OPTIONS: Options;
|
package/dist/FDM_OPTIONS.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const FDM_OPTIONS = {
|
|
2
|
-
UseProtoNames: true,
|
|
3
|
-
labelFormatter: key => key.replaceAll('.', '_').toUpperCase(),
|
|
4
|
-
EmitDefaultValues: false,
|
|
5
|
-
EmitUnpopulated: false,
|
|
6
|
-
valueStateMessageFormatter: key => key.join(' '),
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=FDM_OPTIONS.js.map
|
package/dist/FDM_OPTIONS.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FDM_OPTIONS.js","sourceRoot":"","sources":["../src/FDM_OPTIONS.ts"],"names":[],"mappings":"AAuDA,MAAM,CAAC,MAAM,WAAW,GAAY;IAClC,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE;IAC7D,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,KAAK;IACtB,0BAA0B,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;CACjD,CAAC","sourcesContent":["export interface Options {\n\n // UseProtoNames uses proto field name instead of lowerCamelCase name in JSON\n // field names.\n // UseProtoNames bool\n UseProtoNames: boolean;\n /**\n * Replace with your own label formatter, if you want to use translations for the labels.\n * @param key\n */\n labelFormatter: (key: string) => string;\n\n // EmitUnpopulated specifies whether to emit unpopulated fields. It does not\n // emit unpopulated oneof fields or unpopulated extension fields.\n // The JSON value emitted for unpopulated fields are as follows:\n // ╔═══════╤════════════════════════════╗\n // ║ JSON │ Protobuf field ║\n // ╠═══════╪════════════════════════════╣\n // ║ false │ proto3 boolean fields ║\n // ║ 0 │ proto3 numeric fields ║\n // ║ \"\" │ proto3 string/bytes fields ║\n // ║ null │ proto2 scalar fields ║\n // ║ null │ message fields ║\n // ║ [] │ list fields ║\n // ║ {} │ map fields ║\n // ╚═══════╧════════════════════════════╝\n EmitUnpopulated: boolean;\n\n // EmitDefaultValues specifies whether to emit default-valued primitive fields,\n // empty lists, and empty maps. The fields affected are as follows:\n // ╔═══════╤════════════════════════════════════════╗\n // ║ JSON │ Protobuf field ║\n // ╠═══════╪════════════════════════════════════════╣\n // ║ false │ non-optional scalar boolean fields ║\n // ║ 0 │ non-optional scalar numeric fields ║\n // ║ \"\" │ non-optional scalar string/byte fields ║\n // ║ [] │ empty repeated fields ║\n // ║ {} │ empty map fields ║\n // ╚═══════╧════════════════════════════════════════╝\n //\n // Behaves similarly to EmitUnpopulated, but does not emit \"null\"-value fields,\n // i.e. presence-sensing fields that are omitted will remain omitted to preserve\n // presence-sensing.\n // EmitUnpopulated takes precedence over EmitDefaultValues since the former generates\n // a strict superset of the latter.\n // EmitDefaultValues: boolean;\n\n EmitDefaultValues: boolean;\n /**\n * Use this method to translate the value state messages.\n * @param key\n */\n valueStateMessageFormatter: (key: string[]) => string;\n}\n\nexport const FDM_OPTIONS: Options = {\n UseProtoNames: true,\n labelFormatter: key => key.replaceAll('.', '_').toUpperCase(),\n EmitDefaultValues: false,\n EmitUnpopulated: false,\n valueStateMessageFormatter: key => key.join(' '),\n};\n"]}
|
package/dist/OM_OPTIONS.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface Options {
|
|
2
|
-
UseProtoNames: boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Replace with your own label formatter, if you want to use translations for the labels.
|
|
5
|
-
* @param key
|
|
6
|
-
*/
|
|
7
|
-
labelFormatter: (key: string) => string;
|
|
8
|
-
EmitUnpopulated: boolean;
|
|
9
|
-
EmitDefaultValues: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Use this method to translate the value state messages.
|
|
12
|
-
* @param key
|
|
13
|
-
*/
|
|
14
|
-
valueStateMessageFormatter: (key: string[]) => string;
|
|
15
|
-
}
|
|
16
|
-
export declare const FDM_OPTIONS: Options;
|
package/dist/OM_OPTIONS.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const FDM_OPTIONS = {
|
|
2
|
-
UseProtoNames: true,
|
|
3
|
-
labelFormatter: key => key.replaceAll('.', '_').toUpperCase(),
|
|
4
|
-
EmitDefaultValues: false,
|
|
5
|
-
EmitUnpopulated: false,
|
|
6
|
-
valueStateMessageFormatter: key => key.join(' '),
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=OM_OPTIONS.js.map
|
package/dist/OM_OPTIONS.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OM_OPTIONS.js","sourceRoot":"","sources":["../src/OM_OPTIONS.ts"],"names":[],"mappings":"AAuDA,MAAM,CAAC,MAAM,WAAW,GAAY;IAClC,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE;IAC7D,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,KAAK;IACtB,0BAA0B,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;CACjD,CAAC","sourcesContent":["export interface Options {\n\n // UseProtoNames uses proto field name instead of lowerCamelCase name in JSON\n // field names.\n // UseProtoNames bool\n UseProtoNames: boolean;\n /**\n * Replace with your own label formatter, if you want to use translations for the labels.\n * @param key\n */\n labelFormatter: (key: string) => string;\n\n // EmitUnpopulated specifies whether to emit unpopulated fields. It does not\n // emit unpopulated oneof fields or unpopulated extension fields.\n // The JSON value emitted for unpopulated fields are as follows:\n // ╔═══════╤════════════════════════════╗\n // ║ JSON │ Protobuf field ║\n // ╠═══════╪════════════════════════════╣\n // ║ false │ proto3 boolean fields ║\n // ║ 0 │ proto3 numeric fields ║\n // ║ \"\" │ proto3 string/bytes fields ║\n // ║ null │ proto2 scalar fields ║\n // ║ null │ message fields ║\n // ║ [] │ list fields ║\n // ║ {} │ map fields ║\n // ╚═══════╧════════════════════════════╝\n EmitUnpopulated: boolean;\n\n // EmitDefaultValues specifies whether to emit default-valued primitive fields,\n // empty lists, and empty maps. The fields affected are as follows:\n // ╔═══════╤════════════════════════════════════════╗\n // ║ JSON │ Protobuf field ║\n // ╠═══════╪════════════════════════════════════════╣\n // ║ false │ non-optional scalar boolean fields ║\n // ║ 0 │ non-optional scalar numeric fields ║\n // ║ \"\" │ non-optional scalar string/byte fields ║\n // ║ [] │ empty repeated fields ║\n // ║ {} │ empty map fields ║\n // ╚═══════╧════════════════════════════════════════╝\n //\n // Behaves similarly to EmitUnpopulated, but does not emit \"null\"-value fields,\n // i.e. presence-sensing fields that are omitted will remain omitted to preserve\n // presence-sensing.\n // EmitUnpopulated takes precedence over EmitDefaultValues since the former generates\n // a strict superset of the latter.\n // EmitDefaultValues: boolean;\n\n EmitDefaultValues: boolean;\n /**\n * Use this method to translate the value state messages.\n * @param key\n */\n valueStateMessageFormatter: (key: string[]) => string;\n}\n\nexport const FDM_OPTIONS: Options = {\n UseProtoNames: true,\n labelFormatter: key => key.replaceAll('.', '_').toUpperCase(),\n EmitDefaultValues: false,\n EmitUnpopulated: false,\n valueStateMessageFormatter: key => key.join(' '),\n};\n"]}
|
package/dist/OPTIONS.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface Options {
|
|
2
|
-
UseProtoNames: boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Replace with your own label formatter, if you want to use translations for the labels.
|
|
5
|
-
* @param key
|
|
6
|
-
*/
|
|
7
|
-
labelFormatter: (key: string) => string;
|
|
8
|
-
EmitUnpopulated: boolean;
|
|
9
|
-
EmitDefaultValues: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Use this method to translate the value state messages.
|
|
12
|
-
* @param key
|
|
13
|
-
*/
|
|
14
|
-
valueStateMessageFormatter: (key: string[]) => string;
|
|
15
|
-
}
|
|
16
|
-
export declare const FDM_OPTIONS: Options;
|
package/dist/OPTIONS.js
DELETED
package/dist/OPTIONS.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OPTIONS.js","sourceRoot":"","sources":["../src/OPTIONS.ts"],"names":[],"mappings":"AAuDA,MAAM,CAAC,MAAM,WAAW,GAAY;IAClC,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE;IAC7D,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,KAAK;IACtB,0BAA0B,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;CACjD,CAAC","sourcesContent":["export interface Options {\n\n // UseProtoNames uses proto field name instead of lowerCamelCase name in JSON\n // field names.\n // UseProtoNames bool\n UseProtoNames: boolean;\n /**\n * Replace with your own label formatter, if you want to use translations for the labels.\n * @param key\n */\n labelFormatter: (key: string) => string;\n\n // EmitUnpopulated specifies whether to emit unpopulated fields. It does not\n // emit unpopulated oneof fields or unpopulated extension fields.\n // The JSON value emitted for unpopulated fields are as follows:\n // ╔═══════╤════════════════════════════╗\n // ║ JSON │ Protobuf field ║\n // ╠═══════╪════════════════════════════╣\n // ║ false │ proto3 boolean fields ║\n // ║ 0 │ proto3 numeric fields ║\n // ║ \"\" │ proto3 string/bytes fields ║\n // ║ null │ proto2 scalar fields ║\n // ║ null │ message fields ║\n // ║ [] │ list fields ║\n // ║ {} │ map fields ║\n // ╚═══════╧════════════════════════════╝\n EmitUnpopulated: boolean;\n\n // EmitDefaultValues specifies whether to emit default-valued primitive fields,\n // empty lists, and empty maps. The fields affected are as follows:\n // ╔═══════╤════════════════════════════════════════╗\n // ║ JSON │ Protobuf field ║\n // ╠═══════╪════════════════════════════════════════╣\n // ║ false │ non-optional scalar boolean fields ║\n // ║ 0 │ non-optional scalar numeric fields ║\n // ║ \"\" │ non-optional scalar string/byte fields ║\n // ║ [] │ empty repeated fields ║\n // ║ {} │ empty map fields ║\n // ╚═══════╧════════════════════════════════════════╝\n //\n // Behaves similarly to EmitUnpopulated, but does not emit \"null\"-value fields,\n // i.e. presence-sensing fields that are omitted will remain omitted to preserve\n // presence-sensing.\n // EmitUnpopulated takes precedence over EmitDefaultValues since the former generates\n // a strict superset of the latter.\n // EmitDefaultValues: boolean;\n\n EmitDefaultValues: boolean;\n /**\n * Use this method to translate the value state messages.\n * @param key\n */\n valueStateMessageFormatter: (key: string[]) => string;\n}\n\nexport const FDM_OPTIONS: Options = {\n UseProtoNames: true,\n labelFormatter: key => key.replaceAll('.', '_').toUpperCase(),\n EmitDefaultValues: false,\n EmitUnpopulated: false,\n valueStateMessageFormatter: key => key.join(' '),\n};\n"]}
|