@aeriajs/compiler 0.0.69 → 0.0.71

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/dist/ast.d.ts CHANGED
@@ -100,6 +100,7 @@ export type CollectionNode = NodeBase<'collection'> & {
100
100
  };
101
101
  export type ContractNode = NodeBase<'contract'> & {
102
102
  name: string;
103
+ streamed?: boolean;
103
104
  roles?: AccessCondition;
104
105
  query?: PropertyNode;
105
106
  payload?: PropertyNode;
@@ -25,7 +25,7 @@ const makeJSContractsCode = (ast) => {
25
25
  return `${modifierSymbol}(${stringify(unwrapPropertyNode(propertyNode))})`;
26
26
  };
27
27
  const declarations = ast.contracts.map((node) => {
28
- const { name, kind, roles, response, ...contractProperty } = node;
28
+ const { name, kind, streamed, roles, response, ...contractProperty } = node;
29
29
  let responseString;
30
30
  if (response) {
31
31
  responseString = '';
@@ -48,7 +48,10 @@ const makeJSContractsCode = (ast) => {
48
48
  [UnquotedSymbol]: responseString,
49
49
  };
50
50
  }
51
- if (roles) {
51
+ if (streamed !== undefined) {
52
+ contractSchema.streamed = streamed;
53
+ }
54
+ if (roles !== undefined) {
52
55
  contractSchema.roles = roles;
53
56
  }
54
57
  return `export const ${name} = defineContract(${stringify(contractSchema)})`;
@@ -66,23 +69,26 @@ const getResponseSchema = (response) => {
66
69
  };
67
70
  const makeTSContractsCode = (ast) => {
68
71
  return ast.contracts.map((node) => {
69
- const { name, kind, roles, ...contractSchema } = node;
70
- let responseSchema = null;
71
- if (contractSchema.response) {
72
- if (Array.isArray(contractSchema.response)) {
73
- responseSchema = contractSchema.response.map(getResponseSchema);
72
+ const { name, kind, streamed, roles, ...contractProperty } = node;
73
+ let responseSchema;
74
+ if (contractProperty.response) {
75
+ if (Array.isArray(contractProperty.response)) {
76
+ responseSchema = contractProperty.response.map(getResponseSchema);
74
77
  }
75
78
  else {
76
- responseSchema = getResponseSchema(contractSchema.response);
79
+ responseSchema = getResponseSchema(contractProperty.response);
77
80
  }
78
81
  }
79
- const contractProperties = recursivelyUnwrapPropertyNodes(contractSchema);
82
+ const contractSchema = recursivelyUnwrapPropertyNodes(contractProperty);
80
83
  if (responseSchema) {
81
- contractProperties.response = responseSchema;
84
+ contractSchema.response = responseSchema;
82
85
  }
83
- if (roles) {
84
- contractProperties.roles = roles;
86
+ if (streamed !== undefined) {
87
+ contractSchema.streamed = streamed;
88
+ }
89
+ if (roles !== undefined) {
90
+ contractSchema.roles = roles;
85
91
  }
86
- return `export declare const ${node.name}: ${stringify(contractProperties)}`;
92
+ return `export declare const ${node.name}: ${stringify(contractSchema)}`;
87
93
  }).join('\n\n');
88
94
  };
package/dist/lexer.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare const COLLECTION_SEARCH_KEYWORDS: readonly ["indexes", "placehold
6
6
  export declare const COLLECTION_LAYOUT_KEYWORDS: readonly ["name", "options"];
7
7
  export declare const COLLECTION_LAYOUT_OPTIONS_KEYWORDS: readonly ["title", "picture", "badge", "information", "active", "translateBadge"];
8
8
  export declare const COLLECTION_FORM_LAYOUT_KEYWORDS: readonly ["fields", "if", "span", "verticalSpacing", "separator"];
9
- export declare const CONTRACT_KEYWORDS: readonly ["roles", "payload", "query", "response"];
9
+ export declare const CONTRACT_KEYWORDS: readonly ["streamed", "roles", "payload", "query", "response"];
10
10
  export declare const TOPLEVEL_KEYWORDS: readonly ["collection", "contract", "functionset"];
11
11
  export declare const MISC_KEYWORDS: readonly ["extends"];
12
12
  export type Keyword = typeof COLLECTION_KEYWORDS[number] | typeof COLLECTION_ACTIONS_KEYWORDS[number] | typeof COLLECTION_SEARCH_KEYWORDS[number] | typeof COLLECTION_LAYOUT_KEYWORDS[number] | typeof COLLECTION_LAYOUT_OPTIONS_KEYWORDS[number] | typeof COLLECTION_FORM_LAYOUT_KEYWORDS[number] | typeof CONTRACT_KEYWORDS[number] | typeof TOPLEVEL_KEYWORDS[number] | typeof MISC_KEYWORDS[number];
package/dist/lexer.js CHANGED
@@ -66,6 +66,7 @@ export const COLLECTION_FORM_LAYOUT_KEYWORDS = [
66
66
  'separator',
67
67
  ];
68
68
  export const CONTRACT_KEYWORDS = [
69
+ 'streamed',
69
70
  'roles',
70
71
  'payload',
71
72
  'query',
package/dist/parser.js CHANGED
@@ -419,7 +419,7 @@ export const parse = (tokens) => {
419
419
  }
420
420
  }
421
421
  consume(TokenType.RightSquareBracket);
422
- const { property: items, nestedProperties } = parsePropertyType(options);
422
+ const { property: items, nestedProperties, nestedAdditionalProperties } = parsePropertyType(options);
423
423
  property = {
424
424
  ...arrayProperty,
425
425
  items,
@@ -429,6 +429,7 @@ export const parse = (tokens) => {
429
429
  kind: 'property',
430
430
  property,
431
431
  nestedProperties,
432
+ nestedAdditionalProperties,
432
433
  };
433
434
  }
434
435
  locationMap.set(typeSymbol, current().location);
@@ -781,6 +782,10 @@ export const parse = (tokens) => {
781
782
  while (!match(TokenType.RightBracket)) {
782
783
  const { value: keyword } = consume(TokenType.Keyword, lexer.CONTRACT_KEYWORDS);
783
784
  switch (keyword) {
785
+ case 'streamed': {
786
+ node.streamed = consume(TokenType.Boolean).value;
787
+ break;
788
+ }
784
789
  case 'roles': {
785
790
  node.roles = parseAccessCondition({
786
791
  arrayBlock: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aeriajs/compiler",
3
3
  "type": "module",
4
- "version": "0.0.69",
4
+ "version": "0.0.71",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",