@cedarjs/structure 2.8.1-next.109 → 2.8.1-rc.3

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 (110) hide show
  1. package/README.md +1 -1
  2. package/dist/errors.js +15 -9
  3. package/dist/index.d.ts +7 -7
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +67 -40
  6. package/dist/model/RWCell.d.ts +4 -4
  7. package/dist/model/RWCell.d.ts.map +1 -1
  8. package/dist/model/RWCell.js +103 -111
  9. package/dist/model/RWComponent.d.ts +2 -2
  10. package/dist/model/RWComponent.d.ts.map +1 -1
  11. package/dist/model/RWComponent.js +41 -46
  12. package/dist/model/RWEnvHelper.d.ts +4 -4
  13. package/dist/model/RWEnvHelper.d.ts.map +1 -1
  14. package/dist/model/RWEnvHelper.js +205 -212
  15. package/dist/model/RWFunction.d.ts +2 -2
  16. package/dist/model/RWFunction.d.ts.map +1 -1
  17. package/dist/model/RWFunction.js +15 -10
  18. package/dist/model/RWLayout.d.ts +2 -2
  19. package/dist/model/RWLayout.d.ts.map +1 -1
  20. package/dist/model/RWLayout.js +15 -10
  21. package/dist/model/RWPage.d.ts +3 -3
  22. package/dist/model/RWPage.d.ts.map +1 -1
  23. package/dist/model/RWPage.js +57 -61
  24. package/dist/model/RWProject.d.ts +17 -11
  25. package/dist/model/RWProject.d.ts.map +1 -1
  26. package/dist/model/RWProject.js +164 -218
  27. package/dist/model/RWRoute.d.ts +5 -5
  28. package/dist/model/RWRoute.d.ts.map +1 -1
  29. package/dist/model/RWRoute.js +262 -312
  30. package/dist/model/RWRouter.d.ts +4 -4
  31. package/dist/model/RWRouter.d.ts.map +1 -1
  32. package/dist/model/RWRouter.js +126 -130
  33. package/dist/model/RWSDL.d.ts +5 -5
  34. package/dist/model/RWSDL.d.ts.map +1 -1
  35. package/dist/model/RWSDL.js +84 -96
  36. package/dist/model/RWSDLField.d.ts +6 -6
  37. package/dist/model/RWSDLField.d.ts.map +1 -1
  38. package/dist/model/RWSDLField.js +81 -79
  39. package/dist/model/RWService.d.ts +4 -4
  40. package/dist/model/RWService.d.ts.map +1 -1
  41. package/dist/model/RWService.js +76 -76
  42. package/dist/model/RWServiceFunction.d.ts +4 -4
  43. package/dist/model/RWServiceFunction.d.ts.map +1 -1
  44. package/dist/model/RWServiceFunction.js +97 -95
  45. package/dist/model/RWTOML.d.ts +3 -3
  46. package/dist/model/RWTOML.d.ts.map +1 -1
  47. package/dist/model/RWTOML.js +55 -53
  48. package/dist/model/index.d.ts +2 -2
  49. package/dist/model/index.d.ts.map +1 -1
  50. package/dist/model/index.js +20 -3
  51. package/dist/model/util/process_env.js +62 -44
  52. package/dist/nodes.d.ts +2 -2
  53. package/dist/nodes.d.ts.map +1 -1
  54. package/dist/nodes.js +164 -171
  55. package/dist/util.js +33 -23
  56. package/dist/x/Array.js +25 -15
  57. package/dist/x/Location.d.ts +1 -1
  58. package/dist/x/Location.d.ts.map +1 -1
  59. package/dist/x/Location.js +17 -11
  60. package/dist/x/Position.js +29 -18
  61. package/dist/x/Range.d.ts +1 -1
  62. package/dist/x/Range.d.ts.map +1 -1
  63. package/dist/x/Range.js +22 -17
  64. package/dist/x/URL.js +75 -59
  65. package/dist/x/child_process.d.ts +1 -1
  66. package/dist/x/child_process.d.ts.map +1 -1
  67. package/dist/x/child_process.js +49 -35
  68. package/dist/x/decorators.d.ts +2 -2
  69. package/dist/x/decorators.d.ts.map +1 -1
  70. package/dist/x/decorators.js +26 -46
  71. package/dist/x/diagnostics.d.ts +3 -3
  72. package/dist/x/diagnostics.d.ts.map +1 -1
  73. package/dist/x/diagnostics.js +259 -163
  74. package/dist/x/path.js +55 -36
  75. package/dist/x/prisma.d.ts +2 -2
  76. package/dist/x/prisma.d.ts.map +1 -1
  77. package/dist/x/prisma.js +55 -32
  78. package/dist/x/ts-morph.js +45 -34
  79. package/package.json +17 -38
  80. package/dist/errors.js.map +0 -1
  81. package/dist/index.js.map +0 -1
  82. package/dist/model/RWCell.js.map +0 -1
  83. package/dist/model/RWComponent.js.map +0 -1
  84. package/dist/model/RWEnvHelper.js.map +0 -1
  85. package/dist/model/RWFunction.js.map +0 -1
  86. package/dist/model/RWLayout.js.map +0 -1
  87. package/dist/model/RWPage.js.map +0 -1
  88. package/dist/model/RWProject.js.map +0 -1
  89. package/dist/model/RWRoute.js.map +0 -1
  90. package/dist/model/RWRouter.js.map +0 -1
  91. package/dist/model/RWSDL.js.map +0 -1
  92. package/dist/model/RWSDLField.js.map +0 -1
  93. package/dist/model/RWService.js.map +0 -1
  94. package/dist/model/RWServiceFunction.js.map +0 -1
  95. package/dist/model/RWTOML.js.map +0 -1
  96. package/dist/model/index.js.map +0 -1
  97. package/dist/model/util/process_env.js.map +0 -1
  98. package/dist/nodes.js.map +0 -1
  99. package/dist/util.js.map +0 -1
  100. package/dist/x/Array.js.map +0 -1
  101. package/dist/x/Location.js.map +0 -1
  102. package/dist/x/Position.js.map +0 -1
  103. package/dist/x/Range.js.map +0 -1
  104. package/dist/x/URL.js.map +0 -1
  105. package/dist/x/child_process.js.map +0 -1
  106. package/dist/x/decorators.js.map +0 -1
  107. package/dist/x/diagnostics.js.map +0 -1
  108. package/dist/x/path.js.map +0 -1
  109. package/dist/x/prisma.js.map +0 -1
  110. package/dist/x/ts-morph.js.map +0 -1
@@ -1,222 +1,215 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import fs from 'node:fs';
8
- import { join } from 'node:path';
9
- import * as dotenv from 'dotenv-defaults';
10
- import pickBy from 'lodash/pickBy.js';
11
- import { getSchemaPath } from '@cedarjs/project-config';
12
- import { BaseNode } from '../nodes.js';
13
- import { lazy } from '../x/decorators.js';
14
- import { LocationLike_toHashLink, LocationLike_toLocation, } from '../x/diagnostics.js';
15
- import { DiagnosticSeverity } from '../x/diagnostics.js';
16
- import { prisma_parseEnvExpressionsInFile } from '../x/prisma.js';
17
- import { process_env_findAll } from './util/process_env.js';
18
- export class RWEnvHelper extends BaseNode {
19
- parent;
20
- constructor(parent) {
21
- super();
22
- this.parent = parent;
23
- }
24
- get id() {
25
- // this is an internal node. it is not associated to any particular file
26
- return this.parent.id + ' envHelper';
27
- }
28
- bailOutOnCollection() {
29
- // we need this node to participate in all collection requests
30
- // because it will emit info and diagnostics for files all over the codebase
31
- return false;
32
- }
33
- /**
34
- * parse .env
35
- * return undefined if not present
36
- * NOTE: It does not apply defaults (see env_merged)
37
- */
38
- get env() {
39
- return this._dotenv('.env');
40
- }
41
- /**
42
- * .env.defaults
43
- * return undefined if not present
44
- */
45
- get env_defaults() {
46
- return this._dotenv('.env.defaults');
47
- }
48
- get api_prisma_env() {
49
- return this._dotenv('api/prisma/.env');
50
- }
51
- /**
52
- * .env.defaults + .env
53
- * uses the same algorithm that env-defaults does (Object.assign(), which is equivalent to object spread addition)
54
- */
55
- get env_default_merged() {
56
- return { ...(this.env_defaults ?? {}), ...(this.env ?? {}) };
57
- }
58
- /**
59
- * - starts with .env + .env.defaults
60
- * - allows any variables prefixed with 'REDWOOD_ENV_'
61
- * - applies the "include" rule on the rest
62
- * @param include
63
- */
64
- env_default_merged_filtered(include) {
65
- return pickBy(this.env_default_merged, (_v, k) => k.startsWith('REDWOOD_ENV_') || include?.includes(k));
66
- }
67
- _dotenv(f) {
68
- const file = join(this.parent.pathHelper.base, f);
69
- if (!fs.existsSync(file)) {
70
- return undefined;
71
- }
72
- return dotenv.parse(fs.readFileSync(file, 'utf-8'));
73
- }
74
- get env_available_to_api() {
75
- // in the API side, all variables are visible
76
- return this.env_default_merged;
77
- // return this.env_merged_filter(
78
- // this.parent.redwoodTOML.api_includeEnvironmentVariables ?? []
79
- // )
80
- }
81
- get env_available_to_web() {
82
- return this.env_default_merged_filtered(this.parent.redwoodTOML.web_includeEnvironmentVariables ?? []);
83
- }
84
- async children() {
85
- return [...(await this.process_env_expressions())];
86
- }
87
- async process_env_expressions() {
88
- const { pathHelper } = this.parent;
89
- const api = process_env_findAll(pathHelper.api.base).map((x) => new ProcessDotEnvExpression(this, 'api', x.key, x.node));
90
- const web = process_env_findAll(pathHelper.web.base).map((x) => new ProcessDotEnvExpression(this, 'web', x.key, x.node));
91
- const schemaPath = await getSchemaPath(pathHelper.api.prismaConfig);
92
- const prisma = Array.from(prisma_parseEnvExpressionsInFile(schemaPath));
93
- const pp = prisma.map((x) => new ProcessDotEnvExpression(this, 'prisma', x.key, x.location));
94
- return [...api, ...web, ...pp];
95
- }
96
- }
97
- __decorate([
98
- lazy()
99
- ], RWEnvHelper.prototype, "id", null);
100
- __decorate([
101
- lazy()
102
- ], RWEnvHelper.prototype, "env", null);
103
- __decorate([
104
- lazy()
105
- ], RWEnvHelper.prototype, "env_defaults", null);
106
- __decorate([
107
- lazy()
108
- ], RWEnvHelper.prototype, "api_prisma_env", null);
109
- __decorate([
110
- lazy()
111
- ], RWEnvHelper.prototype, "env_default_merged", null);
112
- __decorate([
113
- lazy()
114
- ], RWEnvHelper.prototype, "env_available_to_api", null);
115
- __decorate([
116
- lazy()
117
- ], RWEnvHelper.prototype, "env_available_to_web", null);
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
5
+ var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
6
+ _Object$defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.RWEnvHelper = void 0;
10
+ var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/starts-with"));
11
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/includes"));
12
+ var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/bind"));
13
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
14
+ var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/array/from"));
15
+ var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
16
+ var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
17
+ var _nodeFs = _interopRequireDefault(require("node:fs"));
18
+ var _nodePath = require("node:path");
19
+ var dotenv = _interopRequireWildcard(require("dotenv-defaults"));
20
+ var _pickBy = _interopRequireDefault(require("lodash/pickBy.js"));
21
+ var _projectConfig = require("@cedarjs/project-config");
22
+ var _nodes = require("../nodes");
23
+ var _decorators = require("../x/decorators");
24
+ var _diagnostics = require("../x/diagnostics");
25
+ var _prisma = require("../x/prisma");
26
+ var _process_env = require("./util/process_env");
27
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _dec8, _dec9, _dec0, _dec1, _dec10, _class2;
28
+ let RWEnvHelper = exports.RWEnvHelper = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _dec3 = (0, _decorators.lazy)(), _dec4 = (0, _decorators.lazy)(), _dec5 = (0, _decorators.lazy)(), _dec6 = (0, _decorators.lazy)(), _dec7 = (0, _decorators.lazy)(), _class = class RWEnvHelper extends _nodes.BaseNode {
29
+ constructor(parent) {
30
+ super();
31
+ this.parent = parent;
32
+ }
33
+ get id() {
34
+ // this is an internal node. it is not associated to any particular file
35
+ return this.parent.id + ' envHelper';
36
+ }
37
+ bailOutOnCollection() {
38
+ // we need this node to participate in all collection requests
39
+ // because it will emit info and diagnostics for files all over the codebase
40
+ return false;
41
+ }
42
+
43
+ /**
44
+ * parse .env
45
+ * return undefined if not present
46
+ * NOTE: It does not apply defaults (see env_merged)
47
+ */
48
+ get env() {
49
+ return this._dotenv('.env');
50
+ }
51
+
52
+ /**
53
+ * .env.defaults
54
+ * return undefined if not present
55
+ */
56
+ get env_defaults() {
57
+ return this._dotenv('.env.defaults');
58
+ }
59
+ get api_prisma_env() {
60
+ return this._dotenv('api/prisma/.env');
61
+ }
62
+
63
+ /**
64
+ * .env.defaults + .env
65
+ * uses the same algorithm that env-defaults does (Object.assign(), which is equivalent to object spread addition)
66
+ */
67
+ get env_default_merged() {
68
+ return {
69
+ ...(this.env_defaults ?? {}),
70
+ ...(this.env ?? {})
71
+ };
72
+ }
73
+
74
+ /**
75
+ * - starts with .env + .env.defaults
76
+ * - allows any variables prefixed with 'REDWOOD_ENV_'
77
+ * - applies the "include" rule on the rest
78
+ * @param include
79
+ */
80
+ env_default_merged_filtered(include) {
81
+ return (0, _pickBy.default)(this.env_default_merged, (_v, k) => {
82
+ var _context, _context2;
83
+ return (0, _startsWith.default)(k).call(k, 'REDWOOD_ENV_') || ((_context = include) == null ? void 0 : (0, _bind.default)(_context2 = Function.call).call(_context2, (0, _includes.default)(_context), _context))?.(k);
84
+ });
85
+ }
86
+ _dotenv(f) {
87
+ const file = (0, _nodePath.join)(this.parent.projectRoot, f);
88
+ if (!_nodeFs.default.existsSync(file)) {
89
+ return undefined;
90
+ }
91
+ return dotenv.parse(_nodeFs.default.readFileSync(file, 'utf-8'));
92
+ }
93
+ get env_available_to_api() {
94
+ // in the API side, all variables are visible
95
+ return this.env_default_merged;
96
+ // return this.env_merged_filter(
97
+ // this.parent.redwoodTOML.api_includeEnvironmentVariables ?? []
98
+ // )
99
+ }
100
+ get env_available_to_web() {
101
+ return this.env_default_merged_filtered(this.parent.redwoodTOML.web_includeEnvironmentVariables ?? []);
102
+ }
103
+ async children() {
104
+ return [...(await this.process_env_expressions())];
105
+ }
106
+ async process_env_expressions() {
107
+ var _context3, _context4;
108
+ const {
109
+ pathHelper
110
+ } = this.parent;
111
+ const api = (0, _map.default)(_context3 = (0, _process_env.process_env_findAll)(pathHelper.api.base)).call(_context3, x => new ProcessDotEnvExpression(this, 'api', x.key, x.node));
112
+ const web = (0, _map.default)(_context4 = (0, _process_env.process_env_findAll)(pathHelper.web.base)).call(_context4, x => new ProcessDotEnvExpression(this, 'web', x.key, x.node));
113
+ const schemaPath = await (0, _projectConfig.getSchemaPath)(pathHelper.api.prismaConfig);
114
+ const prisma = (0, _from.default)((0, _prisma.prisma_parseEnvExpressionsInFile)(schemaPath));
115
+ const pp = (0, _map.default)(prisma).call(prisma, x => new ProcessDotEnvExpression(this, 'prisma', x.key, x.location));
116
+ return [...api, ...web, ...pp];
117
+ }
118
+ }, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "id", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "id"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "env", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "env"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "env_defaults", [_dec3], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "env_defaults"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "api_prisma_env", [_dec4], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "api_prisma_env"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "env_default_merged", [_dec5], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "env_default_merged"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "env_available_to_api", [_dec6], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "env_available_to_api"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "env_available_to_web", [_dec7], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "env_available_to_web"), _class.prototype), _class);
118
119
  /**
119
120
  * An occurrence of process.env somewhere in the codebase
120
121
  */
121
- class ProcessDotEnvExpression extends BaseNode {
122
- parent;
123
- kind;
124
- key;
125
- node;
126
- constructor(parent, kind, key, node) {
127
- super();
128
- this.parent = parent;
129
- this.kind = kind;
130
- this.key = key;
131
- this.node = node;
132
- }
133
- bailOutOnCollection(uri) {
134
- if (this.location.uri !== uri) {
135
- return true;
136
- }
137
- return false;
138
- }
139
- get id() {
140
- // this is an internal node. it is not associated to any particular file
141
- // we just need to make sure the ID is unique and correctly nested
142
- return this.parent.id + ' ' + LocationLike_toHashLink(this.location);
143
- }
144
- get side() {
145
- return this.kind === 'web' ? 'web' : 'api';
146
- }
147
- get location() {
148
- return LocationLike_toLocation(this.node);
149
- }
150
- *diagnostics() {
151
- const { key, location, value_as_available } = this;
152
- const { uri, range } = location;
153
- if (typeof value_as_available === 'undefined') {
154
- // the value is not available
155
- // there are a few scenarios here...
156
- if (this.parent.env_default_merged[key]) {
157
- // value is actually in the merged env, but it is not visible here
158
- // this is probably because the user forgot to add an includeEnvironmentVariables rule
159
- const snippet = `
122
+ let ProcessDotEnvExpression = (_dec8 = (0, _decorators.lazy)(), _dec9 = (0, _decorators.lazy)(), _dec0 = (0, _decorators.lazy)(), _dec1 = (0, _decorators.lazy)(), _dec10 = (0, _decorators.lazy)(), _class2 = class ProcessDotEnvExpression extends _nodes.BaseNode {
123
+ constructor(parent, kind, key, node) {
124
+ super();
125
+ this.parent = parent;
126
+ this.kind = kind;
127
+ this.key = key;
128
+ this.node = node;
129
+ }
130
+ bailOutOnCollection(uri) {
131
+ if (this.location.uri !== uri) {
132
+ return true;
133
+ }
134
+ return false;
135
+ }
136
+ get id() {
137
+ // this is an internal node. it is not associated to any particular file
138
+ // we just need to make sure the ID is unique and correctly nested
139
+ return this.parent.id + ' ' + (0, _diagnostics.LocationLike_toHashLink)(this.location);
140
+ }
141
+ get side() {
142
+ return this.kind === 'web' ? 'web' : 'api';
143
+ }
144
+ get location() {
145
+ return (0, _diagnostics.LocationLike_toLocation)(this.node);
146
+ }
147
+ *diagnostics() {
148
+ const {
149
+ key,
150
+ location,
151
+ value_as_available
152
+ } = this;
153
+ const {
154
+ uri,
155
+ range
156
+ } = location;
157
+ if (typeof value_as_available === 'undefined') {
158
+ // the value is not available
159
+ // there are a few scenarios here...
160
+ if (this.parent.env_default_merged[key]) {
161
+ // value is actually in the merged env, but it is not visible here
162
+ // this is probably because the user forgot to add an includeEnvironmentVariables rule
163
+ const snippet = `
160
164
  [${this.side}]
161
165
  includeEnvironmentVariables = ['${this.key}']`;
162
- yield {
163
- uri,
164
- diagnostic: {
165
- range,
166
- message: `
166
+ yield {
167
+ uri,
168
+ diagnostic: {
169
+ range,
170
+ message: `
167
171
  This env variable is present in '${this.value_definition_file_basename}',
168
172
  but it won't be available to your app in production *unless* you add it to includeEnvironmentVariables.
169
173
  Tip: add the following to your cedar.toml (or redwood.toml):
170
174
  ${snippet}
171
175
  `,
172
- severity: DiagnosticSeverity.Warning,
173
- },
174
- };
175
- }
176
- else {
177
- // the value is simply not visible
178
- yield {
179
- uri,
180
- diagnostic: {
181
- range,
182
- message: `env value ${key} is not available. add it to your .env file`,
183
- severity: DiagnosticSeverity.Warning,
184
- },
185
- };
186
- }
187
- }
188
- }
189
- get value_definition_file_basename() {
190
- const { key, parent: { env, env_defaults }, } = this;
191
- if (env?.[key]) {
192
- return '.env';
193
- }
194
- if (env_defaults?.[key]) {
195
- return '.env.defaults';
196
- }
197
- return undefined;
198
- }
199
- get value_as_available() {
200
- if (this.side === 'web') {
201
- return this.parent.env_available_to_web[this.key];
202
- }
203
- const v = this.parent.env_available_to_api[this.key];
204
- return v;
205
- }
206
- }
207
- __decorate([
208
- lazy()
209
- ], ProcessDotEnvExpression.prototype, "id", null);
210
- __decorate([
211
- lazy()
212
- ], ProcessDotEnvExpression.prototype, "side", null);
213
- __decorate([
214
- lazy()
215
- ], ProcessDotEnvExpression.prototype, "location", null);
216
- __decorate([
217
- lazy()
218
- ], ProcessDotEnvExpression.prototype, "value_definition_file_basename", null);
219
- __decorate([
220
- lazy()
221
- ], ProcessDotEnvExpression.prototype, "value_as_available", null);
222
- //# sourceMappingURL=RWEnvHelper.js.map
176
+ severity: _diagnostics.DiagnosticSeverity.Warning
177
+ }
178
+ };
179
+ } else {
180
+ // the value is simply not visible
181
+ yield {
182
+ uri,
183
+ diagnostic: {
184
+ range,
185
+ message: `env value ${key} is not available. add it to your .env file`,
186
+ severity: _diagnostics.DiagnosticSeverity.Warning
187
+ }
188
+ };
189
+ }
190
+ }
191
+ }
192
+ get value_definition_file_basename() {
193
+ const {
194
+ key,
195
+ parent: {
196
+ env,
197
+ env_defaults
198
+ }
199
+ } = this;
200
+ if (env?.[key]) {
201
+ return '.env';
202
+ }
203
+ if (env_defaults?.[key]) {
204
+ return '.env.defaults';
205
+ }
206
+ return undefined;
207
+ }
208
+ get value_as_available() {
209
+ if (this.side === 'web') {
210
+ return this.parent.env_available_to_web[this.key];
211
+ }
212
+ const v = this.parent.env_available_to_api[this.key];
213
+ return v;
214
+ }
215
+ }, (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "id", [_dec8], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "id"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "side", [_dec9], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "side"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "location", [_dec0], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "location"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "value_definition_file_basename", [_dec1], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "value_definition_file_basename"), _class2.prototype), (0, _applyDecoratedDescriptor2.default)(_class2.prototype, "value_as_available", [_dec10], (0, _getOwnPropertyDescriptor.default)(_class2.prototype, "value_as_available"), _class2.prototype), _class2);
@@ -1,5 +1,5 @@
1
- import { FileNode } from '../nodes.js';
2
- import type { RWProject } from './RWProject.js';
1
+ import { FileNode } from '../nodes';
2
+ import type { RWProject } from './RWProject';
3
3
  /**
4
4
  * functions exist in the /functions folder
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"RWFunction.d.ts","sourceRoot":"","sources":["../../src/model/RWFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C;;GAEG;AACH,qBAAa,UAAW,SAAQ,QAAQ;IAE7B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,SAAS;gBADjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS;CAI3B"}
1
+ {"version":3,"file":"RWFunction.d.ts","sourceRoot":"","sources":["../../src/model/RWFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C;;GAEG;AACH,qBAAa,UAAW,SAAQ,QAAQ;IAE7B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,SAAS;gBADjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS;CAI3B"}
@@ -1,14 +1,19 @@
1
- import { FileNode } from '../nodes.js';
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.RWFunction = void 0;
8
+ var _nodes = require("../nodes");
2
9
  /**
3
10
  * functions exist in the /functions folder
4
11
  */
5
- export class RWFunction extends FileNode {
6
- filePath;
7
- parent;
8
- constructor(filePath, parent) {
9
- super();
10
- this.filePath = filePath;
11
- this.parent = parent;
12
- }
12
+ class RWFunction extends _nodes.FileNode {
13
+ constructor(filePath, parent) {
14
+ super();
15
+ this.filePath = filePath;
16
+ this.parent = parent;
17
+ }
13
18
  }
14
- //# sourceMappingURL=RWFunction.js.map
19
+ exports.RWFunction = RWFunction;
@@ -1,5 +1,5 @@
1
- import { FileNode } from '../nodes.js';
2
- import type { RWProject } from './RWProject.js';
1
+ import { FileNode } from '../nodes';
2
+ import type { RWProject } from './RWProject';
3
3
  /**
4
4
  * layouts live in the src/layouts folder
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"RWLayout.d.ts","sourceRoot":"","sources":["../../src/model/RWLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C;;GAEG;AACH,qBAAa,QAAS,SAAQ,QAAQ;IAE3B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,SAAS;gBADjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS;CAI3B"}
1
+ {"version":3,"file":"RWLayout.d.ts","sourceRoot":"","sources":["../../src/model/RWLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C;;GAEG;AACH,qBAAa,QAAS,SAAQ,QAAQ;IAE3B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,SAAS;gBADjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS;CAI3B"}
@@ -1,14 +1,19 @@
1
- import { FileNode } from '../nodes.js';
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.RWLayout = void 0;
8
+ var _nodes = require("../nodes");
2
9
  /**
3
10
  * layouts live in the src/layouts folder
4
11
  */
5
- export class RWLayout extends FileNode {
6
- filePath;
7
- parent;
8
- constructor(filePath, parent) {
9
- super();
10
- this.filePath = filePath;
11
- this.parent = parent;
12
- }
12
+ class RWLayout extends _nodes.FileNode {
13
+ constructor(filePath, parent) {
14
+ super();
15
+ this.filePath = filePath;
16
+ this.parent = parent;
17
+ }
13
18
  }
14
- //# sourceMappingURL=RWLayout.js.map
19
+ exports.RWLayout = RWLayout;
@@ -1,12 +1,12 @@
1
- import { FileNode } from '../nodes.js';
2
- import type { RWProject } from './RWProject.js';
1
+ import { FileNode } from '../nodes';
2
+ import type { RWProject } from './RWProject';
3
3
  export declare class RWPage extends FileNode {
4
4
  constName: string;
5
5
  path: string;
6
6
  parent: RWProject;
7
7
  constructor(constName: string, path: string, parent: RWProject);
8
8
  get filePath(): string;
9
- get route(): import("./RWRoute.js").RWRoute | undefined;
9
+ get route(): import("./RWRoute").RWRoute | undefined;
10
10
  get layoutName(): string | undefined;
11
11
  get actionRemove(): Map<any, any>;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RWPage.d.ts","sourceRoot":"","sources":["../../src/model/RWPage.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,qBAAa,MAAO,SAAQ,QAAQ;IAEzB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;gBAFjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS;IAI1B,IAAY,QAAQ,WAEnB;IACD,IAAY,KAAK,+CAIhB;IACD,IAAY,UAAU,IAAI,MAAM,GAAG,SAAS,CAc3C;IACD,IAAY,YAAY,kBAUvB;CACF"}
1
+ {"version":3,"file":"RWPage.d.ts","sourceRoot":"","sources":["../../src/model/RWPage.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qBAAa,MAAO,SAAQ,QAAQ;IAEzB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;gBAFjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS;IAI1B,IAAY,QAAQ,WAEnB;IACD,IAAY,KAAK,4CAIhB;IACD,IAAY,UAAU,IAAI,MAAM,GAAG,SAAS,CAc3C;IACD,IAAY,YAAY,kBAUvB;CACF"}