@appsemble/lang-sdk 0.40.3 → 0.40.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/package.json +1 -1
- package/pageUtils.d.ts +8 -1
- package/pageUtils.js +9 -0
- package/reference-schemas/remappers/unsorted.js +4 -1
- package/remap.d.ts +1 -3
- package/remap.js +18 -3
- package/schemas/ContainerPageDefinition.js +1 -1
- package/schemas/actions/ResourceQueryActionDefinition.js +9 -0
- package/validation.d.ts +1 -9
- package/validation.js +1 -9
package/package.json
CHANGED
package/pageUtils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MessageGetter } from './remap.js';
|
|
2
|
-
import { type PageDefinition } from './types/index.js';
|
|
2
|
+
import { type PageDefinition, type Remapper } from './types/index.js';
|
|
3
3
|
type NamedPage = Pick<PageDefinition, 'name'>;
|
|
4
4
|
/**
|
|
5
5
|
* The built-in routes whose URL segment an app may translate through a `routes.<Name>` message.
|
|
@@ -48,4 +48,11 @@ export declare function findPageById(pages: PageDefinition[], normalizedPageId:
|
|
|
48
48
|
* @returns The ancestors, root first, excluding the page itself.
|
|
49
49
|
*/
|
|
50
50
|
export declare function getPageAncestors(pages: PageDefinition[], page: PageDefinition, appMemberRoles?: string[]): PageDefinition[];
|
|
51
|
+
/**
|
|
52
|
+
* Check whether or not the given link represents a link related to the Appsemble core.
|
|
53
|
+
*
|
|
54
|
+
* @param link The link to check
|
|
55
|
+
* @returns Whether or not the given link represents a link related to the Appsemble core.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isAppLink(link: Remapper | string[] | string): link is `/${TranslatableRoute}`;
|
|
51
58
|
export {};
|
package/pageUtils.js
CHANGED
|
@@ -117,4 +117,13 @@ export function getPageAncestors(pages, page, appMemberRoles = []) {
|
|
|
117
117
|
}
|
|
118
118
|
return ancestors;
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Check whether or not the given link represents a link related to the Appsemble core.
|
|
122
|
+
*
|
|
123
|
+
* @param link The link to check
|
|
124
|
+
* @returns Whether or not the given link represents a link related to the Appsemble core.
|
|
125
|
+
*/
|
|
126
|
+
export function isAppLink(link) {
|
|
127
|
+
return (link === '/Login' || link === '/Settings' || link === '/Register' || link === '/Reset-Password');
|
|
128
|
+
}
|
|
120
129
|
//# sourceMappingURL=pageUtils.js.map
|
|
@@ -254,7 +254,10 @@ For example:
|
|
|
254
254
|
|
|
255
255
|
For example:
|
|
256
256
|
|
|
257
|
-
${schemaExample('xml.parse', { result: 'pretty' })}
|
|
257
|
+
${schemaExample('xml.parse', { result: 'pretty' })}
|
|
258
|
+
|
|
259
|
+
The tag and attribute names \`__proto__\`, \`constructor\` and \`prototype\` appear in the output
|
|
260
|
+
as \`#__proto__\`, \`#constructor\` and \`#prototype\`.`,
|
|
258
261
|
$ref: '#/components/schemas/RemapperDefinition',
|
|
259
262
|
},
|
|
260
263
|
maths: {
|
package/remap.d.ts
CHANGED
|
@@ -75,9 +75,7 @@ interface InternalContext extends RemapperContext {
|
|
|
75
75
|
stepRef?: {
|
|
76
76
|
current: Record<string, any>;
|
|
77
77
|
};
|
|
78
|
-
|
|
79
|
-
current: Record<string, any>;
|
|
80
|
-
};
|
|
78
|
+
tabName?: string;
|
|
81
79
|
}
|
|
82
80
|
export declare function remap(remapper: Remapper, input: unknown, context: InternalContext | RemapperContext): unknown;
|
|
83
81
|
export {};
|
package/remap.js
CHANGED
|
@@ -35,6 +35,21 @@ function isEqualObject(a, b) {
|
|
|
35
35
|
function isNumber(a) {
|
|
36
36
|
return a !== undefined && a != null && a !== '' && !Number.isNaN(Number(a));
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Tag and attribute names fast-xml-parser refuses to parse, because they could pollute object
|
|
40
|
+
* prototypes.
|
|
41
|
+
*/
|
|
42
|
+
const prototypeNames = new Set(['__proto__', 'constructor', 'prototype']);
|
|
43
|
+
/**
|
|
44
|
+
* Prefix tag and attribute names that fast-xml-parser refuses with `#`, so the rest of the
|
|
45
|
+
* document still parses.
|
|
46
|
+
*
|
|
47
|
+
* @param name The XML tag or attribute name.
|
|
48
|
+
* @returns The name to use as the object key.
|
|
49
|
+
*/
|
|
50
|
+
function escapePrototypeName(name) {
|
|
51
|
+
return prototypeNames.has(name) ? `#${name}` : name;
|
|
52
|
+
}
|
|
38
53
|
export function remap(remapper, input, context) {
|
|
39
54
|
if (typeof remapper === 'string' ||
|
|
40
55
|
typeof remapper === 'number' ||
|
|
@@ -177,9 +192,7 @@ const mapperImplementations = {
|
|
|
177
192
|
return context.stepRef.current[mapper];
|
|
178
193
|
},
|
|
179
194
|
'tab.name'(mapper, input, context) {
|
|
180
|
-
|
|
181
|
-
// @ts-ignore 18048 variable is possibly undefined (strictNullChecks)
|
|
182
|
-
return context.tabRef.current.name;
|
|
195
|
+
return context.tabName;
|
|
183
196
|
},
|
|
184
197
|
gt: ([left, right], input, context) =>
|
|
185
198
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -876,6 +889,8 @@ const mapperImplementations = {
|
|
|
876
889
|
const parser = new XMLParser({
|
|
877
890
|
ignoreAttributes: false,
|
|
878
891
|
attributeNamePrefix: '',
|
|
892
|
+
transformAttributeName: escapePrototypeName,
|
|
893
|
+
transformTagName: escapePrototypeName,
|
|
879
894
|
});
|
|
880
895
|
try {
|
|
881
896
|
return parser.parse(remap(value, input, context) || '');
|
|
@@ -40,7 +40,7 @@ pages:
|
|
|
40
40
|
pages: {
|
|
41
41
|
type: 'array',
|
|
42
42
|
minItems: 1,
|
|
43
|
-
description: 'The pages
|
|
43
|
+
description: 'The pages grouped in this container. These may be container pages themselves.',
|
|
44
44
|
items: {
|
|
45
45
|
anyOf: [
|
|
46
46
|
{ $ref: '#/components/schemas/PageDefinition' },
|
|
@@ -21,6 +21,15 @@ export const ResourceQueryActionDefinition = extendJSONSchema(RequestActionDefin
|
|
|
21
21
|
type: 'string',
|
|
22
22
|
description: 'The view to use for the resource.',
|
|
23
23
|
},
|
|
24
|
+
query: {
|
|
25
|
+
$ref: '#/components/schemas/RemapperDefinition',
|
|
26
|
+
description: `A remapper that results in either an object containing each property of the query
|
|
27
|
+
string, or a string that gets passed through as-is.
|
|
28
|
+
|
|
29
|
+
Supported query parameters are \`$filter\`, \`$orderby\`, \`$select\`, \`$top\` (the maximum number of
|
|
30
|
+
resources to return) and \`$skip\` (the number of resources to skip). Combine \`$top\` and \`$skip\`
|
|
31
|
+
with \`$orderby\` to get stable pages.`,
|
|
32
|
+
},
|
|
24
33
|
own: {
|
|
25
34
|
type: 'boolean',
|
|
26
35
|
description: 'If only the resources created by the authenticated app member should be included',
|
package/validation.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { type ValidatorResult } from 'jsonschema';
|
|
2
2
|
import { type Promisable } from 'type-fest';
|
|
3
3
|
import { type IdentifiableBlock } from './blockUtils.js';
|
|
4
|
-
import { type
|
|
5
|
-
import { type AppDefinition, type BlockManifest, type ProjectImplementations, type Remapper } from './types/index.js';
|
|
6
|
-
/**
|
|
7
|
-
* Check whether or not the given link represents a link related to the Appsemble core.
|
|
8
|
-
*
|
|
9
|
-
* @param link The link to check
|
|
10
|
-
* @returns Whether or not the given link represents a link related to the Appsemble core.
|
|
11
|
-
*/
|
|
12
|
-
export declare function isAppLink(link: Remapper | string[] | string): link is `/${TranslatableRoute}`;
|
|
4
|
+
import { type AppDefinition, type BlockManifest, type ProjectImplementations } from './types/index.js';
|
|
13
5
|
export type BlockVersionsGetter = (blockMap: IdentifiableBlock[]) => Promisable<BlockManifest[]>;
|
|
14
6
|
/**
|
|
15
7
|
* Validate an app definition.
|
package/validation.js
CHANGED
|
@@ -6,6 +6,7 @@ import { BlockParamInstanceValidator } from './BasicValidator.js';
|
|
|
6
6
|
import { getAppBlocks, normalizeBlockName } from './blockUtils.js';
|
|
7
7
|
import { partialNormalized } from './constants/index.js';
|
|
8
8
|
import { findPageByName } from './findPageByName.js';
|
|
9
|
+
import { isAppLink } from './pageUtils.js';
|
|
9
10
|
import { bottomNavigationGridArea, breadcrumbsGridArea, builtinPagesGridAreaOrder, getBuiltinPagesDefaultGridLayout, getCascadedGridTemplateAreas, getGridTemplateAreas, gridDeviceOrder, resendBannerGridArea, } from './gridUtils.js';
|
|
10
11
|
import { isValidIconName, parseIconReference } from './icons.js';
|
|
11
12
|
import { iterAction, iterApp } from './iterApp.js';
|
|
@@ -44,15 +45,6 @@ function hasResourcePermission(permissions, resourceName, resourceAction, view)
|
|
|
44
45
|
return false;
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Check whether or not the given link represents a link related to the Appsemble core.
|
|
49
|
-
*
|
|
50
|
-
* @param link The link to check
|
|
51
|
-
* @returns Whether or not the given link represents a link related to the Appsemble core.
|
|
52
|
-
*/
|
|
53
|
-
export function isAppLink(link) {
|
|
54
|
-
return (link === '/Login' || link === '/Settings' || link === '/Register' || link === '/Reset-Password');
|
|
55
|
-
}
|
|
56
48
|
function validateJSONSchema(schema, prefix, report) {
|
|
57
49
|
if (schema.type !== 'object') {
|
|
58
50
|
return;
|