@lionweb/json-utils 0.6.13-beta.5
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/CHANGELOG.md +4 -0
- package/LICENSE +201 -0
- package/README.md +27 -0
- package/dist/ChunkUtils.d.ts +26 -0
- package/dist/ChunkUtils.d.ts.map +1 -0
- package/dist/ChunkUtils.js +46 -0
- package/dist/ChunkUtils.js.map +1 -0
- package/dist/JsonContext.d.ts +11 -0
- package/dist/JsonContext.d.ts.map +1 -0
- package/dist/JsonContext.js +25 -0
- package/dist/JsonContext.js.map +1 -0
- package/dist/LionWebJson.d.ts +8 -0
- package/dist/LionWebJson.d.ts.map +1 -0
- package/dist/LionWebJson.js +10 -0
- package/dist/LionWebJson.js.map +1 -0
- package/dist/LionWebJsonChunkWrapper.d.ts +39 -0
- package/dist/LionWebJsonChunkWrapper.d.ts.map +1 -0
- package/dist/LionWebJsonChunkWrapper.js +119 -0
- package/dist/LionWebJsonChunkWrapper.js.map +1 -0
- package/dist/M3definitions.d.ts +176 -0
- package/dist/M3definitions.d.ts.map +1 -0
- package/dist/M3definitions.js +174 -0
- package/dist/M3definitions.js.map +1 -0
- package/dist/NodeUtils.d.ts +23 -0
- package/dist/NodeUtils.d.ts.map +1 -0
- package/dist/NodeUtils.js +57 -0
- package/dist/NodeUtils.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2022 LionWeb Team
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# The `JSON-utils` package
|
|
2
|
+
|
|
3
|
+
[
|
|
4
|
+
](./LICENSE)
|
|
5
|
+
[
|
|
6
|
+
](https://github.com/LionWeb-io/lionweb-typescript/actions/workflows/test.yaml)
|
|
7
|
+
[
|
|
8
|
+
](https://www.npmjs.com/package/@lionweb/json-utils)
|
|
9
|
+
|
|
10
|
+
An NPM package that can be added to a Node.js/NPM codebase as follows:
|
|
11
|
+
|
|
12
|
+
```shell
|
|
13
|
+
$ npm add @lionweb/json-utils
|
|
14
|
+
```
|
|
15
|
+
It contains:
|
|
16
|
+
|
|
17
|
+
* Utilities ...
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Development
|
|
21
|
+
|
|
22
|
+
Build it from source as follows:
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
npm run build
|
|
26
|
+
```
|
|
27
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LionWebId, LionWebJsonChunk, LionWebJsonNode, LionWebJsonUsedLanguage, LionWebKey } from "@lionweb/json";
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for LionWeb chunks
|
|
4
|
+
*/
|
|
5
|
+
export declare class ChunkUtils {
|
|
6
|
+
/**
|
|
7
|
+
* Find a used language in `chunk` with `key`.
|
|
8
|
+
* @param chunk
|
|
9
|
+
* @param key
|
|
10
|
+
*/
|
|
11
|
+
static findLwUsedLanguage(chunk: LionWebJsonChunk, key: LionWebKey): LionWebJsonUsedLanguage | null;
|
|
12
|
+
/**
|
|
13
|
+
* Find a used language in `chunk` with `key` and 'version'.
|
|
14
|
+
* @param chunk
|
|
15
|
+
* @param key
|
|
16
|
+
* @param version
|
|
17
|
+
*/
|
|
18
|
+
static findLwUsedLanguageWithVersion(chunk: LionWebJsonChunk, key: LionWebKey, version: string): LionWebJsonUsedLanguage | null;
|
|
19
|
+
/**
|
|
20
|
+
* Find node with id equals `id` in `chunk`.
|
|
21
|
+
* @param chunk
|
|
22
|
+
* @param id
|
|
23
|
+
*/
|
|
24
|
+
static findNode(chunk: LionWebJsonChunk, id: LionWebId): LionWebJsonNode | null;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ChunkUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChunkUtils.d.ts","sourceRoot":"","sources":["../src/ChunkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,eAAe,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEjH;;GAEG;AACH,qBAAa,UAAU;IACnB;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,UAAU,GAAG,uBAAuB,GAAG,IAAI;IASnG;;;;;OAKG;IACH,MAAM,CAAC,6BAA6B,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI;IAS/H;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,SAAS,GAAG,eAAe,GAAG,IAAI;CAQlF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for LionWeb chunks
|
|
3
|
+
*/
|
|
4
|
+
export class ChunkUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Find a used language in `chunk` with `key`.
|
|
7
|
+
* @param chunk
|
|
8
|
+
* @param key
|
|
9
|
+
*/
|
|
10
|
+
static findLwUsedLanguage(chunk, key) {
|
|
11
|
+
for (const language of chunk.languages) {
|
|
12
|
+
if (language.key === key) {
|
|
13
|
+
return language;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Find a used language in `chunk` with `key` and 'version'.
|
|
20
|
+
* @param chunk
|
|
21
|
+
* @param key
|
|
22
|
+
* @param version
|
|
23
|
+
*/
|
|
24
|
+
static findLwUsedLanguageWithVersion(chunk, key, version) {
|
|
25
|
+
for (const language of chunk.languages) {
|
|
26
|
+
if (language.key === key && language.version === version) {
|
|
27
|
+
return language;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Find node with id equals `id` in `chunk`.
|
|
34
|
+
* @param chunk
|
|
35
|
+
* @param id
|
|
36
|
+
*/
|
|
37
|
+
static findNode(chunk, id) {
|
|
38
|
+
for (const node of chunk.nodes) {
|
|
39
|
+
if (node.id === id) {
|
|
40
|
+
return node;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=ChunkUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChunkUtils.js","sourceRoot":"","sources":["../src/ChunkUtils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,UAAU;IACnB;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAuB,EAAE,GAAe;QAC9D,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YACrC,IAAI,QAAQ,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gBACvB,OAAO,QAAQ,CAAA;YACnB,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,6BAA6B,CAAC,KAAuB,EAAE,GAAe,EAAE,OAAe;QAC1F,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YACrC,IAAI,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,QAAQ,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;gBACvD,OAAO,QAAQ,CAAA;YACnB,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAuB,EAAE,EAAa;QAClD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC7B,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;gBACjB,OAAO,IAAI,CAAA;YACf,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;CACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type JsonPath = (string | number)[];
|
|
2
|
+
export declare class JsonContext {
|
|
3
|
+
private parent;
|
|
4
|
+
private local_path;
|
|
5
|
+
concat(...items: JsonPath): JsonContext;
|
|
6
|
+
path(): JsonPath;
|
|
7
|
+
constructor(parent: JsonContext | null, path: JsonPath);
|
|
8
|
+
toString(): string;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=JsonContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonContext.d.ts","sourceRoot":"","sources":["../src/JsonContext.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;AAEnC,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,UAAU,CAAU;IAE5B,MAAM,CAAC,GAAG,KAAK,EAAE,QAAQ,GAAG,WAAW;IAIvC,IAAI,IAAI,QAAQ;gBAIJ,MAAM,EAAE,WAAW,GAAG,IAAI,EAAE,IAAI,EAAE,QAAQ;IAKtD,QAAQ,IAAI,MAAM;CAWrB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class JsonContext {
|
|
2
|
+
concat(...items) {
|
|
3
|
+
return new JsonContext(this, items);
|
|
4
|
+
}
|
|
5
|
+
path() {
|
|
6
|
+
return this.parent === null ? this.local_path : this.parent.path().concat(this.local_path);
|
|
7
|
+
}
|
|
8
|
+
constructor(parent, path) {
|
|
9
|
+
this.parent = parent;
|
|
10
|
+
this.local_path = path;
|
|
11
|
+
}
|
|
12
|
+
toString() {
|
|
13
|
+
let result = "";
|
|
14
|
+
this.path().forEach((part, index) => {
|
|
15
|
+
if (typeof part === "string") {
|
|
16
|
+
result += (index === 0 ? "" : ".") + part;
|
|
17
|
+
}
|
|
18
|
+
else if (typeof part === "number") {
|
|
19
|
+
result += "[" + part + "]";
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=JsonContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonContext.js","sourceRoot":"","sources":["../src/JsonContext.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,WAAW;IAIpB,MAAM,CAAC,GAAG,KAAe;QACrB,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACvC,CAAC;IAED,IAAI;QACA,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAC9F,CAAC;IAED,YAAY,MAA0B,EAAE,IAAc;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IAC1B,CAAC;IAED,QAAQ;QACJ,IAAI,MAAM,GAAG,EAAE,CAAA;QACf,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAChC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC3B,MAAM,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;YAC7C,CAAC;iBAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAClC,MAAM,IAAI,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;YAC9B,CAAC;QACL,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACjB,CAAC;CACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LionWebJsonUsedLanguage } from "@lionweb/json";
|
|
2
|
+
/**
|
|
3
|
+
* The types defining the structure of the LionWeb JSON format.
|
|
4
|
+
* @see https://lionweb-io.github.io/specification/serialization/serialization.html
|
|
5
|
+
* We use types instead of classes, because the purpose is to define the Lionweb JSON to be sent over the line.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isLionWebM3Language(language: LionWebJsonUsedLanguage): boolean;
|
|
8
|
+
//# sourceMappingURL=LionWebJson.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebJson.d.ts","sourceRoot":"","sources":["../src/LionWebJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAGvD;;;;GAIG;AAGH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,OAAO,CAE9E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LION_CORE_M3_KEY, LION_CORE_M3_VERSION } from "./M3definitions.js";
|
|
2
|
+
/**
|
|
3
|
+
* The types defining the structure of the LionWeb JSON format.
|
|
4
|
+
* @see https://lionweb-io.github.io/specification/serialization/serialization.html
|
|
5
|
+
* We use types instead of classes, because the purpose is to define the Lionweb JSON to be sent over the line.
|
|
6
|
+
*/
|
|
7
|
+
export function isLionWebM3Language(language) {
|
|
8
|
+
return language.key === LION_CORE_M3_KEY && language.version === LION_CORE_M3_VERSION;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=LionWebJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebJson.js","sourceRoot":"","sources":["../src/LionWebJson.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAE3E;;;;GAIG;AAGH,MAAM,UAAU,mBAAmB,CAAC,QAAiC;IACjE,OAAO,QAAQ,CAAC,GAAG,KAAK,gBAAgB,IAAI,QAAQ,CAAC,OAAO,KAAK,oBAAoB,CAAA;AACzF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LionWebId, LionWebJsonChunk, LionWebJsonContainment, LionWebJsonMetaPointer, LionWebJsonNode, LionWebJsonReference } from "@lionweb/json";
|
|
2
|
+
/**
|
|
3
|
+
* Wraps around a LionWebJsonChunk, providing access to information inside, might be using caches to improve performance.
|
|
4
|
+
* NB Make sure that the contents of the chunk are not changed after creating the wrapper!
|
|
5
|
+
* NB BE aware that with `pushChunk(...)` the original chunk will be changed.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LionWebJsonChunkWrapper {
|
|
8
|
+
jsonChunk: LionWebJsonChunk;
|
|
9
|
+
/**
|
|
10
|
+
* Map to get quick access to nodes by id.
|
|
11
|
+
* @protected
|
|
12
|
+
*/
|
|
13
|
+
protected nodesIdMap: Map<LionWebId, LionWebJsonNode>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a wrapper with `chunk` as its chunk
|
|
16
|
+
* @param chunk
|
|
17
|
+
*/
|
|
18
|
+
constructor(chunk: LionWebJsonChunk);
|
|
19
|
+
/** Put all nodes in a map, validate that there are no two nodes with the same id.
|
|
20
|
+
* The check should logically be in LionWebReferenceValidator, but the created map is needed here.
|
|
21
|
+
*/
|
|
22
|
+
prepareNodeIds(chunk: LionWebJsonChunk): void;
|
|
23
|
+
getNode(id: LionWebId): LionWebJsonNode | undefined;
|
|
24
|
+
findNodesOfClassifier(concept: LionWebJsonMetaPointer): LionWebJsonNode[];
|
|
25
|
+
/**
|
|
26
|
+
* Return the target nodes inside `reference` as a list of actual nodes (LionWebJsonNode[])
|
|
27
|
+
* @param reference
|
|
28
|
+
*/
|
|
29
|
+
getReferredNodes(reference: LionWebJsonReference | undefined): LionWebJsonNode[];
|
|
30
|
+
/**
|
|
31
|
+
* Return the target nodes inside `reference` as a list of actual nodes (LionWebJsonNode[])
|
|
32
|
+
* @param reference
|
|
33
|
+
*/
|
|
34
|
+
getChildrenAsNodes(containment: LionWebJsonContainment | undefined): LionWebJsonNode[];
|
|
35
|
+
asString(): string;
|
|
36
|
+
private recursiveToString;
|
|
37
|
+
private indent;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=LionWebJsonChunkWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebJsonChunkWrapper.d.ts","sourceRoot":"","sources":["../src/LionWebJsonChunkWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACvB,MAAM,eAAe,CAAA;AAItB;;;;GAIG;AACH,qBAAa,uBAAuB;IAChC,SAAS,EAAE,gBAAgB,CAAA;IAC3B;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAwC;IAE7F;;;OAGG;gBACS,KAAK,EAAE,gBAAgB;IAKnC;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,gBAAgB;IAMtC,OAAO,CAAC,EAAE,EAAE,SAAS,GAAG,eAAe,GAAG,SAAS;IAInD,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,EAAE;IAIzE;;;OAGG;IACH,gBAAgB,CAAC,SAAS,EAAE,oBAAoB,GAAG,SAAS;IAe5D;;;OAGG;IACH,kBAAkB,CAAC,WAAW,EAAE,sBAAsB,GAAG,SAAS;IAclE,QAAQ,IAAI,MAAM;IAUlB,OAAO,CAAC,iBAAiB;IAkCzB,OAAO,CAAC,MAAM;CAGjB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { isEqualMetaPointer } from "@lionweb/json";
|
|
2
|
+
import { MetaPointers } from "./M3definitions.js";
|
|
3
|
+
import { NodeUtils } from "./NodeUtils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Wraps around a LionWebJsonChunk, providing access to information inside, might be using caches to improve performance.
|
|
6
|
+
* NB Make sure that the contents of the chunk are not changed after creating the wrapper!
|
|
7
|
+
* NB BE aware that with `pushChunk(...)` the original chunk will be changed.
|
|
8
|
+
*/
|
|
9
|
+
export class LionWebJsonChunkWrapper {
|
|
10
|
+
/**
|
|
11
|
+
* Create a wrapper with `chunk` as its chunk
|
|
12
|
+
* @param chunk
|
|
13
|
+
*/
|
|
14
|
+
constructor(chunk) {
|
|
15
|
+
/**
|
|
16
|
+
* Map to get quick access to nodes by id.
|
|
17
|
+
* @protected
|
|
18
|
+
*/
|
|
19
|
+
this.nodesIdMap = new Map();
|
|
20
|
+
this.jsonChunk = chunk;
|
|
21
|
+
this.prepareNodeIds(chunk);
|
|
22
|
+
}
|
|
23
|
+
/** Put all nodes in a map, validate that there are no two nodes with the same id.
|
|
24
|
+
* The check should logically be in LionWebReferenceValidator, but the created map is needed here.
|
|
25
|
+
*/
|
|
26
|
+
prepareNodeIds(chunk) {
|
|
27
|
+
chunk.nodes.forEach(node => {
|
|
28
|
+
this.nodesIdMap.set(node.id, node);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
getNode(id) {
|
|
32
|
+
return this.nodesIdMap.get(id);
|
|
33
|
+
}
|
|
34
|
+
findNodesOfClassifier(concept) {
|
|
35
|
+
return this.jsonChunk.nodes.filter(node => isEqualMetaPointer(node.classifier, concept));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Return the target nodes inside `reference` as a list of actual nodes (LionWebJsonNode[])
|
|
39
|
+
* @param reference
|
|
40
|
+
*/
|
|
41
|
+
getReferredNodes(reference) {
|
|
42
|
+
if (reference === undefined) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const result = reference.targets.flatMap(target => {
|
|
46
|
+
if (target.reference === null) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const referredNode = this.getNode(target.reference);
|
|
51
|
+
return referredNode === undefined ? [] : [referredNode];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Return the target nodes inside `reference` as a list of actual nodes (LionWebJsonNode[])
|
|
58
|
+
* @param reference
|
|
59
|
+
*/
|
|
60
|
+
getChildrenAsNodes(containment) {
|
|
61
|
+
if (containment === undefined) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
const result = [];
|
|
65
|
+
containment.children.forEach(ch => {
|
|
66
|
+
const childNode = this.getNode(ch);
|
|
67
|
+
if (childNode !== undefined) {
|
|
68
|
+
result.push(childNode);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
asString() {
|
|
74
|
+
let result = "";
|
|
75
|
+
const partitions = this.jsonChunk.nodes.filter(n => n.parent === null);
|
|
76
|
+
partitions.forEach(partition => {
|
|
77
|
+
const pString = this.recursiveToString(partition, 1);
|
|
78
|
+
result += pString;
|
|
79
|
+
});
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
recursiveToString(node, depth) {
|
|
83
|
+
if (node === undefined) {
|
|
84
|
+
return "";
|
|
85
|
+
}
|
|
86
|
+
let result = "";
|
|
87
|
+
const nameProperty = NodeUtils.findProperty(node, MetaPointers.INamedName);
|
|
88
|
+
const name = nameProperty === undefined ? "" : " " + nameProperty.value;
|
|
89
|
+
result += this.indent(depth) + "(" + node.id + ")" + name + "\n";
|
|
90
|
+
if (node.annotations !== undefined && node.annotations.length !== 0) {
|
|
91
|
+
result += this.indent(depth + 1) + "*Annotations*" + "\n";
|
|
92
|
+
node.annotations.forEach(ann => {
|
|
93
|
+
result += this.recursiveToString(this.getNode(ann), depth + 1);
|
|
94
|
+
// result += this.indent(depth) + "[[" + JSON.stringify(ann) + "]]\n"
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
node.properties
|
|
98
|
+
.filter(p => p !== nameProperty)
|
|
99
|
+
.forEach(property => {
|
|
100
|
+
result += this.indent(depth + 1) + "*property* " + property.property.key + ": " + property.value + "\n";
|
|
101
|
+
});
|
|
102
|
+
node.references.forEach(ref => {
|
|
103
|
+
result += this.indent(depth + 1) + "*" + ref.reference.key + "*: " + JSON.stringify(ref.targets) + "\n";
|
|
104
|
+
});
|
|
105
|
+
node.containments.forEach(cont => {
|
|
106
|
+
if (cont.children.length !== 0) {
|
|
107
|
+
result += this.indent(depth + 1) + "*" + cont.containment.key + "*" + "\n";
|
|
108
|
+
cont.children.forEach(ch => {
|
|
109
|
+
result += this.recursiveToString(this.getNode(ch), depth + 1);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
indent(depth) {
|
|
116
|
+
return Array(depth).join(" ");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=LionWebJsonChunkWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebJsonChunkWrapper.js","sourceRoot":"","sources":["../src/LionWebJsonChunkWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,kBAAkB,EAOrB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAQ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IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;gBAC1E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;oBACvB,MAAM,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;gBACjE,CAAC,CAAC,CAAA;YACN,CAAC;QACL,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACjB,CAAC;IAEO,MAAM,CAAC,KAAa;QACxB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;CACJ"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains LionWeb defined M3 keys and identifications.
|
|
3
|
+
*/
|
|
4
|
+
export declare const LION_CORE_BUILTINS_INAMED_NAME = "LionCore-builtins-INamed-name";
|
|
5
|
+
export declare const LION_CORE_BUILTINS_KEY = "LionCore-builtins";
|
|
6
|
+
export declare const LION_CORE_M3_KEY = "LionCore-M3";
|
|
7
|
+
export declare const LION_CORE_M3_NAME = "LionCore_M3";
|
|
8
|
+
export declare const LION_CORE_M3_VERSION = "2023.1";
|
|
9
|
+
export declare const LIONWEB_BOOLEAN_TYPE = "LionCore-builtins-Boolean";
|
|
10
|
+
export declare const LIONWEB_JSON_TYPE = "LionCore-builtins-JSON";
|
|
11
|
+
export declare const LIONWEB_INTEGER_TYPE = "LionCore-builtins-Integer";
|
|
12
|
+
export declare const LIONWEB_STRING_TYPE = "LionCore-builtins-String";
|
|
13
|
+
export declare const M3_Keys: {
|
|
14
|
+
Property: string;
|
|
15
|
+
Reference: string;
|
|
16
|
+
Concept: string;
|
|
17
|
+
conceptExtends: string;
|
|
18
|
+
conceptImplements: string;
|
|
19
|
+
concept2: {
|
|
20
|
+
key: string;
|
|
21
|
+
extends: {
|
|
22
|
+
key: string;
|
|
23
|
+
};
|
|
24
|
+
implements: {
|
|
25
|
+
key: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
conceptAbstract: string;
|
|
29
|
+
conceptPartition: string;
|
|
30
|
+
classifierFeatures: string;
|
|
31
|
+
Interface: string;
|
|
32
|
+
InterfaceExtends: string;
|
|
33
|
+
Containment: string;
|
|
34
|
+
Language: string;
|
|
35
|
+
languageVersion: string;
|
|
36
|
+
IKeyedKey: string;
|
|
37
|
+
PropertyType: string;
|
|
38
|
+
Enumeration: string;
|
|
39
|
+
EnumerationLiterals: string;
|
|
40
|
+
EnumerationLiteral: string;
|
|
41
|
+
INamed: string;
|
|
42
|
+
INamedName: string;
|
|
43
|
+
Annotation: string;
|
|
44
|
+
AnnotationAnnotates: string;
|
|
45
|
+
AnnotationExtends: string;
|
|
46
|
+
AnnotationImplements: string;
|
|
47
|
+
Node: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const MetaPointers: {
|
|
50
|
+
Language: {
|
|
51
|
+
version: string;
|
|
52
|
+
language: string;
|
|
53
|
+
key: string;
|
|
54
|
+
};
|
|
55
|
+
LanguageVersion: {
|
|
56
|
+
version: string;
|
|
57
|
+
language: string;
|
|
58
|
+
key: string;
|
|
59
|
+
};
|
|
60
|
+
ClassifierFeatures: {
|
|
61
|
+
version: string;
|
|
62
|
+
language: string;
|
|
63
|
+
key: string;
|
|
64
|
+
};
|
|
65
|
+
Concept: {
|
|
66
|
+
version: string;
|
|
67
|
+
language: string;
|
|
68
|
+
key: string;
|
|
69
|
+
};
|
|
70
|
+
ConceptAbstract: {
|
|
71
|
+
version: string;
|
|
72
|
+
language: string;
|
|
73
|
+
key: string;
|
|
74
|
+
};
|
|
75
|
+
ConceptPartition: {
|
|
76
|
+
version: string;
|
|
77
|
+
language: string;
|
|
78
|
+
key: string;
|
|
79
|
+
};
|
|
80
|
+
ConceptExtends: {
|
|
81
|
+
version: string;
|
|
82
|
+
language: string;
|
|
83
|
+
key: string;
|
|
84
|
+
};
|
|
85
|
+
ConceptImplements: {
|
|
86
|
+
version: string;
|
|
87
|
+
language: string;
|
|
88
|
+
key: string;
|
|
89
|
+
};
|
|
90
|
+
Annotation: {
|
|
91
|
+
version: string;
|
|
92
|
+
language: string;
|
|
93
|
+
key: string;
|
|
94
|
+
};
|
|
95
|
+
AnnotationAnnotates: {
|
|
96
|
+
version: string;
|
|
97
|
+
language: string;
|
|
98
|
+
key: string;
|
|
99
|
+
};
|
|
100
|
+
AnnotationExtends: {
|
|
101
|
+
version: string;
|
|
102
|
+
language: string;
|
|
103
|
+
key: string;
|
|
104
|
+
};
|
|
105
|
+
AnnotationImplements: {
|
|
106
|
+
version: string;
|
|
107
|
+
language: string;
|
|
108
|
+
key: string;
|
|
109
|
+
};
|
|
110
|
+
Interface: {
|
|
111
|
+
version: string;
|
|
112
|
+
language: string;
|
|
113
|
+
key: string;
|
|
114
|
+
};
|
|
115
|
+
InterfaceExtends: {
|
|
116
|
+
version: string;
|
|
117
|
+
language: string;
|
|
118
|
+
key: string;
|
|
119
|
+
};
|
|
120
|
+
Enumeration: {
|
|
121
|
+
version: string;
|
|
122
|
+
language: string;
|
|
123
|
+
key: string;
|
|
124
|
+
};
|
|
125
|
+
EnumerationLiteral: {
|
|
126
|
+
version: string;
|
|
127
|
+
language: string;
|
|
128
|
+
key: string;
|
|
129
|
+
};
|
|
130
|
+
EnumerationLiterals: {
|
|
131
|
+
version: string;
|
|
132
|
+
language: string;
|
|
133
|
+
key: string;
|
|
134
|
+
};
|
|
135
|
+
Containment: {
|
|
136
|
+
version: string;
|
|
137
|
+
language: string;
|
|
138
|
+
key: string;
|
|
139
|
+
};
|
|
140
|
+
Property: {
|
|
141
|
+
version: string;
|
|
142
|
+
language: string;
|
|
143
|
+
key: string;
|
|
144
|
+
};
|
|
145
|
+
PropertyType: {
|
|
146
|
+
version: string;
|
|
147
|
+
language: string;
|
|
148
|
+
key: string;
|
|
149
|
+
};
|
|
150
|
+
Reference: {
|
|
151
|
+
version: string;
|
|
152
|
+
language: string;
|
|
153
|
+
key: string;
|
|
154
|
+
};
|
|
155
|
+
IKeyedKey: {
|
|
156
|
+
language: string;
|
|
157
|
+
version: string;
|
|
158
|
+
key: string;
|
|
159
|
+
};
|
|
160
|
+
Node: {
|
|
161
|
+
language: string;
|
|
162
|
+
version: string;
|
|
163
|
+
key: string;
|
|
164
|
+
};
|
|
165
|
+
INamed: {
|
|
166
|
+
language: string;
|
|
167
|
+
version: string;
|
|
168
|
+
key: string;
|
|
169
|
+
};
|
|
170
|
+
INamedName: {
|
|
171
|
+
language: string;
|
|
172
|
+
version: string;
|
|
173
|
+
key: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=M3definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"M3definitions.d.ts","sourceRoot":"","sources":["../src/M3definitions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,8BAA8B,kCAAkC,CAAA;AAC7E,eAAO,MAAM,sBAAsB,sBAAsB,CAAA;AAEzD,eAAO,MAAM,gBAAgB,gBAAgB,CAAA;AAC7C,eAAO,MAAM,iBAAiB,gBAAgB,CAAA;AAE9C,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,eAAO,MAAM,iBAAiB,2BAA2B,CAAA;AACzD,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,eAAO,MAAM,mBAAmB,6BAA6B,CAAA;AAE7D,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BnB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+HxB,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains LionWeb defined M3 keys and identifications.
|
|
3
|
+
*/
|
|
4
|
+
export const LION_CORE_BUILTINS_INAMED_NAME = "LionCore-builtins-INamed-name";
|
|
5
|
+
export const LION_CORE_BUILTINS_KEY = "LionCore-builtins";
|
|
6
|
+
export const LION_CORE_M3_KEY = "LionCore-M3";
|
|
7
|
+
export const LION_CORE_M3_NAME = "LionCore_M3";
|
|
8
|
+
export const LION_CORE_M3_VERSION = "2023.1";
|
|
9
|
+
// Builtin datatypes
|
|
10
|
+
export const LIONWEB_BOOLEAN_TYPE = "LionCore-builtins-Boolean";
|
|
11
|
+
export const LIONWEB_JSON_TYPE = "LionCore-builtins-JSON";
|
|
12
|
+
export const LIONWEB_INTEGER_TYPE = "LionCore-builtins-Integer";
|
|
13
|
+
export const LIONWEB_STRING_TYPE = "LionCore-builtins-String";
|
|
14
|
+
export const M3_Keys = {
|
|
15
|
+
Property: "Property",
|
|
16
|
+
Reference: "Reference",
|
|
17
|
+
Concept: "Concept",
|
|
18
|
+
conceptExtends: "Concept-extends",
|
|
19
|
+
conceptImplements: "Concept-implements",
|
|
20
|
+
concept2: {
|
|
21
|
+
key: "Concept",
|
|
22
|
+
extends: { key: "Concept-extends" },
|
|
23
|
+
implements: { key: "Concept-implements" }
|
|
24
|
+
},
|
|
25
|
+
conceptAbstract: "Concept-abstract",
|
|
26
|
+
conceptPartition: "Concept-partition",
|
|
27
|
+
classifierFeatures: "Classifier-features",
|
|
28
|
+
Interface: "Interface",
|
|
29
|
+
InterfaceExtends: "Interface-extends",
|
|
30
|
+
Containment: "Containment",
|
|
31
|
+
Language: "Language",
|
|
32
|
+
languageVersion: "Language-version",
|
|
33
|
+
IKeyedKey: "IKeyed-key",
|
|
34
|
+
PropertyType: "Property-type",
|
|
35
|
+
Enumeration: "Enumeration",
|
|
36
|
+
EnumerationLiterals: "Enumeration-literals",
|
|
37
|
+
EnumerationLiteral: "EnumerationLiteral",
|
|
38
|
+
INamed: "LionCore-builtins-INamed",
|
|
39
|
+
INamedName: "LionCore-builtins-INamed-name",
|
|
40
|
+
Annotation: "Annotation",
|
|
41
|
+
AnnotationAnnotates: "Annotation-annotates",
|
|
42
|
+
AnnotationExtends: "Annotation-extends",
|
|
43
|
+
AnnotationImplements: "Annotation-implements",
|
|
44
|
+
Node: "LionCore-builtins-Node"
|
|
45
|
+
};
|
|
46
|
+
export const MetaPointers = {
|
|
47
|
+
Language: {
|
|
48
|
+
version: LION_CORE_M3_VERSION,
|
|
49
|
+
language: LION_CORE_M3_KEY,
|
|
50
|
+
key: M3_Keys.Language
|
|
51
|
+
},
|
|
52
|
+
LanguageVersion: {
|
|
53
|
+
version: LION_CORE_M3_VERSION,
|
|
54
|
+
language: LION_CORE_M3_KEY,
|
|
55
|
+
key: M3_Keys.languageVersion
|
|
56
|
+
},
|
|
57
|
+
ClassifierFeatures: {
|
|
58
|
+
version: LION_CORE_M3_VERSION,
|
|
59
|
+
language: LION_CORE_M3_KEY,
|
|
60
|
+
key: M3_Keys.classifierFeatures
|
|
61
|
+
},
|
|
62
|
+
Concept: {
|
|
63
|
+
version: LION_CORE_M3_VERSION,
|
|
64
|
+
language: LION_CORE_M3_KEY,
|
|
65
|
+
key: M3_Keys.concept2.key
|
|
66
|
+
},
|
|
67
|
+
ConceptAbstract: {
|
|
68
|
+
version: LION_CORE_M3_VERSION,
|
|
69
|
+
language: LION_CORE_M3_KEY,
|
|
70
|
+
key: M3_Keys.conceptAbstract
|
|
71
|
+
},
|
|
72
|
+
ConceptPartition: {
|
|
73
|
+
version: LION_CORE_M3_VERSION,
|
|
74
|
+
language: LION_CORE_M3_KEY,
|
|
75
|
+
key: M3_Keys.conceptPartition
|
|
76
|
+
},
|
|
77
|
+
ConceptExtends: {
|
|
78
|
+
version: LION_CORE_M3_VERSION,
|
|
79
|
+
language: LION_CORE_M3_KEY,
|
|
80
|
+
key: M3_Keys.concept2.extends.key
|
|
81
|
+
},
|
|
82
|
+
ConceptImplements: {
|
|
83
|
+
version: LION_CORE_M3_VERSION,
|
|
84
|
+
language: LION_CORE_M3_KEY,
|
|
85
|
+
key: M3_Keys.concept2.implements.key
|
|
86
|
+
},
|
|
87
|
+
Annotation: {
|
|
88
|
+
version: LION_CORE_M3_VERSION,
|
|
89
|
+
language: LION_CORE_M3_KEY,
|
|
90
|
+
key: M3_Keys.Annotation
|
|
91
|
+
},
|
|
92
|
+
AnnotationAnnotates: {
|
|
93
|
+
version: LION_CORE_M3_VERSION,
|
|
94
|
+
language: LION_CORE_M3_KEY,
|
|
95
|
+
key: M3_Keys.AnnotationAnnotates
|
|
96
|
+
},
|
|
97
|
+
AnnotationExtends: {
|
|
98
|
+
version: LION_CORE_M3_VERSION,
|
|
99
|
+
language: LION_CORE_M3_KEY,
|
|
100
|
+
key: M3_Keys.AnnotationExtends
|
|
101
|
+
},
|
|
102
|
+
AnnotationImplements: {
|
|
103
|
+
version: LION_CORE_M3_VERSION,
|
|
104
|
+
language: LION_CORE_M3_KEY,
|
|
105
|
+
key: M3_Keys.AnnotationImplements
|
|
106
|
+
},
|
|
107
|
+
Interface: {
|
|
108
|
+
version: LION_CORE_M3_VERSION,
|
|
109
|
+
language: LION_CORE_M3_KEY,
|
|
110
|
+
key: M3_Keys.Interface
|
|
111
|
+
},
|
|
112
|
+
InterfaceExtends: {
|
|
113
|
+
version: LION_CORE_M3_VERSION,
|
|
114
|
+
language: LION_CORE_M3_KEY,
|
|
115
|
+
key: M3_Keys.InterfaceExtends
|
|
116
|
+
},
|
|
117
|
+
Enumeration: {
|
|
118
|
+
version: LION_CORE_M3_VERSION,
|
|
119
|
+
language: LION_CORE_M3_KEY,
|
|
120
|
+
key: M3_Keys.Enumeration
|
|
121
|
+
},
|
|
122
|
+
EnumerationLiteral: {
|
|
123
|
+
version: LION_CORE_M3_VERSION,
|
|
124
|
+
language: LION_CORE_M3_KEY,
|
|
125
|
+
key: M3_Keys.EnumerationLiteral
|
|
126
|
+
},
|
|
127
|
+
EnumerationLiterals: {
|
|
128
|
+
version: LION_CORE_M3_VERSION,
|
|
129
|
+
language: LION_CORE_M3_KEY,
|
|
130
|
+
key: M3_Keys.EnumerationLiterals
|
|
131
|
+
},
|
|
132
|
+
Containment: {
|
|
133
|
+
version: LION_CORE_M3_VERSION,
|
|
134
|
+
language: LION_CORE_M3_KEY,
|
|
135
|
+
key: M3_Keys.Containment
|
|
136
|
+
},
|
|
137
|
+
Property: {
|
|
138
|
+
version: LION_CORE_M3_VERSION,
|
|
139
|
+
language: LION_CORE_M3_KEY,
|
|
140
|
+
key: M3_Keys.Property
|
|
141
|
+
},
|
|
142
|
+
PropertyType: {
|
|
143
|
+
version: LION_CORE_M3_VERSION,
|
|
144
|
+
language: LION_CORE_M3_KEY,
|
|
145
|
+
key: M3_Keys.PropertyType
|
|
146
|
+
},
|
|
147
|
+
Reference: {
|
|
148
|
+
version: LION_CORE_M3_VERSION,
|
|
149
|
+
language: LION_CORE_M3_KEY,
|
|
150
|
+
key: M3_Keys.Reference
|
|
151
|
+
},
|
|
152
|
+
IKeyedKey: {
|
|
153
|
+
language: LION_CORE_M3_KEY,
|
|
154
|
+
version: LION_CORE_M3_VERSION,
|
|
155
|
+
key: M3_Keys.IKeyedKey
|
|
156
|
+
},
|
|
157
|
+
// Builtins:
|
|
158
|
+
Node: {
|
|
159
|
+
language: LION_CORE_BUILTINS_KEY,
|
|
160
|
+
version: LION_CORE_M3_VERSION,
|
|
161
|
+
key: M3_Keys.Node
|
|
162
|
+
},
|
|
163
|
+
INamed: {
|
|
164
|
+
language: LION_CORE_BUILTINS_KEY,
|
|
165
|
+
version: LION_CORE_M3_VERSION,
|
|
166
|
+
key: M3_Keys.INamed
|
|
167
|
+
},
|
|
168
|
+
INamedName: {
|
|
169
|
+
language: LION_CORE_BUILTINS_KEY,
|
|
170
|
+
version: LION_CORE_M3_VERSION,
|
|
171
|
+
key: M3_Keys.INamedName
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=M3definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"M3definitions.js","sourceRoot":"","sources":["../src/M3definitions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,+BAA+B,CAAA;AAC7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAA;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAA;AAC7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAA;AAE9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAA;AAC5C,oBAAoB;AACpB,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAA;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAA;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAA;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAA;AAE7D,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,iBAAiB;IACjC,iBAAiB,EAAE,oBAAoB;IACvC,QAAQ,EAAE;QACN,GAAG,EAAE,SAAS;QACd,OAAO,EAAE,EAAE,GAAG,EAAE,iBAAiB,EAAE;QACnC,UAAU,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE;KAC5C;IACD,eAAe,EAAE,kBAAkB;IACnC,gBAAgB,EAAE,mBAAmB;IACrC,kBAAkB,EAAE,qBAAqB;IACzC,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,mBA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E,gBAAgB;QAC1B,GAAG,EAAE,OAAO,CAAC,mBAAmB;KACnC;IACD,WAAW,EAAE;QACT,OAAO,EAAE,oBAAoB;QAC7B,QAAQ,EAAE,gBAAgB;QAC1B,GAAG,EAAE,OAAO,CAAC,WAAW;KAC3B;IACD,QAAQ,EAAE;QACN,OAAO,EAAE,oBAAoB;QAC7B,QAAQ,EAAE,gBAAgB;QAC1B,GAAG,EAAE,OAAO,CAAC,QAAQ;KACxB;IACD,YAAY,EAAE;QACV,OAAO,EAAE,oBAAoB;QAC7B,QAAQ,EAAE,gBAAgB;QAC1B,GAAG,EAAE,OAAO,CAAC,YAAY;KAC5B;IACD,SAAS,EAAE;QACP,OAAO,EAAE,oBAAoB;QAC7B,QAAQ,EAAE,gBAAgB;QAC1B,GAAG,EAAE,OAAO,CAAC,SAAS;KACzB;IACD,SAAS,EAAE;QACP,QAAQ,EAAE,gBAAgB;QAC1B,OAAO,EAAE,oBAAoB;QAC7B,GAAG,EAAE,OAAO,CAAC,SAAS;KACzB;IACD,YAAY;IACZ,IAAI,EAAE;QACF,QAAQ,EAAE,sBAAsB;QAChC,OAAO,EAAE,oBAAoB;QAC7B,GAAG,EAAE,OAAO,CAAC,IAAI;KACpB;IACD,MAAM,EAAE;QACJ,QAAQ,EAAE,sBAAsB;QAChC,OAAO,EAAE,oBAAoB;QAC7B,GAAG,EAAE,OAAO,CAAC,MAAM;KACtB;IACD,UAAU,EAAE;QACR,QAAQ,EAAE,sBAAsB;QAChC,OAAO,EAAE,oBAAoB;QAC7B,GAAG,EAAE,OAAO,CAAC,UAAU;KAC1B;CACJ,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LionWebId, LionWebJsonContainment, LionWebJsonMetaPointer, LionWebJsonNode, LionWebJsonProperty, LionWebJsonReference, LionWebJsonReferenceTarget, LionWebKey } from "@lionweb/json";
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for LionWebJsonNode's
|
|
4
|
+
*/
|
|
5
|
+
export declare class NodeUtils {
|
|
6
|
+
/**
|
|
7
|
+
* Find property with key equals `key` in `node`.
|
|
8
|
+
* @param node
|
|
9
|
+
* @param key
|
|
10
|
+
*/
|
|
11
|
+
static findProperty(node: LionWebJsonNode, property: LionWebJsonMetaPointer): LionWebJsonProperty | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Find containment child with key equals `key` in `node`.
|
|
14
|
+
* @param node
|
|
15
|
+
* @param key
|
|
16
|
+
*/
|
|
17
|
+
static findChild(node: LionWebJsonNode, key: LionWebKey): LionWebJsonContainment | undefined;
|
|
18
|
+
static findContainment(node: LionWebJsonNode, containment: LionWebJsonMetaPointer): LionWebJsonContainment | undefined;
|
|
19
|
+
static findReference(node: LionWebJsonNode, reference: LionWebJsonMetaPointer): LionWebJsonReference | undefined;
|
|
20
|
+
static findReferenceTarget(referenceTargets: LionWebJsonReferenceTarget[], target: LionWebJsonReferenceTarget): LionWebJsonReferenceTarget | undefined;
|
|
21
|
+
static findContainmentContainingChild(containments: LionWebJsonContainment[], childId: LionWebId): LionWebJsonContainment | undefined;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=NodeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeUtils.d.ts","sourceRoot":"","sources":["../src/NodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEqB,SAAS,EACjC,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAAE,UAAU,EACzC,MAAM,eAAe,CAAA;AAEtB;;GAEG;AACH,qBAAa,SAAS;IAClB;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,sBAAsB,GAAG,mBAAmB,GAAG,SAAS;IAS7G;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,GAAG,sBAAsB,GAAG,SAAS;IAY5F,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,sBAAsB,GAAG,sBAAsB,GAAG,SAAS;IAOtH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,sBAAsB,GAAG,oBAAoB,GAAG,SAAS;IAOhH,MAAM,CAAC,mBAAmB,CACtB,gBAAgB,EAAE,0BAA0B,EAAE,EAC9C,MAAM,EAAE,0BAA0B,GACnC,0BAA0B,GAAG,SAAS;IASzC,MAAM,CAAC,8BAA8B,CAAC,YAAY,EAAE,sBAAsB,EAAE,EAAE,OAAO,EAAE,SAAS,GAAG,sBAAsB,GAAG,SAAS;CAGxI"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isEqualMetaPointer, isEqualReferenceTarget } from "@lionweb/json";
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for LionWebJsonNode's
|
|
4
|
+
*/
|
|
5
|
+
export class NodeUtils {
|
|
6
|
+
/**
|
|
7
|
+
* Find property with key equals `key` in `node`.
|
|
8
|
+
* @param node
|
|
9
|
+
* @param key
|
|
10
|
+
*/
|
|
11
|
+
static findProperty(node, property) {
|
|
12
|
+
if (node === undefined) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return node.properties.find(prop => isEqualMetaPointer(prop.property, property));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Find containment child with key equals `key` in `node`.
|
|
19
|
+
* @param node
|
|
20
|
+
* @param key
|
|
21
|
+
*/
|
|
22
|
+
static findChild(node, key) {
|
|
23
|
+
if (node === undefined) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
for (const containment of node.containments) {
|
|
27
|
+
if (containment.containment.key === key) {
|
|
28
|
+
return containment;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
static findContainment(node, containment) {
|
|
34
|
+
if (node === undefined) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return node.containments.find(cont => isEqualMetaPointer(cont.containment, containment));
|
|
38
|
+
}
|
|
39
|
+
static findReference(node, reference) {
|
|
40
|
+
if (node === undefined) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return node.references.find(ref => isEqualMetaPointer(ref.reference, reference));
|
|
44
|
+
}
|
|
45
|
+
static findReferenceTarget(referenceTargets, target) {
|
|
46
|
+
for (const refTarget of referenceTargets) {
|
|
47
|
+
if (isEqualReferenceTarget(refTarget, target)) {
|
|
48
|
+
return refTarget;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
static findContainmentContainingChild(containments, childId) {
|
|
54
|
+
return containments.find(cont => cont.children.includes(childId));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=NodeUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeUtils.js","sourceRoot":"","sources":["../src/NodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EAOzB,MAAM,eAAe,CAAA;AAEtB;;GAEG;AACH,MAAM,OAAO,SAAS;IAClB;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAqB,EAAE,QAAgC;QACvE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CACvB,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACtD,CAAA;IACL,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAqB,EAAE,GAAe;QACnD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,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,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lionweb/json-utils",
|
|
3
|
+
"version": "0.6.13-beta.5",
|
|
4
|
+
"description": "Utilities for LionWeb JSON",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"typings": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/LionWeb-io/lionweb-typescript.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"clean": "rm -rf dist/ lionweb-json-utils-*.tgz",
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"lint": "eslint src",
|
|
21
|
+
"pre-release-either": "npm run clean && npm install && npm run build",
|
|
22
|
+
"prerelease": "npm run pre-release-either",
|
|
23
|
+
"release": "npm publish",
|
|
24
|
+
"prerelease-beta": "npm run pre-release-either",
|
|
25
|
+
"release-beta": "npm publish --tag beta"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@lionweb/json": "0.6.13-beta.5"
|
|
29
|
+
}
|
|
30
|
+
}
|