@ohos-npm-ports/prisma-composer-cli 0.0.0-stage → 8.0.0-rc.33-1
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/LICENSE +201 -0
- package/dist/app-config-CErnR6NK-DnKH4Kqc.mjs +32 -0
- package/dist/app-config-CErnR6NK-DnKH4Kqc.mjs.map +1 -0
- package/dist/app-configuration-file-CeJvBAti-Dk65W3Az.mjs +140 -0
- package/dist/app-configuration-file-CeJvBAti-Dk65W3Az.mjs.map +1 -0
- package/dist/config-DiZaanS3.mjs +64 -0
- package/dist/config-DiZaanS3.mjs.map +1 -0
- package/dist/dev-current-D-Qb6Yem-CvaY4xsk.mjs +120 -0
- package/dist/dev-current-D-Qb6Yem-CvaY4xsk.mjs.map +1 -0
- package/dist/dev-environment-name-6eEr5PW8-DpdGjmTb.mjs +71 -0
- package/dist/dev-environment-name-6eEr5PW8-DpdGjmTb.mjs.map +1 -0
- package/dist/dist-BH6HQ6zZ.mjs +1791 -0
- package/dist/dist-BH6HQ6zZ.mjs.map +1 -0
- package/dist/execute-deploy-destroy-C6EsdmLz-DqdToZ_i.mjs +649 -0
- package/dist/execute-deploy-destroy-C6EsdmLz-DqdToZ_i.mjs.map +1 -0
- package/dist/execute-dev-current-tBKmDAjV-DOOMGrl5.mjs +164 -0
- package/dist/execute-dev-current-tBKmDAjV-DOOMGrl5.mjs.map +1 -0
- package/dist/execute-dev-gjIKYybU-hRndPEgC.mjs +2219 -0
- package/dist/execute-dev-gjIKYybU-hRndPEgC.mjs.map +1 -0
- package/dist/family.d.mts +103 -0
- package/dist/family.d.mts.map +1 -0
- package/dist/family.mjs +952 -0
- package/dist/family.mjs.map +1 -0
- package/dist/generate-dev-stack-BV_n-X9n-BDBjgphH.mjs +100 -0
- package/dist/generate-dev-stack-BV_n-X9n-BDBjgphH.mjs.map +1 -0
- package/dist/list-deployed-IL0MgmTX.mjs +380 -0
- package/dist/list-deployed-IL0MgmTX.mjs.map +1 -0
- package/dist/redaction-Bf8FvTFH-D0dXGsO8.d.mts +1923 -0
- package/dist/redaction-Bf8FvTFH-D0dXGsO8.d.mts.map +1 -0
- package/dist/redaction-HnbkSFrK-CCKJNRwi.mjs +534 -0
- package/dist/redaction-HnbkSFrK-CCKJNRwi.mjs.map +1 -0
- package/dist/result-sR7PBi61.mjs +229 -0
- package/dist/result-sR7PBi61.mjs.map +1 -0
- package/dist/run-alchemy-OS_ix5g0-DSlHsv2p.mjs +236 -0
- package/dist/run-alchemy-OS_ix5g0-DSlHsv2p.mjs.map +1 -0
- package/dist/testing.d.mts +94 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +157 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/validate-environment-CpQLC3CA-Ct-PXoKN.mjs +2517 -0
- package/dist/validate-environment-CpQLC3CA-Ct-PXoKN.mjs.map +1 -0
- package/package.json +42 -4
- package/src/exports/family.ts +50 -0
- package/src/exports/testing.ts +9 -0
- package/src/family/deploy-list.ts +103 -0
- package/src/family/deployed-nodes.ts +55 -0
- package/src/family/emulator-list.ts +115 -0
- package/src/family/list-deployed.ts +64 -0
- package/README.md +0 -3
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 [2026] [Prisma Data, Inc]
|
|
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.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region ../../0-framework/1-core/core/dist/app-config-CErnR6NK.mjs
|
|
2
|
+
/** `<cwd>/.prisma-composer/dev` — local dev's state directory (ADR-0041, ADR-0004's tool-state rule), holding one folder per environment. */
|
|
3
|
+
const DEV_DIR = ".prisma-composer/dev";
|
|
4
|
+
/**
|
|
5
|
+
* The folder, relative to the cwd, that holds one environment's local copy.
|
|
6
|
+
* The environment name is percent-encoded (`encodeURIComponent`), so a name
|
|
7
|
+
* with `/` stays one folder and `decodeURIComponent` gives the name back.
|
|
8
|
+
*/
|
|
9
|
+
function devEnvironmentDir(environment) {
|
|
10
|
+
return `${DEV_DIR}/${encodeURIComponent(environment)}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The file in an environment's folder that holds the environment's exact
|
|
14
|
+
* name. On a case-insensitive filesystem `Dev` and `dev` share one folder;
|
|
15
|
+
* the recorded name tells them apart.
|
|
16
|
+
*/
|
|
17
|
+
const DEV_ENVIRONMENT_NAME_FILE = "environment-name";
|
|
18
|
+
/**
|
|
19
|
+
* True when an extension only participates in assembly (every `nodes` entry
|
|
20
|
+
* is `kind: 'build'`, and it declares none of `providers`/`application`/
|
|
21
|
+
* `provisions`/`container`) — it owns no resources or services, so it has
|
|
22
|
+
* nothing to emulate and is exempt from local-target-capability requirements
|
|
23
|
+
* (ADR-0041). Shared by `localTargetProviders` and every local-target hook
|
|
24
|
+
* iteration.
|
|
25
|
+
*/
|
|
26
|
+
function isBuildOnlyExtension(extension) {
|
|
27
|
+
return Object.values(extension.nodes).every((node) => node.kind === "build") && extension.providers === void 0 && extension.application === void 0 && extension.provisions === void 0 && extension.container === void 0;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { isBuildOnlyExtension as i, DEV_ENVIRONMENT_NAME_FILE as n, devEnvironmentDir as r, DEV_DIR as t };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=app-config-CErnR6NK-DnKH4Kqc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-config-CErnR6NK-DnKH4Kqc.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-CErnR6NK.mjs"],"sourcesContent":["//#region src/control/app-config.ts\n/** `<cwd>/.prisma-composer/dev` — local dev's state directory (ADR-0041, ADR-0004's tool-state rule), holding one folder per environment. */\nconst DEV_DIR = \".prisma-composer/dev\";\n/**\n* The folder, relative to the cwd, that holds one environment's local copy.\n* The environment name is percent-encoded (`encodeURIComponent`), so a name\n* with `/` stays one folder and `decodeURIComponent` gives the name back.\n*/\nfunction devEnvironmentDir(environment) {\n\treturn `${DEV_DIR}/${encodeURIComponent(environment)}`;\n}\n/**\n* The file in an environment's folder that holds the environment's exact\n* name. On a case-insensitive filesystem `Dev` and `dev` share one folder;\n* the recorded name tells them apart.\n*/\nconst DEV_ENVIRONMENT_NAME_FILE = \"environment-name\";\n/**\n* True when an extension only participates in assembly (every `nodes` entry\n* is `kind: 'build'`, and it declares none of `providers`/`application`/\n* `provisions`/`container`) — it owns no resources or services, so it has\n* nothing to emulate and is exempt from local-target-capability requirements\n* (ADR-0041). Shared by `localTargetProviders` and every local-target hook\n* iteration.\n*/\nfunction isBuildOnlyExtension(extension) {\n\treturn Object.values(extension.nodes).every((node) => node.kind === \"build\") && extension.providers === void 0 && extension.application === void 0 && extension.provisions === void 0 && extension.container === void 0;\n}\n/** Typed identity — exists so the `composer` section of `prisma.config.ts` gets checked against PrismaAppConfig where it is written. */\nfunction defineConfig(config) {\n\treturn config;\n}\n//#endregion\nexport { isBuildOnlyExtension as a, devEnvironmentDir as i, DEV_ENVIRONMENT_NAME_FILE as n, defineConfig as r, DEV_DIR as t };\n\n//# sourceMappingURL=app-config-CErnR6NK.mjs.map"],"mappings":";;AAEA,MAAM,UAAU;;;;;;AAMhB,SAAS,kBAAkB,aAAa;CACvC,OAAO,GAAG,QAAQ,GAAG,mBAAmB,WAAW;AACpD;;;;;;AAMA,MAAM,4BAA4B;;;;;;;;;AASlC,SAAS,qBAAqB,WAAW;CACxC,OAAO,OAAO,OAAO,UAAU,KAAK,CAAC,CAAC,OAAO,SAAS,KAAK,SAAS,OAAO,KAAK,UAAU,cAAc,KAAK,KAAK,UAAU,gBAAgB,KAAK,KAAK,UAAU,eAAe,KAAK,KAAK,UAAU,cAAc,KAAK;AACvN"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { i as CliStructuredError } from "./result-sR7PBi61.mjs";
|
|
2
|
+
import { t as DEV_DIR } from "./app-config-CErnR6NK-DnKH4Kqc.mjs";
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
//#region ../../0-framework/3-tooling/cli/dist/app-configuration-file-CeJvBAti.mjs
|
|
6
|
+
/** Names the app configuration file the first process wrote for this run (ADR-0062). */
|
|
7
|
+
const APP_CONFIGURATION_FILE_ENV = "PRISMA_COMPOSER_APP_CONFIGURATION_FILE";
|
|
8
|
+
/** `prisma dev` only: the named secrets, as a JSON object. */
|
|
9
|
+
const NAMED_SECRETS_ENV = "PRISMA_COMPOSER_NAMED_SECRETS";
|
|
10
|
+
const FILE_NAME = /^app-configuration-(\d+)(-[^/]*)?\.json$/;
|
|
11
|
+
/** The app configuration file a deploy or destroy run writes: unique per run, so concurrent runs from one checkout never share one. */
|
|
12
|
+
function deployAppConfigurationFile(cwd, runId) {
|
|
13
|
+
return path.join(cwd, ".prisma-composer", `app-configuration-${String(process.pid)}-${runId}.json`);
|
|
14
|
+
}
|
|
15
|
+
/** The app configuration file `prisma dev` writes in an environment's folder. */
|
|
16
|
+
function devAppConfigurationFile(devDir) {
|
|
17
|
+
return path.join(devDir, `app-configuration-${String(process.pid)}.json`);
|
|
18
|
+
}
|
|
19
|
+
function isRunning(pid) {
|
|
20
|
+
try {
|
|
21
|
+
process.kill(pid, 0);
|
|
22
|
+
return true;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
return error instanceof Error && "code" in error && error.code === "EPERM";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in
|
|
29
|
+
* each dev environment's folder: a run killed before its exit handler ran leaves its file. A
|
|
30
|
+
* file is deleted only when its process is not running and it is older than
|
|
31
|
+
* `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.
|
|
32
|
+
*/
|
|
33
|
+
function removeLeftoverAppConfigurationFiles(cwd) {
|
|
34
|
+
const devRoot = path.join(cwd, DEV_DIR);
|
|
35
|
+
const dirs = [path.join(cwd, ".prisma-composer")];
|
|
36
|
+
try {
|
|
37
|
+
for (const entry of fs.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path.join(devRoot, entry.name));
|
|
38
|
+
} catch {}
|
|
39
|
+
for (const dir of dirs) {
|
|
40
|
+
let names;
|
|
41
|
+
try {
|
|
42
|
+
names = fs.readdirSync(dir);
|
|
43
|
+
} catch {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
for (const name of names) {
|
|
47
|
+
const pid = Number(FILE_NAME.exec(name)?.[1]);
|
|
48
|
+
if (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;
|
|
49
|
+
const file = path.join(dir, name);
|
|
50
|
+
try {
|
|
51
|
+
if (Date.now() - fs.statSync(file).mtimeMs < 6e5) continue;
|
|
52
|
+
fs.rmSync(file, { force: true });
|
|
53
|
+
} catch {}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function textIn(value, at) {
|
|
58
|
+
if (typeof value === "string") return [{
|
|
59
|
+
at,
|
|
60
|
+
text: value
|
|
61
|
+
}];
|
|
62
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return [{
|
|
63
|
+
at,
|
|
64
|
+
text: String(value)
|
|
65
|
+
}];
|
|
66
|
+
if (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));
|
|
67
|
+
if (typeof value === "object" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Refuses when the file would hold a known secret in a plain value, a number or a boolean
|
|
72
|
+
* compared as its text (`KnownSecrets.nameIn`). The message names where and the secrets key,
|
|
73
|
+
* never the value.
|
|
74
|
+
*/
|
|
75
|
+
function refuseSecretsIn(read, knownSecrets) {
|
|
76
|
+
const places = [...read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({
|
|
77
|
+
where: `Root input field input.${at.join(".")}`,
|
|
78
|
+
text
|
|
79
|
+
}))), ...Object.entries(read.configurationKeyText).map(([key, text]) => ({
|
|
80
|
+
where: `Configuration key "${key}"`,
|
|
81
|
+
text
|
|
82
|
+
}))];
|
|
83
|
+
for (const { where, text } of places) {
|
|
84
|
+
const name = knownSecrets.nameIn(text);
|
|
85
|
+
if (name === void 0) continue;
|
|
86
|
+
throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `${where} holds the value of the secret "${name}", which an envSecret() in the graph reads. Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.`, { fix: `Read the secret with envSecret('${name}') where it is used, or give this plain value text that does not contain the value of "${name}".` });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* First process: the handover to the second process (ADR-0062). The app configuration file at
|
|
91
|
+
* `file` holds what Load read and the graph's node addresses. With `appSecrets`, which only
|
|
92
|
+
* `prisma dev` passes, the environment also carries the named secrets: the app secrets under
|
|
93
|
+
* the graph's secrets keys, each with text. Refuses when the file would hold any of
|
|
94
|
+
* `knownSecrets`. Every other input is plain data from the graph, such as
|
|
95
|
+
* `graph.appConfigurationRead`, `nodeAddresses(graph)` and `secretsKeys(graph)`, so a caller with
|
|
96
|
+
* its own copy of Composer's core can pass them. The exception is `knownSecrets`, a
|
|
97
|
+
* `KnownSecrets`, which such a caller builds from the testing entry.
|
|
98
|
+
*/
|
|
99
|
+
function prepareSecondProcess(input) {
|
|
100
|
+
const { file, appSecrets } = input;
|
|
101
|
+
refuseSecretsIn(input.appConfigurationRead, input.knownSecrets);
|
|
102
|
+
const contents = {
|
|
103
|
+
appConfigurationRead: input.appConfigurationRead,
|
|
104
|
+
nodeAddresses: input.nodeAddresses
|
|
105
|
+
};
|
|
106
|
+
const env = { [APP_CONFIGURATION_FILE_ENV]: file };
|
|
107
|
+
if (appSecrets !== void 0) {
|
|
108
|
+
const named = {};
|
|
109
|
+
for (const key of input.secretsKeys) {
|
|
110
|
+
const text = appSecrets[key];
|
|
111
|
+
if (text !== void 0 && text !== "") named[key] = text;
|
|
112
|
+
}
|
|
113
|
+
env[NAMED_SECRETS_ENV] = JSON.stringify(named);
|
|
114
|
+
}
|
|
115
|
+
const remove = () => {
|
|
116
|
+
try {
|
|
117
|
+
fs.rmSync(file, { force: true });
|
|
118
|
+
} catch {}
|
|
119
|
+
};
|
|
120
|
+
return {
|
|
121
|
+
env,
|
|
122
|
+
writeFile() {
|
|
123
|
+
fs.rmSync(file, { force: true });
|
|
124
|
+
fs.writeFileSync(file, JSON.stringify(contents), {
|
|
125
|
+
mode: 384,
|
|
126
|
+
flag: "wx"
|
|
127
|
+
});
|
|
128
|
+
process.off("exit", remove);
|
|
129
|
+
process.on("exit", remove);
|
|
130
|
+
},
|
|
131
|
+
removeFile() {
|
|
132
|
+
process.off("exit", remove);
|
|
133
|
+
remove();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { removeLeftoverAppConfigurationFiles as i, devAppConfigurationFile as n, prepareSecondProcess as r, deployAppConfigurationFile as t };
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=app-configuration-file-CeJvBAti-Dk65W3Az.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-configuration-file-CeJvBAti-Dk65W3Az.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file-CeJvBAti.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { DEV_DIR } from \"@internal/core/config\";\n//#region src/app-configuration-file.ts\n/** Names the app configuration file the first process wrote for this run (ADR-0062). */\nconst APP_CONFIGURATION_FILE_ENV = \"PRISMA_COMPOSER_APP_CONFIGURATION_FILE\";\n/** `prisma dev` only: the named secrets, as a JSON object. */\nconst NAMED_SECRETS_ENV = \"PRISMA_COMPOSER_NAMED_SECRETS\";\nconst FILE_NAME = /^app-configuration-(\\d+)(-[^/]*)?\\.json$/;\n/** The app configuration file a deploy or destroy run writes: unique per run, so concurrent runs from one checkout never share one. */\nfunction deployAppConfigurationFile(cwd, runId) {\n\treturn path.join(cwd, \".prisma-composer\", `app-configuration-${String(process.pid)}-${runId}.json`);\n}\n/** The app configuration file `prisma dev` writes in an environment's folder. */\nfunction devAppConfigurationFile(devDir) {\n\treturn path.join(devDir, `app-configuration-${String(process.pid)}.json`);\n}\nfunction isRunning(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error instanceof Error && \"code\" in error && error.code === \"EPERM\";\n\t}\n}\n/**\n* Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in\n* each dev environment's folder: a run killed before its exit handler ran leaves its file. A\n* file is deleted only when its process is not running and it is older than\n* `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.\n*/\nfunction removeLeftoverAppConfigurationFiles(cwd) {\n\tconst devRoot = path.join(cwd, DEV_DIR);\n\tconst dirs = [path.join(cwd, \".prisma-composer\")];\n\ttry {\n\t\tfor (const entry of fs.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path.join(devRoot, entry.name));\n\t} catch {}\n\tfor (const dir of dirs) {\n\t\tlet names;\n\t\ttry {\n\t\t\tnames = fs.readdirSync(dir);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const name of names) {\n\t\t\tconst pid = Number(FILE_NAME.exec(name)?.[1]);\n\t\t\tif (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;\n\t\t\tconst file = path.join(dir, name);\n\t\t\ttry {\n\t\t\t\tif (Date.now() - fs.statSync(file).mtimeMs < 6e5) continue;\n\t\t\t\tfs.rmSync(file, { force: true });\n\t\t\t} catch {}\n\t\t}\n\t}\n}\nfunction textIn(value, at) {\n\tif (typeof value === \"string\") return [{\n\t\tat,\n\t\ttext: value\n\t}];\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") return [{\n\t\tat,\n\t\ttext: String(value)\n\t}];\n\tif (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));\n\tif (typeof value === \"object\" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));\n\treturn [];\n}\n/**\n* Refuses when the file would hold a known secret in a plain value, a number or a boolean\n* compared as its text (`KnownSecrets.nameIn`). The message names where and the secrets key,\n* never the value.\n*/\nfunction refuseSecretsIn(read, knownSecrets) {\n\tconst places = [...read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({\n\t\twhere: `Root input field input.${at.join(\".\")}`,\n\t\ttext\n\t}))), ...Object.entries(read.configurationKeyText).map(([key, text]) => ({\n\t\twhere: `Configuration key \"${key}\"`,\n\t\ttext\n\t}))];\n\tfor (const { where, text } of places) {\n\t\tconst name = knownSecrets.nameIn(text);\n\t\tif (name === void 0) continue;\n\t\tthrow new CliStructuredError(\"CONFIG.SECRET_AS_PLAIN_VALUE\", `${where} holds the value of the secret \"${name}\", which an envSecret() in the graph reads. Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.`, { fix: `Read the secret with envSecret('${name}') where it is used, or give this plain value text that does not contain the value of \"${name}\".` });\n\t}\n}\n/**\n* First process: the handover to the second process (ADR-0062). The app configuration file at\n* `file` holds what Load read and the graph's node addresses. With `appSecrets`, which only\n* `prisma dev` passes, the environment also carries the named secrets: the app secrets under\n* the graph's secrets keys, each with text. Refuses when the file would hold any of\n* `knownSecrets`. Every other input is plain data from the graph, such as\n* `graph.appConfigurationRead`, `nodeAddresses(graph)` and `secretsKeys(graph)`, so a caller with\n* its own copy of Composer's core can pass them. The exception is `knownSecrets`, a\n* `KnownSecrets`, which such a caller builds from the testing entry.\n*/\nfunction prepareSecondProcess(input) {\n\tconst { file, appSecrets } = input;\n\trefuseSecretsIn(input.appConfigurationRead, input.knownSecrets);\n\tconst contents = {\n\t\tappConfigurationRead: input.appConfigurationRead,\n\t\tnodeAddresses: input.nodeAddresses\n\t};\n\tconst env = { [APP_CONFIGURATION_FILE_ENV]: file };\n\tif (appSecrets !== void 0) {\n\t\tconst named = {};\n\t\tfor (const key of input.secretsKeys) {\n\t\t\tconst text = appSecrets[key];\n\t\t\tif (text !== void 0 && text !== \"\") named[key] = text;\n\t\t}\n\t\tenv[NAMED_SECRETS_ENV] = JSON.stringify(named);\n\t}\n\tconst remove = () => {\n\t\ttry {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t} catch {}\n\t};\n\treturn {\n\t\tenv,\n\t\twriteFile() {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t\tfs.writeFileSync(file, JSON.stringify(contents), {\n\t\t\t\tmode: 384,\n\t\t\t\tflag: \"wx\"\n\t\t\t});\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tprocess.on(\"exit\", remove);\n\t\t},\n\t\tremoveFile() {\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tremove();\n\t\t}\n\t};\n}\nfunction missingVariable(name, what) {\n\treturn `${name} is not set. This stack file runs as the second process of a Composer deploy, destroy or prisma dev, which ${what}.`;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isTextList(value) {\n\treturn Array.isArray(value) && value.every((member) => typeof member === \"string\");\n}\nfunction rootFieldsOf(value) {\n\tif (!Array.isArray(value)) return void 0;\n\tconst fields = [];\n\tfor (const member of value) {\n\t\tif (!isRecord(member) || !isTextList(member[\"path\"])) return void 0;\n\t\tfields.push(\"value\" in member ? {\n\t\t\tpath: member[\"path\"],\n\t\t\tvalue: member[\"value\"]\n\t\t} : { path: member[\"path\"] });\n\t}\n\treturn fields;\n}\nfunction textByKeyOf(value) {\n\tif (!isRecord(value)) return void 0;\n\tconst byKey = {};\n\tfor (const [key, member] of Object.entries(value)) {\n\t\tif (typeof member !== \"string\") return void 0;\n\t\tbyKey[key] = member;\n\t}\n\treturn byKey;\n}\n/** Second process: the app configuration file the first process named in its environment. */\nfunction readAppConfigurationFile(env) {\n\tconst file = env[APP_CONFIGURATION_FILE_ENV];\n\tif (file === void 0 || file === \"\") throw new Error(missingVariable(APP_CONFIGURATION_FILE_ENV, \"names the app configuration file it wrote there\"));\n\tlet text;\n\ttry {\n\t\ttext = fs.readFileSync(file, \"utf8\");\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });\n\t}\n\tconst notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not one Composer wrote: ${what}.`);\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tthrow notComposers(\"it is not JSON\");\n\t}\n\tif (!isRecord(parsed)) throw notComposers(\"it is not JSON\");\n\tconst read = parsed[\"appConfigurationRead\"];\n\tif (!isRecord(read)) throw notComposers(\"appConfigurationRead is not an object\");\n\tconst rootInput = rootFieldsOf(read[\"rootInput\"]);\n\tif (rootInput === void 0) throw notComposers(\"rootInput is not a list of fields\");\n\tconst configurationKeyText = textByKeyOf(read[\"configurationKeyText\"]);\n\tif (configurationKeyText === void 0) throw notComposers(\"configurationKeyText is not an object of text\");\n\tconst addresses = parsed[\"nodeAddresses\"];\n\tif (!isTextList(addresses)) throw notComposers(\"nodeAddresses is not a list of node addresses\");\n\treturn {\n\t\tappConfigurationRead: {\n\t\t\trootInput,\n\t\t\tconfigurationKeyText\n\t\t},\n\t\tnodeAddresses: addresses\n\t};\n}\n/** Second process, under `prisma dev`: the named secrets the first process handed it. */\nfunction namedSecretsFromEnvironment(env) {\n\tconst text = env[NAMED_SECRETS_ENV];\n\tif (text === void 0 || text === \"\") throw new Error(missingVariable(NAMED_SECRETS_ENV, \"hands the secrets the local services need there\"));\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tparsed = void 0;\n\t}\n\tconst byKey = textByKeyOf(parsed);\n\tif (byKey === void 0) throw new Error(`${NAMED_SECRETS_ENV} is not a JSON object of text.`);\n\tconst secrets = Object.create(null);\n\tObject.assign(secrets, byKey);\n\treturn Object.freeze(secrets);\n}\n//#endregion\nexport { readAppConfigurationFile as a, prepareSecondProcess as i, devAppConfigurationFile as n, removeLeftoverAppConfigurationFiles as o, namedSecretsFromEnvironment as r, deployAppConfigurationFile as t };\n\n//# sourceMappingURL=app-configuration-file-CeJvBAti.mjs.map"],"mappings":";;;;;;AAMA,MAAM,6BAA6B;;AAEnC,MAAM,oBAAoB;AAC1B,MAAM,YAAY;;AAElB,SAAS,2BAA2B,KAAK,OAAO;CAC/C,OAAO,KAAK,KAAK,KAAK,oBAAoB,qBAAqB,OAAO,QAAQ,GAAG,EAAE,GAAG,MAAM,MAAM;AACnG;;AAEA,SAAS,wBAAwB,QAAQ;CACxC,OAAO,KAAK,KAAK,QAAQ,qBAAqB,OAAO,QAAQ,GAAG,EAAE,MAAM;AACzE;AACA,SAAS,UAAU,KAAK;CACvB,IAAI;EACH,QAAQ,KAAK,KAAK,CAAC;EACnB,OAAO;CACR,SAAS,OAAO;EACf,OAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;CACpE;AACD;;;;;;;AAOA,SAAS,oCAAoC,KAAK;CACjD,MAAM,UAAU,KAAK,KAAK,KAAK,OAAO;CACtC,MAAM,OAAO,CAAC,KAAK,KAAK,KAAK,kBAAkB,CAAC;CAChD,IAAI;EACH,KAAK,MAAM,SAAS,GAAG,YAAY,SAAS,EAAE,eAAe,KAAK,CAAC,GAAG,IAAI,MAAM,YAAY,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AQ,MAAM;GAC1B,OAAO;EACR;CACD;AACD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region ../../0-framework/1-core/core/dist/container-transport-HcvNOGZL.mjs
|
|
2
|
+
/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PRISMA_CLOUD': uppercased, every non-alphanumeric run replaced by one underscore. */
|
|
3
|
+
function envVarSafeExtensionId(extensionId) {
|
|
4
|
+
return extensionId.toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
5
|
+
}
|
|
6
|
+
/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_CONTAINER_PRISMA_COMPOSER_PRISMA_CLOUD' */
|
|
7
|
+
function containerEnvVarName(extensionId) {
|
|
8
|
+
return `PRISMA_COMPOSER_CONTAINER_${envVarSafeExtensionId(extensionId)}`;
|
|
9
|
+
}
|
|
10
|
+
function collisionError(a, b, varName) {
|
|
11
|
+
return /* @__PURE__ */ new Error(`Extension ids "${a}" and "${b}" both map to the container transport variable "${varName}" — rename one of the extensions.`);
|
|
12
|
+
}
|
|
13
|
+
function emptySerializeError(extensionId) {
|
|
14
|
+
return /* @__PURE__ */ new Error(`Extension "${extensionId}"'s container instance serialized to an empty string — ContainerInstance.serialize() must return a non-empty string.`);
|
|
15
|
+
}
|
|
16
|
+
/** The env entries the CLI sets on the alchemy process: `{ [containerEnvVarName(id)]: instance.serialize() }` for every resolved instance. */
|
|
17
|
+
function containerEnv(instances) {
|
|
18
|
+
const env = {};
|
|
19
|
+
const ownerByVarName = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const [extensionId, instance] of instances) {
|
|
21
|
+
const varName = containerEnvVarName(extensionId);
|
|
22
|
+
const owner = ownerByVarName.get(varName);
|
|
23
|
+
if (owner !== void 0) throw collisionError(owner, extensionId, varName);
|
|
24
|
+
ownerByVarName.set(varName, extensionId);
|
|
25
|
+
const serialized = instance.serialize();
|
|
26
|
+
if (serialized.length === 0) throw emptySerializeError(extensionId);
|
|
27
|
+
env[varName] = serialized;
|
|
28
|
+
}
|
|
29
|
+
return env;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region ../../0-framework/1-core/core/dist/config.mjs
|
|
33
|
+
/**
|
|
34
|
+
* Carries an extension's preflight payload from the CLI process to the
|
|
35
|
+
* alchemy child (which re-imports the config from scratch) — one env var per
|
|
36
|
+
* extension, same channel as containers (container-transport.ts), filled by
|
|
37
|
+
* whichever preflight the run executed: the deploy preflight or the local
|
|
38
|
+
* target's dev preflight. The framework never reads the contents, so an
|
|
39
|
+
* extension that implements both must tell its own payload kinds apart.
|
|
40
|
+
* Payloads carry metadata only, never secret values: the child's environment
|
|
41
|
+
* is not a secret store.
|
|
42
|
+
*/
|
|
43
|
+
/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PREFLIGHT_PRISMA_COMPOSER_PRISMA_CLOUD' */
|
|
44
|
+
function preflightEnvVarName(extensionId) {
|
|
45
|
+
return `PRISMA_COMPOSER_PREFLIGHT_${envVarSafeExtensionId(extensionId)}`;
|
|
46
|
+
}
|
|
47
|
+
/** The env entries the CLI sets on the alchemy process: `{ [preflightEnvVarName(id)]: payload }` for every extension whose preflight returned one. */
|
|
48
|
+
function preflightEnv(payloads) {
|
|
49
|
+
const env = {};
|
|
50
|
+
const ownerByVarName = /* @__PURE__ */ new Map();
|
|
51
|
+
for (const [extensionId, payload] of payloads) {
|
|
52
|
+
if (payload.length === 0) continue;
|
|
53
|
+
const varName = preflightEnvVarName(extensionId);
|
|
54
|
+
const owner = ownerByVarName.get(varName);
|
|
55
|
+
if (owner !== void 0) throw new Error(`Extension ids "${owner}" and "${extensionId}" both map to the preflight transport variable "${varName}" — rename one of the extensions.`);
|
|
56
|
+
ownerByVarName.set(varName, extensionId);
|
|
57
|
+
env[varName] = payload;
|
|
58
|
+
}
|
|
59
|
+
return env;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { preflightEnvVarName as n, containerEnv as r, preflightEnv as t };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=config-DiZaanS3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-DiZaanS3.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/container-transport-HcvNOGZL.mjs","../../../0-framework/1-core/core/dist/config.mjs"],"sourcesContent":["//#region src/container-transport.ts\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PRISMA_CLOUD': uppercased, every non-alphanumeric run replaced by one underscore. */\nfunction envVarSafeExtensionId(extensionId) {\n\treturn extensionId.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\").replace(/^_+|_+$/g, \"\");\n}\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_CONTAINER_PRISMA_COMPOSER_PRISMA_CLOUD' */\nfunction containerEnvVarName(extensionId) {\n\treturn `PRISMA_COMPOSER_CONTAINER_${envVarSafeExtensionId(extensionId)}`;\n}\nfunction collisionError(a, b, varName) {\n\treturn /* @__PURE__ */ new Error(`Extension ids \"${a}\" and \"${b}\" both map to the container transport variable \"${varName}\" — rename one of the extensions.`);\n}\nfunction emptySerializeError(extensionId) {\n\treturn /* @__PURE__ */ new Error(`Extension \"${extensionId}\"'s container instance serialized to an empty string — ContainerInstance.serialize() must return a non-empty string.`);\n}\n/** The env entries the CLI sets on the alchemy process: `{ [containerEnvVarName(id)]: instance.serialize() }` for every resolved instance. */\nfunction containerEnv(instances) {\n\tconst env = {};\n\tconst ownerByVarName = /* @__PURE__ */ new Map();\n\tfor (const [extensionId, instance] of instances) {\n\t\tconst varName = containerEnvVarName(extensionId);\n\t\tconst owner = ownerByVarName.get(varName);\n\t\tif (owner !== void 0) throw collisionError(owner, extensionId, varName);\n\t\townerByVarName.set(varName, extensionId);\n\t\tconst serialized = instance.serialize();\n\t\tif (serialized.length === 0) throw emptySerializeError(extensionId);\n\t\tenv[varName] = serialized;\n\t}\n\treturn env;\n}\n/**\n* The alchemy-process side: for each extension with a container descriptor\n* whose var is present in `env`, call its deserialize. Absent var → no entry.\n*/\nfunction deserializeContainers(extensions, env) {\n\tconst instances = /* @__PURE__ */ new Map();\n\tfor (const extension of extensions) {\n\t\tconst descriptor = extension.container;\n\t\tif (descriptor === void 0) continue;\n\t\tconst serialized = env[containerEnvVarName(extension.id)];\n\t\tif (serialized === void 0) continue;\n\t\tinstances.set(extension.id, descriptor.deserialize(serialized));\n\t}\n\treturn instances;\n}\n//#endregion\nexport { envVarSafeExtensionId as i, containerEnvVarName as n, deserializeContainers as r, containerEnv as t };\n\n//# sourceMappingURL=container-transport-HcvNOGZL.mjs.map","import { i as envVarSafeExtensionId, n as containerEnvVarName, r as deserializeContainers, t as containerEnv } from \"./container-transport-HcvNOGZL.mjs\";\nimport { a as isBuildOnlyExtension, i as devEnvironmentDir, n as DEV_ENVIRONMENT_NAME_FILE, r as defineConfig, t as DEV_DIR } from \"./app-config-CErnR6NK.mjs\";\n//#region src/preflight-transport.ts\n/**\n* Carries an extension's preflight payload from the CLI process to the\n* alchemy child (which re-imports the config from scratch) — one env var per\n* extension, same channel as containers (container-transport.ts), filled by\n* whichever preflight the run executed: the deploy preflight or the local\n* target's dev preflight. The framework never reads the contents, so an\n* extension that implements both must tell its own payload kinds apart.\n* Payloads carry metadata only, never secret values: the child's environment\n* is not a secret store.\n*/\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PREFLIGHT_PRISMA_COMPOSER_PRISMA_CLOUD' */\nfunction preflightEnvVarName(extensionId) {\n\treturn `PRISMA_COMPOSER_PREFLIGHT_${envVarSafeExtensionId(extensionId)}`;\n}\n/** The env entries the CLI sets on the alchemy process: `{ [preflightEnvVarName(id)]: payload }` for every extension whose preflight returned one. */\nfunction preflightEnv(payloads) {\n\tconst env = {};\n\tconst ownerByVarName = /* @__PURE__ */ new Map();\n\tfor (const [extensionId, payload] of payloads) {\n\t\tif (payload.length === 0) continue;\n\t\tconst varName = preflightEnvVarName(extensionId);\n\t\tconst owner = ownerByVarName.get(varName);\n\t\tif (owner !== void 0) throw new Error(`Extension ids \"${owner}\" and \"${extensionId}\" both map to the preflight transport variable \"${varName}\" — rename one of the extensions.`);\n\t\townerByVarName.set(varName, extensionId);\n\t\tenv[varName] = payload;\n\t}\n\treturn env;\n}\n/** The alchemy-process side: the payload this extension's own preflight wrote, or `undefined` when it wrote none (or when nothing ran a preflight at all). */\nfunction readPreflightPayload(extensionId, env) {\n\tconst payload = env[preflightEnvVarName(extensionId)];\n\treturn payload === void 0 || payload.length === 0 ? void 0 : payload;\n}\n//#endregion\nexport { DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, isBuildOnlyExtension, preflightEnv, preflightEnvVarName, readPreflightPayload };\n\n//# sourceMappingURL=config.mjs.map"],"mappings":";;AAEA,SAAS,sBAAsB,aAAa;CAC3C,OAAO,YAAY,YAAY,CAAC,CAAC,QAAQ,eAAe,GAAG,CAAC,CAAC,QAAQ,YAAY,EAAE;AACpF;;AAEA,SAAS,oBAAoB,aAAa;CACzC,OAAO,6BAA6B,sBAAsB,WAAW;AACtE;AACA,SAAS,eAAe,GAAG,GAAG,SAAS;CACtC,uBAAuB,IAAI,MAAM,kBAAkB,EAAE,SAAS,EAAE,kDAAkD,QAAQ,kCAAkC;AAC7J;AACA,SAAS,oBAAoB,aAAa;CACzC,uBAAuB,IAAI,MAAM,cAAc,YAAY,qHAAqH;AACjL;;AAEA,SAAS,aAAa,WAAW;CAChC,MAAM,MAAM,CAAC;CACb,MAAM,iCAAiC,IAAI,IAAI;CAC/C,KAAK,MAAM,CAAC,aAAa,aAAa,WAAW;EAChD,MAAM,UAAU,oBAAoB,WAAW;EAC/C,MAAM,QAAQ,eAAe,IAAI,OAAO;EACxC,IAAI,UAAU,KAAK,GAAG,MAAM,eAAe,OAAO,aAAa,OAAO;EACtE,eAAe,IAAI,SAAS,WAAW;EACvC,MAAM,aAAa,SAAS,UAAU;EACtC,IAAI,WAAW,WAAW,GAAG,MAAM,oBAAoB,WAAW;EAClE,IAAI,WAAW;CAChB;CACA,OAAO;AACR;;;;;;;;;;;;;;ACfA,SAAS,oBAAoB,aAAa;CACzC,OAAO,6BAA6B,sBAAsB,WAAW;AACtE;;AAEA,SAAS,aAAa,UAAU;CAC/B,MAAM,MAAM,CAAC;CACb,MAAM,iCAAiC,IAAI,IAAI;CAC/C,KAAK,MAAM,CAAC,aAAa,YAAY,UAAU;EAC9C,IAAI,QAAQ,WAAW,GAAG;EAC1B,MAAM,UAAU,oBAAoB,WAAW;EAC/C,MAAM,QAAQ,eAAe,IAAI,OAAO;EACxC,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,kBAAkB,MAAM,SAAS,YAAY,kDAAkD,QAAQ,kCAAkC;EAC/K,eAAe,IAAI,SAAS,WAAW;EACvC,IAAI,WAAW;CAChB;CACA,OAAO;AACR"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { i as CliStructuredError, n as ok, o as blindCast, t as notOk } from "./result-sR7PBi61.mjs";
|
|
2
|
+
//#region ../../0-framework/3-tooling/cli/dist/dev-current-D-Qb6Yem.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Reads the execution diagnostics an engine-failure error carries in
|
|
5
|
+
* `meta.diagnostics`; undefined for every other failure.
|
|
6
|
+
*/
|
|
7
|
+
function executionDiagnostics(f) {
|
|
8
|
+
const diagnostics = f.meta?.["diagnostics"];
|
|
9
|
+
if (typeof diagnostics !== "object" || diagnostics === null) return void 0;
|
|
10
|
+
const candidate = blindCast(diagnostics);
|
|
11
|
+
if (candidate["exitCode"] !== void 0 && typeof candidate["exitCode"] !== "number" || candidate["signal"] !== void 0 && typeof candidate["signal"] !== "string" || typeof candidate["stackFilePath"] !== "string" || typeof candidate["reproduceCommand"] !== "string" || typeof candidate["cwd"] !== "string") return;
|
|
12
|
+
return blindCast(diagnostics);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Site-specific wrap for foreign extension/environment causes — passthrough
|
|
16
|
+
* when already structured; never a boundary fallback (base-type rule 6(ii)).
|
|
17
|
+
*/
|
|
18
|
+
function toStructured(code, error) {
|
|
19
|
+
return CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });
|
|
20
|
+
}
|
|
21
|
+
/** A failed executor import: an environmental failure of the consumer's
|
|
22
|
+
* installed tree, not a bug here. The import error rides as the cause. */
|
|
23
|
+
function executorLoadFailure(operation, error) {
|
|
24
|
+
return new CliStructuredError("DEPS.EXECUTOR_UNLOADABLE", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {
|
|
25
|
+
why: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,
|
|
26
|
+
fix: "Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.",
|
|
27
|
+
cause: error
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const RUN_OF = {
|
|
31
|
+
deploy: {
|
|
32
|
+
running: "this deploy",
|
|
33
|
+
runs: "the deploy"
|
|
34
|
+
},
|
|
35
|
+
destroy: {
|
|
36
|
+
running: "this destroy",
|
|
37
|
+
runs: "the destroy"
|
|
38
|
+
},
|
|
39
|
+
dev: {
|
|
40
|
+
running: "`prisma dev`",
|
|
41
|
+
runs: "`prisma dev`"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* An extension older than this Composer stores the input it is given but
|
|
46
|
+
* resolves from a key without `environment`, so it may read every name as
|
|
47
|
+
* production, or, locally, put every environment in one copy. Its
|
|
48
|
+
* `deserialize` rebuilds only the fields it knows, so the container the
|
|
49
|
+
* Alchemy child rebuilds shows which environment it really resolved.
|
|
50
|
+
* Refusing here keeps a mismatched install from deploying into, destroying
|
|
51
|
+
* or running the wrong place.
|
|
52
|
+
*/
|
|
53
|
+
function requireContainerForEnvironment(action, extensionId, descriptor, instance, environment) {
|
|
54
|
+
let rebuiltEnvironment;
|
|
55
|
+
try {
|
|
56
|
+
rebuiltEnvironment = descriptor.deserialize(instance.serialize()).input.environment;
|
|
57
|
+
} catch {
|
|
58
|
+
rebuiltEnvironment = void 0;
|
|
59
|
+
}
|
|
60
|
+
if (rebuiltEnvironment === environment) return;
|
|
61
|
+
const { running, runs } = RUN_OF[action];
|
|
62
|
+
throw new CliStructuredError("DEPS.EXTENSION_INCOMPATIBLE", `The extension ${extensionId} is older than the Composer running ${running}, so it would not resolve the environment ${environment}.`, { fix: `Install the same Composer version of ${extensionId} as the Composer that runs ${runs}.` });
|
|
63
|
+
}
|
|
64
|
+
/** The environment `deploy` targets when none is named. */
|
|
65
|
+
const DEFAULT_DEPLOY_ENVIRONMENT = "production";
|
|
66
|
+
/** In-package variant threading the injection seam, which the family's
|
|
67
|
+
* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors
|
|
68
|
+
* internal types and is not part of the published surface. */
|
|
69
|
+
async function deployWithDeps(input, deps) {
|
|
70
|
+
const startedAt = performance.now();
|
|
71
|
+
const cwd = input.cwd ?? process.cwd();
|
|
72
|
+
let executor;
|
|
73
|
+
try {
|
|
74
|
+
executor = await import("./execute-deploy-destroy-C6EsdmLz-DqdToZ_i.mjs");
|
|
75
|
+
} catch (error) {
|
|
76
|
+
return notOk(executorLoadFailure("deploy", error));
|
|
77
|
+
}
|
|
78
|
+
const result = await executor.executeDeploy(input, deps, cwd);
|
|
79
|
+
if (!result.ok) return result;
|
|
80
|
+
return ok({
|
|
81
|
+
...result.value,
|
|
82
|
+
durationMs: Math.round(performance.now() - startedAt)
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/** In-package variant threading the injection seam, which the family's
|
|
86
|
+
* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors
|
|
87
|
+
* internal types and is not part of the published surface. */
|
|
88
|
+
async function devWithDeps(input, deps) {
|
|
89
|
+
const cwd = input.cwd ?? process.cwd();
|
|
90
|
+
let executor;
|
|
91
|
+
try {
|
|
92
|
+
executor = await import("./execute-dev-gjIKYybU-hRndPEgC.mjs");
|
|
93
|
+
} catch (error) {
|
|
94
|
+
return notOk(executorLoadFailure("dev", error));
|
|
95
|
+
}
|
|
96
|
+
return executor.executeDev(input, deps, cwd);
|
|
97
|
+
}
|
|
98
|
+
async function loadExecutor(operation) {
|
|
99
|
+
try {
|
|
100
|
+
return ok(await import("./execute-dev-current-tBKmDAjV-DOOMGrl5.mjs"));
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return notOk(executorLoadFailure(operation, error));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Where the node at `input.address` runs locally in the environment. */
|
|
106
|
+
async function devUrl(input) {
|
|
107
|
+
const executor = await loadExecutor("dev url");
|
|
108
|
+
if (!executor.ok) return executor;
|
|
109
|
+
return executor.value.executeDevUrl(input, input.cwd ?? process.cwd());
|
|
110
|
+
}
|
|
111
|
+
/** Stops the app's local copy in the environment: its service processes and database servers. Data and ports stay. */
|
|
112
|
+
async function devStop(input) {
|
|
113
|
+
const executor = await loadExecutor("dev stop");
|
|
114
|
+
if (!executor.ok) return executor;
|
|
115
|
+
return executor.value.executeDevStop(input, input.cwd ?? process.cwd());
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { devWithDeps as a, toStructured as c, devUrl as i, deployWithDeps as n, executionDiagnostics as o, devStop as r, requireContainerForEnvironment as s, DEFAULT_DEPLOY_ENVIRONMENT as t };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=dev-current-D-Qb6Yem-CvaY4xsk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-current-D-Qb6Yem-CvaY4xsk.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/dev-current-D-Qb6Yem.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { notOk, ok } from \"@internal/foundation/result\";\n//#region src/operations/shared.ts\n/**\n* Reads the execution diagnostics an engine-failure error carries in\n* `meta.diagnostics`; undefined for every other failure.\n*/\nfunction executionDiagnostics(f) {\n\tconst diagnostics = f.meta?.[\"diagnostics\"];\n\tif (typeof diagnostics !== \"object\" || diagnostics === null) return void 0;\n\tconst candidate = blindCast(diagnostics);\n\tif (candidate[\"exitCode\"] !== void 0 && typeof candidate[\"exitCode\"] !== \"number\" || candidate[\"signal\"] !== void 0 && typeof candidate[\"signal\"] !== \"string\" || typeof candidate[\"stackFilePath\"] !== \"string\" || typeof candidate[\"reproduceCommand\"] !== \"string\" || typeof candidate[\"cwd\"] !== \"string\") return;\n\treturn blindCast(diagnostics);\n}\n/**\n* Site-specific wrap for foreign extension/environment causes — passthrough\n* when already structured; never a boundary fallback (base-type rule 6(ii)).\n*/\nfunction toStructured(code, error) {\n\treturn CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });\n}\n/** A failed executor import: an environmental failure of the consumer's\n* installed tree, not a bug here. The import error rides as the cause. */\nfunction executorLoadFailure(operation, error) {\n\treturn new CliStructuredError(\"DEPS.EXECUTOR_UNLOADABLE\", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {\n\t\twhy: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,\n\t\tfix: \"Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.\",\n\t\tcause: error\n\t});\n}\nconst RUN_OF = {\n\tdeploy: {\n\t\trunning: \"this deploy\",\n\t\truns: \"the deploy\"\n\t},\n\tdestroy: {\n\t\trunning: \"this destroy\",\n\t\truns: \"the destroy\"\n\t},\n\tdev: {\n\t\trunning: \"`prisma dev`\",\n\t\truns: \"`prisma dev`\"\n\t}\n};\n/**\n* An extension older than this Composer stores the input it is given but\n* resolves from a key without `environment`, so it may read every name as\n* production, or, locally, put every environment in one copy. Its\n* `deserialize` rebuilds only the fields it knows, so the container the\n* Alchemy child rebuilds shows which environment it really resolved.\n* Refusing here keeps a mismatched install from deploying into, destroying\n* or running the wrong place.\n*/\nfunction requireContainerForEnvironment(action, extensionId, descriptor, instance, environment) {\n\tlet rebuiltEnvironment;\n\ttry {\n\t\trebuiltEnvironment = descriptor.deserialize(instance.serialize()).input.environment;\n\t} catch {\n\t\trebuiltEnvironment = void 0;\n\t}\n\tif (rebuiltEnvironment === environment) return;\n\tconst { running, runs } = RUN_OF[action];\n\tthrow new CliStructuredError(\"DEPS.EXTENSION_INCOMPATIBLE\", `The extension ${extensionId} is older than the Composer running ${running}, so it would not resolve the environment ${environment}.`, { fix: `Install the same Composer version of ${extensionId} as the Composer that runs ${runs}.` });\n}\n//#endregion\n//#region src/operations/deploy.ts\n/** The environment `deploy` targets when none is named. */\nconst DEFAULT_DEPLOY_ENVIRONMENT = \"production\";\nasync function deploy(input) {\n\treturn deployWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, which the family's\n* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function deployWithDeps(input, deps) {\n\tconst startedAt = performance.now();\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-deploy-destroy-C6EsdmLz.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"deploy\", error));\n\t}\n\tconst result = await executor.executeDeploy(input, deps, cwd);\n\tif (!result.ok) return result;\n\treturn ok({\n\t\t...result.value,\n\t\tdurationMs: Math.round(performance.now() - startedAt)\n\t});\n}\n//#endregion\n//#region src/operations/dev.ts\nasync function dev(input) {\n\treturn devWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, which the family's\n* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function devWithDeps(input, deps) {\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-dev-gjIKYybU.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"dev\", error));\n\t}\n\treturn executor.executeDev(input, deps, cwd);\n}\n//#endregion\n//#region src/operations/dev-current.ts\nasync function loadExecutor(operation) {\n\ttry {\n\t\treturn ok(await import(\"./execute-dev-current-tBKmDAjV.mjs\"));\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(operation, error));\n\t}\n}\n/** Where the node at `input.address` runs locally in the environment. */\nasync function devUrl(input) {\n\tconst executor = await loadExecutor(\"dev url\");\n\tif (!executor.ok) return executor;\n\treturn executor.value.executeDevUrl(input, input.cwd ?? process.cwd());\n}\n/** Stops the app's local copy in the environment: its service processes and database servers. Data and ports stay. */\nasync function devStop(input) {\n\tconst executor = await loadExecutor(\"dev stop\");\n\tif (!executor.ok) return executor;\n\treturn executor.value.executeDevStop(input, input.cwd ?? process.cwd());\n}\n//#endregion\nexport { DEFAULT_DEPLOY_ENVIRONMENT as a, executionDiagnostics as c, toStructured as d, devWithDeps as i, executorLoadFailure as l, devUrl as n, deploy as o, dev as r, deployWithDeps as s, devStop as t, requireContainerForEnvironment as u };\n\n//# sourceMappingURL=dev-current-D-Qb6Yem.mjs.map"],"mappings":";;;;;;AAQA,SAAS,qBAAqB,GAAG;CAChC,MAAM,cAAc,EAAE,OAAO;CAC7B,IAAI,OAAO,gBAAgB,YAAY,gBAAgB,MAAM,OAAO,KAAK;CACzE,MAAM,YAAY,UAAU,WAAW;CACvC,IAAI,UAAU,gBAAgB,KAAK,KAAK,OAAO,UAAU,gBAAgB,YAAY,UAAU,cAAc,KAAK,KAAK,OAAO,UAAU,cAAc,YAAY,OAAO,UAAU,qBAAqB,YAAY,OAAO,UAAU,wBAAwB,YAAY,OAAO,UAAU,WAAW,UAAU;CAC/S,OAAO,UAAU,WAAW;AAC7B;;;;;AAKA,SAAS,aAAa,MAAM,OAAO;CAClC,OAAO,mBAAmB,GAAG,KAAK,IAAI,QAAQ,IAAI,mBAAmB,MAAM,iBA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