prisma-next 0.12.0-dev.5 → 0.12.0-dev.51
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/cli.mjs +180 -163
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-KgJorIvG.mjs → client-DC-UlBLy.mjs} +83 -58
- package/dist/client-DC-UlBLy.mjs.map +1 -0
- package/dist/{command-helpers-Bbw1GbwL.mjs → command-helpers-esJGBD4W.mjs} +317 -23
- package/dist/command-helpers-esJGBD4W.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +4 -5
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +4 -4
- package/dist/commands/db-update.d.mts.map +1 -1
- package/dist/commands/db-update.mjs +10 -7
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +2 -2
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +6 -8
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +55 -13
- package/dist/commands/migration-check.d.mts.map +1 -1
- package/dist/commands/migration-check.mjs +3 -2
- package/dist/commands/migration-graph.d.mts +17 -8
- package/dist/commands/migration-graph.d.mts.map +1 -1
- package/dist/commands/migration-graph.mjs +183 -2
- package/dist/commands/migration-graph.mjs.map +1 -0
- package/dist/commands/migration-list.d.mts +25 -27
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +2 -190
- package/dist/commands/migration-log.d.mts +9 -19
- package/dist/commands/migration-log.d.mts.map +1 -1
- package/dist/commands/migration-log.mjs +1 -137
- package/dist/commands/migration-new.mjs +3 -3
- package/dist/commands/migration-plan.d.mts +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.d.mts +17 -21
- package/dist/commands/migration-show.d.mts.map +1 -1
- package/dist/commands/migration-show.mjs +23 -35
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +42 -144
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +3 -759
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +3 -3
- package/dist/commands/telemetry/index.d.mts +7 -0
- package/dist/commands/telemetry/index.d.mts.map +1 -0
- package/dist/commands/telemetry/index.mjs +2 -0
- package/dist/{contract-at-errors-BxP-TOMl.mjs → contract-at-errors-COZAemUl.mjs} +2 -2
- package/dist/{contract-at-errors-BxP-TOMl.mjs.map → contract-at-errors-COZAemUl.mjs.map} +1 -1
- package/dist/{contract-emit-DxcGl4Uq.mjs → contract-emit-Bv46RAIO.mjs} +3 -3
- package/dist/{contract-emit-DxcGl4Uq.mjs.map → contract-emit-Bv46RAIO.mjs.map} +1 -1
- package/dist/{contract-emit-D-4jrNve.mjs → contract-emit-DIWImLqS.mjs} +5 -5
- package/dist/{contract-emit-D-4jrNve.mjs.map → contract-emit-DIWImLqS.mjs.map} +1 -1
- package/dist/{contract-infer-D8uEbJuu.mjs → contract-infer-DpGN9SAj.mjs} +3 -3
- package/dist/{contract-infer-D8uEbJuu.mjs.map → contract-infer-DpGN9SAj.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-DvZwdkrr.mjs → contract-space-aggregate-loader-CpNVrBqW.mjs} +63 -5
- package/dist/{contract-space-aggregate-loader-DvZwdkrr.mjs.map → contract-space-aggregate-loader-CpNVrBqW.mjs.map} +1 -1
- package/dist/{db-verify-v_vUKXTU.mjs → db-verify-Cq16Obsw.mjs} +4 -4
- package/dist/{db-verify-v_vUKXTU.mjs.map → db-verify-Cq16Obsw.mjs.map} +1 -1
- package/dist/exports/control-api.d.mts +2 -2
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{framework-components-fYXjz_in.mjs → framework-components-BO9VO43s.mjs} +2 -2
- package/dist/{framework-components-fYXjz_in.mjs.map → framework-components-BO9VO43s.mjs.map} +1 -1
- package/dist/{global-flags-DEHjV8_s.d.mts → global-flags-CV5LhrFg.d.mts} +1 -1
- package/dist/{global-flags-DEHjV8_s.d.mts.map → global-flags-CV5LhrFg.d.mts.map} +1 -1
- package/dist/{init-Cv9UzWL5.mjs → init-C0rjiQ9I.mjs} +5 -58
- package/dist/init-C0rjiQ9I.mjs.map +1 -0
- package/dist/{inspect-live-schema-C6ohV_oQ.mjs → inspect-live-schema-CRDKTNcf.mjs} +3 -3
- package/dist/{inspect-live-schema-C6ohV_oQ.mjs.map → inspect-live-schema-CRDKTNcf.mjs.map} +1 -1
- package/dist/migration-check-BxWlQBOs.mjs +573 -0
- package/dist/migration-check-BxWlQBOs.mjs.map +1 -0
- package/dist/{migration-command-scaffold-CjvwO6at.mjs → migration-command-scaffold-BDd9abqW.mjs} +3 -3
- package/dist/{migration-command-scaffold-CjvwO6at.mjs.map → migration-command-scaffold-BDd9abqW.mjs.map} +1 -1
- package/dist/migration-graph-space-render-CeNXh_Wy.mjs +1966 -0
- package/dist/migration-graph-space-render-CeNXh_Wy.mjs.map +1 -0
- package/dist/migration-list-vJWFuXca.mjs +228 -0
- package/dist/migration-list-vJWFuXca.mjs.map +1 -0
- package/dist/migration-log-6rcHQSI4.mjs +222 -0
- package/dist/migration-log-6rcHQSI4.mjs.map +1 -0
- package/dist/migration-path-target-UkxkgXnv.mjs +38 -0
- package/dist/migration-path-target-UkxkgXnv.mjs.map +1 -0
- package/dist/{migration-plan-9DJ7q7_z.mjs → migration-plan-CHu_erQ5.mjs} +5 -6
- package/dist/{migration-plan-9DJ7q7_z.mjs.map → migration-plan-CHu_erQ5.mjs.map} +1 -1
- package/dist/migration-status-Bjv91dE7.mjs +444 -0
- package/dist/migration-status-Bjv91dE7.mjs.map +1 -0
- package/dist/{output-B60Gw5fu.mjs → output-BD61elic.mjs} +1 -1
- package/dist/{output-B60Gw5fu.mjs.map → output-BD61elic.mjs.map} +1 -1
- package/dist/{ref-advancement-DUZqsue6.mjs → ref-advancement-CJY9zOv7.mjs} +1 -1
- package/dist/{ref-advancement-DUZqsue6.mjs.map → ref-advancement-CJY9zOv7.mjs.map} +1 -1
- package/dist/schemas-BL33A3i-.d.mts +193 -0
- package/dist/schemas-BL33A3i-.d.mts.map +1 -0
- package/dist/schemas-DJY2O09F.mjs +112 -0
- package/dist/schemas-DJY2O09F.mjs.map +1 -0
- package/dist/telemetry-CZkgkR_O.mjs +122 -0
- package/dist/telemetry-CZkgkR_O.mjs.map +1 -0
- package/dist/{terminal-ui-5Y6mrg93.d.mts → terminal-ui-BgLiAOYi.d.mts} +1 -1
- package/dist/{terminal-ui-5Y6mrg93.d.mts.map → terminal-ui-BgLiAOYi.d.mts.map} +1 -1
- package/dist/{types-Dt_SfqFm.d.mts → types-qV41eEXH.d.mts} +44 -31
- package/dist/types-qV41eEXH.d.mts.map +1 -0
- package/dist/{verify-DCA9Sldu.mjs → verify-IilvIk_E.mjs} +2 -2
- package/dist/{verify-DCA9Sldu.mjs.map → verify-IilvIk_E.mjs.map} +1 -1
- package/package.json +11 -12
- package/dist/client-KgJorIvG.mjs.map +0 -1
- package/dist/command-helpers-Bbw1GbwL.mjs.map +0 -1
- package/dist/commands/migration-list.mjs.map +0 -1
- package/dist/commands/migration-log.mjs.map +0 -1
- package/dist/commands/migration-status.mjs.map +0 -1
- package/dist/extension-pack-inputs-IDvjRCi3.mjs +0 -62
- package/dist/extension-pack-inputs-IDvjRCi3.mjs.map +0 -1
- package/dist/graph-render-rFAqZujX.mjs +0 -1081
- package/dist/graph-render-rFAqZujX.mjs.map +0 -1
- package/dist/init-Cv9UzWL5.mjs.map +0 -1
- package/dist/migration-check-BiBJoYYW.mjs +0 -341
- package/dist/migration-check-BiBJoYYW.mjs.map +0 -1
- package/dist/migration-graph-D7DVUElV.mjs +0 -1232
- package/dist/migration-graph-D7DVUElV.mjs.map +0 -1
- package/dist/migration-list-styler-BRwF4-gy.mjs +0 -399
- package/dist/migration-list-styler-BRwF4-gy.mjs.map +0 -1
- package/dist/migration-types-D2FW63pr.d.mts +0 -15
- package/dist/migration-types-D2FW63pr.d.mts.map +0 -1
- package/dist/migrations-Cv2jxNNK.mjs +0 -228
- package/dist/migrations-Cv2jxNNK.mjs.map +0 -1
- package/dist/types-Dt_SfqFm.d.mts.map +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import * as _$arktype_internal_variants_object_ts0 from "arktype/internal/variants/object.ts";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/json/schemas.d.ts
|
|
4
|
+
declare const migrationSpaceListEntrySchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
5
|
+
space: string;
|
|
6
|
+
migrations: {
|
|
7
|
+
name: string;
|
|
8
|
+
hash: string;
|
|
9
|
+
fromContract: string | null;
|
|
10
|
+
toContract: string;
|
|
11
|
+
operationCount: number;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
refs: string[];
|
|
14
|
+
providedInvariants: string[];
|
|
15
|
+
}[];
|
|
16
|
+
}, {}>;
|
|
17
|
+
type MigrationSpaceListEntry = typeof migrationSpaceListEntrySchema.infer;
|
|
18
|
+
declare const migrationListResultSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
19
|
+
ok: true;
|
|
20
|
+
summary: string;
|
|
21
|
+
spaces: {
|
|
22
|
+
space: string;
|
|
23
|
+
migrations: {
|
|
24
|
+
name: string;
|
|
25
|
+
hash: string;
|
|
26
|
+
fromContract: string | null;
|
|
27
|
+
toContract: string;
|
|
28
|
+
operationCount: number;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
refs: string[];
|
|
31
|
+
providedInvariants: string[];
|
|
32
|
+
}[];
|
|
33
|
+
}[];
|
|
34
|
+
}, {}>;
|
|
35
|
+
type MigrationListResult = typeof migrationListResultSchema.infer;
|
|
36
|
+
declare const migrationSpaceGraphEntrySchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
37
|
+
space: string;
|
|
38
|
+
contracts: {
|
|
39
|
+
hash: string;
|
|
40
|
+
refs: string[];
|
|
41
|
+
}[];
|
|
42
|
+
migrations: {
|
|
43
|
+
name: string;
|
|
44
|
+
hash: string;
|
|
45
|
+
fromContract: string | null;
|
|
46
|
+
toContract: string;
|
|
47
|
+
}[];
|
|
48
|
+
}, {}>;
|
|
49
|
+
type MigrationSpaceGraphEntry = typeof migrationSpaceGraphEntrySchema.infer;
|
|
50
|
+
declare const migrationStatusEntrySchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
51
|
+
name: string;
|
|
52
|
+
hash: string;
|
|
53
|
+
fromContract: string | null;
|
|
54
|
+
toContract: string;
|
|
55
|
+
operationCount: number;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
refs: string[];
|
|
58
|
+
providedInvariants: string[];
|
|
59
|
+
status: "applied" | "pending" | null;
|
|
60
|
+
}, {}>;
|
|
61
|
+
type MigrationStatusEntry = typeof migrationStatusEntrySchema.infer;
|
|
62
|
+
declare const statusDiagnosticSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
63
|
+
code: "CONTRACT.UNREADABLE";
|
|
64
|
+
severity: "warn" | "info";
|
|
65
|
+
message: string;
|
|
66
|
+
hints: string[];
|
|
67
|
+
} | {
|
|
68
|
+
code: "MIGRATION.MARKER_NOT_IN_HISTORY";
|
|
69
|
+
severity: "warn" | "info";
|
|
70
|
+
message: string;
|
|
71
|
+
hints: string[];
|
|
72
|
+
} | {
|
|
73
|
+
code: "MIGRATION.MISSING_INVARIANTS";
|
|
74
|
+
invariants: string[];
|
|
75
|
+
message: string;
|
|
76
|
+
ref?: string;
|
|
77
|
+
}, {}>;
|
|
78
|
+
type StatusDiagnosticJson = typeof statusDiagnosticSchema.infer;
|
|
79
|
+
declare const migrationStatusSpaceSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
80
|
+
space: string;
|
|
81
|
+
currentContract: string | null;
|
|
82
|
+
targetContract: string;
|
|
83
|
+
migrations: {
|
|
84
|
+
name: string;
|
|
85
|
+
hash: string;
|
|
86
|
+
fromContract: string | null;
|
|
87
|
+
toContract: string;
|
|
88
|
+
operationCount: number;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
refs: string[];
|
|
91
|
+
providedInvariants: string[];
|
|
92
|
+
status: "applied" | "pending" | null;
|
|
93
|
+
}[];
|
|
94
|
+
}, {}>;
|
|
95
|
+
type MigrationStatusSpace = typeof migrationStatusSpaceSchema.infer;
|
|
96
|
+
declare const migrationStatusJsonResultSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
97
|
+
ok: true;
|
|
98
|
+
summary: string;
|
|
99
|
+
spaces: {
|
|
100
|
+
space: string;
|
|
101
|
+
currentContract: string | null;
|
|
102
|
+
targetContract: string;
|
|
103
|
+
migrations: {
|
|
104
|
+
name: string;
|
|
105
|
+
hash: string;
|
|
106
|
+
fromContract: string | null;
|
|
107
|
+
toContract: string;
|
|
108
|
+
operationCount: number;
|
|
109
|
+
createdAt: string;
|
|
110
|
+
refs: string[];
|
|
111
|
+
providedInvariants: string[];
|
|
112
|
+
status: "applied" | "pending" | null;
|
|
113
|
+
}[];
|
|
114
|
+
}[];
|
|
115
|
+
diagnostics: ({
|
|
116
|
+
code: "CONTRACT.UNREADABLE";
|
|
117
|
+
severity: "warn" | "info";
|
|
118
|
+
message: string;
|
|
119
|
+
hints: string[];
|
|
120
|
+
} | {
|
|
121
|
+
code: "MIGRATION.MARKER_NOT_IN_HISTORY";
|
|
122
|
+
severity: "warn" | "info";
|
|
123
|
+
message: string;
|
|
124
|
+
hints: string[];
|
|
125
|
+
} | {
|
|
126
|
+
code: "MIGRATION.MISSING_INVARIANTS";
|
|
127
|
+
invariants: string[];
|
|
128
|
+
message: string;
|
|
129
|
+
ref?: string;
|
|
130
|
+
})[];
|
|
131
|
+
}, {}>;
|
|
132
|
+
type MigrationStatusResult = typeof migrationStatusJsonResultSchema.infer;
|
|
133
|
+
declare const migrationLogResultSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
134
|
+
ok: true;
|
|
135
|
+
summary: string;
|
|
136
|
+
records: {
|
|
137
|
+
space: string;
|
|
138
|
+
name: string;
|
|
139
|
+
hash: string;
|
|
140
|
+
fromContract: string | null;
|
|
141
|
+
toContract: string;
|
|
142
|
+
appliedAt: string;
|
|
143
|
+
operationCount: number;
|
|
144
|
+
}[];
|
|
145
|
+
}, {}>;
|
|
146
|
+
type MigrationLogResult = typeof migrationLogResultSchema.infer;
|
|
147
|
+
declare const migrationShowResultSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
148
|
+
ok: true;
|
|
149
|
+
summary: string;
|
|
150
|
+
migration: {
|
|
151
|
+
space: string;
|
|
152
|
+
name: string;
|
|
153
|
+
hash: string;
|
|
154
|
+
fromContract: string | null;
|
|
155
|
+
toContract: string;
|
|
156
|
+
createdAt: string;
|
|
157
|
+
operations: {
|
|
158
|
+
id: string;
|
|
159
|
+
label: string;
|
|
160
|
+
operationClass: string;
|
|
161
|
+
}[];
|
|
162
|
+
preview: {
|
|
163
|
+
statements: {
|
|
164
|
+
text: string;
|
|
165
|
+
language: string;
|
|
166
|
+
}[];
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
}, {}>;
|
|
170
|
+
type MigrationShowResult = typeof migrationShowResultSchema.infer;
|
|
171
|
+
declare const checkFailureSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
172
|
+
space: string;
|
|
173
|
+
code: string;
|
|
174
|
+
where: string;
|
|
175
|
+
why: string;
|
|
176
|
+
fix: string;
|
|
177
|
+
}, {}>;
|
|
178
|
+
type CheckFailure = typeof checkFailureSchema.infer;
|
|
179
|
+
declare const migrationCheckResultSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
|
|
180
|
+
ok: boolean;
|
|
181
|
+
failures: {
|
|
182
|
+
space: string;
|
|
183
|
+
code: string;
|
|
184
|
+
where: string;
|
|
185
|
+
why: string;
|
|
186
|
+
fix: string;
|
|
187
|
+
}[];
|
|
188
|
+
summary: string;
|
|
189
|
+
}, {}>;
|
|
190
|
+
type MigrationCheckResult = typeof migrationCheckResultSchema.infer;
|
|
191
|
+
//#endregion
|
|
192
|
+
export { MigrationShowResult as a, MigrationStatusEntry as c, StatusDiagnosticJson as d, migrationCheckResultSchema as f, MigrationLogResult as i, MigrationStatusResult as l, MigrationCheckResult as n, MigrationSpaceGraphEntry as o, migrationStatusJsonResultSchema as p, MigrationListResult as r, MigrationSpaceListEntry as s, CheckFailure as t, MigrationStatusSpace as u };
|
|
193
|
+
//# sourceMappingURL=schemas-BL33A3i-.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas-BL33A3i-.d.mts","names":[],"sources":["../src/commands/json/schemas.ts"],"mappings":";;;cA6Ba,6BAAA,EAGX,sCAAA,CAHwC,UAAA;;;;;;;;;;;;;KAK9B,uBAAA,UAAiC,6BAAA,CAA8B,KAAK;AAAA,cAEnE,yBAAA,EAIZ,sCAAA,CAJqC,UAAA;;;;;;;;;;;;;;;;;KAM1B,mBAAA,UAA6B,yBAAA,CAA0B,KAAK;AAAA,cAW3D,8BAAA,EAIX,sCAAA,CAJyC,UAAA;;;;;;;;;;;;;KAM/B,wBAAA,UAAkC,8BAAA,CAA+B,KAAK;AAAA,cAUrE,0BAAA,EAIZ,sCAAA,CAJsC,UAAA;;;;;;;;;;;KAM3B,oBAAA,UAA8B,0BAAA,CAA2B,KAAK;AAAA,cAuB7D,sBAAA,EAE2B,sCAAA,CAFL,UAAA;;;;;;;;;;;;;;;;KAIvB,oBAAA,UAA8B,sBAAA,CAAuB,KAAK;AAAA,cAEzD,0BAAA,EAKX,sCAAA,CALqC,UAAA;;;;;;;;;;;;;;;;KAO3B,oBAAA,UAA8B,0BAAA,CAA2B,KAAK;AAAA,cAE7D,+BAAA,EAKZ,sCAAA,CAL2C,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOhC,qBAAA,UAA+B,+BAAA,CAAgC,KAAK;AAAA,cAcnE,wBAAA,EAIZ,sCAAA,CAJoC,UAAA;;;;;;;;;;;;;KAMzB,kBAAA,UAA4B,wBAAA,CAAyB,KAAK;AAAA,cA8BzD,yBAAA,EAIZ,sCAAA,CAJqC,UAAA;;;;;;;;;;;;;;;;;;;;;;;KAM1B,mBAAA,UAA6B,yBAAA,CAA0B,KAAK;AAAA,cAE3D,kBAAA,EAMX,sCAAA,CAN6B,UAAA;;;;;;;KAQnB,YAAA,UAAsB,kBAAA,CAAmB,KAAK;AAAA,cAE7C,0BAAA,EAIX,sCAAA,CAJqC,UAAA;;;;;;;;;;;KAM3B,oBAAA,UAA8B,0BAAA,CAA2B,KAAK"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
//#region src/commands/json/schemas.ts
|
|
3
|
+
const migrationEntrySchema = type({
|
|
4
|
+
name: "string",
|
|
5
|
+
hash: "string",
|
|
6
|
+
fromContract: "string | null",
|
|
7
|
+
toContract: "string",
|
|
8
|
+
operationCount: "number",
|
|
9
|
+
createdAt: "string",
|
|
10
|
+
refs: "string[]",
|
|
11
|
+
providedInvariants: "string[]"
|
|
12
|
+
});
|
|
13
|
+
const contractRefSchema = type({
|
|
14
|
+
hash: "string",
|
|
15
|
+
refs: "string[]"
|
|
16
|
+
});
|
|
17
|
+
const successEnvelopeBaseSchema = type({
|
|
18
|
+
ok: "true",
|
|
19
|
+
summary: "string"
|
|
20
|
+
});
|
|
21
|
+
const migrationSpaceListEntrySchema = type({
|
|
22
|
+
space: "string",
|
|
23
|
+
migrations: migrationEntrySchema.array()
|
|
24
|
+
});
|
|
25
|
+
successEnvelopeBaseSchema.and(type({ spaces: migrationSpaceListEntrySchema.array() }));
|
|
26
|
+
const graphMigrationSchema = type({
|
|
27
|
+
name: "string",
|
|
28
|
+
hash: "string",
|
|
29
|
+
fromContract: "string | null",
|
|
30
|
+
toContract: "string"
|
|
31
|
+
});
|
|
32
|
+
const migrationSpaceGraphEntrySchema = type({
|
|
33
|
+
space: "string",
|
|
34
|
+
contracts: contractRefSchema.array(),
|
|
35
|
+
migrations: graphMigrationSchema.array()
|
|
36
|
+
});
|
|
37
|
+
successEnvelopeBaseSchema.and(type({ spaces: migrationSpaceGraphEntrySchema.array() }));
|
|
38
|
+
const migrationStatusEntrySchema = migrationEntrySchema.and(type({ status: "\"applied\" | \"pending\" | null" }));
|
|
39
|
+
const contractUnreadableDiagnosticSchema = type({
|
|
40
|
+
code: "\"CONTRACT.UNREADABLE\"",
|
|
41
|
+
severity: "\"warn\" | \"info\"",
|
|
42
|
+
message: "string",
|
|
43
|
+
hints: "string[]"
|
|
44
|
+
});
|
|
45
|
+
const markerNotInHistoryDiagnosticSchema = type({
|
|
46
|
+
code: "\"MIGRATION.MARKER_NOT_IN_HISTORY\"",
|
|
47
|
+
severity: "\"warn\" | \"info\"",
|
|
48
|
+
message: "string",
|
|
49
|
+
hints: "string[]"
|
|
50
|
+
});
|
|
51
|
+
const missingInvariantsDiagnosticSchema = type({
|
|
52
|
+
code: "\"MIGRATION.MISSING_INVARIANTS\"",
|
|
53
|
+
"ref?": "string",
|
|
54
|
+
invariants: "string[]",
|
|
55
|
+
message: "string"
|
|
56
|
+
});
|
|
57
|
+
const statusDiagnosticSchema = contractUnreadableDiagnosticSchema.or(markerNotInHistoryDiagnosticSchema).or(missingInvariantsDiagnosticSchema);
|
|
58
|
+
const migrationStatusSpaceSchema = type({
|
|
59
|
+
space: "string",
|
|
60
|
+
currentContract: "string | null",
|
|
61
|
+
targetContract: "string",
|
|
62
|
+
migrations: migrationStatusEntrySchema.array()
|
|
63
|
+
});
|
|
64
|
+
const migrationStatusJsonResultSchema = successEnvelopeBaseSchema.and(type({
|
|
65
|
+
spaces: migrationStatusSpaceSchema.array(),
|
|
66
|
+
diagnostics: statusDiagnosticSchema.array()
|
|
67
|
+
}));
|
|
68
|
+
const ledgerRecordSchema = type({
|
|
69
|
+
space: "string",
|
|
70
|
+
name: "string",
|
|
71
|
+
hash: "string",
|
|
72
|
+
fromContract: "string | null",
|
|
73
|
+
toContract: "string",
|
|
74
|
+
appliedAt: "string",
|
|
75
|
+
operationCount: "number"
|
|
76
|
+
});
|
|
77
|
+
successEnvelopeBaseSchema.and(type({ records: ledgerRecordSchema.array() }));
|
|
78
|
+
const showOperationSchema = type({
|
|
79
|
+
id: "string",
|
|
80
|
+
label: "string",
|
|
81
|
+
operationClass: "string"
|
|
82
|
+
});
|
|
83
|
+
const showPreviewStatementSchema = type({
|
|
84
|
+
text: "string",
|
|
85
|
+
language: "string"
|
|
86
|
+
});
|
|
87
|
+
const showMigrationSchema = type({
|
|
88
|
+
space: "string",
|
|
89
|
+
name: "string",
|
|
90
|
+
hash: "string",
|
|
91
|
+
fromContract: "string | null",
|
|
92
|
+
toContract: "string",
|
|
93
|
+
createdAt: "string",
|
|
94
|
+
operations: showOperationSchema.array(),
|
|
95
|
+
preview: type({ statements: showPreviewStatementSchema.array() })
|
|
96
|
+
});
|
|
97
|
+
successEnvelopeBaseSchema.and(type({ migration: showMigrationSchema }));
|
|
98
|
+
const migrationCheckResultSchema = type({
|
|
99
|
+
ok: "boolean",
|
|
100
|
+
failures: type({
|
|
101
|
+
space: "string",
|
|
102
|
+
code: "string",
|
|
103
|
+
where: "string",
|
|
104
|
+
why: "string",
|
|
105
|
+
fix: "string"
|
|
106
|
+
}).array(),
|
|
107
|
+
summary: "string"
|
|
108
|
+
});
|
|
109
|
+
//#endregion
|
|
110
|
+
export { migrationStatusJsonResultSchema as n, migrationCheckResultSchema as t };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=schemas-DJY2O09F.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas-DJY2O09F.mjs","names":[],"sources":["../src/commands/json/schemas.ts"],"sourcesContent":["import { type } from 'arktype';\n\nexport const migrationEntrySchema = type({\n name: 'string',\n hash: 'string',\n fromContract: 'string | null',\n toContract: 'string',\n operationCount: 'number',\n createdAt: 'string',\n refs: 'string[]',\n providedInvariants: 'string[]',\n});\n\nexport type MigrationEntry = typeof migrationEntrySchema.infer;\n\nexport const contractRefSchema = type({\n hash: 'string',\n refs: 'string[]',\n});\n\nexport type ContractRef = typeof contractRefSchema.infer;\n\nexport const successEnvelopeBaseSchema = type({\n ok: 'true',\n summary: 'string',\n});\n\nexport type SuccessEnvelopeBase = typeof successEnvelopeBaseSchema.infer;\n\nexport const migrationSpaceListEntrySchema = type({\n space: 'string',\n migrations: migrationEntrySchema.array(),\n});\n\nexport type MigrationSpaceListEntry = typeof migrationSpaceListEntrySchema.infer;\n\nexport const migrationListResultSchema = successEnvelopeBaseSchema.and(\n type({\n spaces: migrationSpaceListEntrySchema.array(),\n }),\n);\n\nexport type MigrationListResult = typeof migrationListResultSchema.infer;\n\nexport const graphMigrationSchema = type({\n name: 'string',\n hash: 'string',\n fromContract: 'string | null',\n toContract: 'string',\n});\n\nexport type GraphMigration = typeof graphMigrationSchema.infer;\n\nexport const migrationSpaceGraphEntrySchema = type({\n space: 'string',\n contracts: contractRefSchema.array(),\n migrations: graphMigrationSchema.array(),\n});\n\nexport type MigrationSpaceGraphEntry = typeof migrationSpaceGraphEntrySchema.infer;\n\nexport const migrationGraphJsonResultSchema = successEnvelopeBaseSchema.and(\n type({\n spaces: migrationSpaceGraphEntrySchema.array(),\n }),\n);\n\nexport type MigrationGraphJsonResult = typeof migrationGraphJsonResultSchema.infer;\n\nexport const migrationStatusEntrySchema = migrationEntrySchema.and(\n type({\n status: '\"applied\" | \"pending\" | null',\n }),\n);\n\nexport type MigrationStatusEntry = typeof migrationStatusEntrySchema.infer;\n\nconst contractUnreadableDiagnosticSchema = type({\n code: '\"CONTRACT.UNREADABLE\"',\n severity: '\"warn\" | \"info\"',\n message: 'string',\n hints: 'string[]',\n});\n\nconst markerNotInHistoryDiagnosticSchema = type({\n code: '\"MIGRATION.MARKER_NOT_IN_HISTORY\"',\n severity: '\"warn\" | \"info\"',\n message: 'string',\n hints: 'string[]',\n});\n\nconst missingInvariantsDiagnosticSchema = type({\n code: '\"MIGRATION.MISSING_INVARIANTS\"',\n 'ref?': 'string',\n invariants: 'string[]',\n message: 'string',\n});\n\nexport const statusDiagnosticSchema = contractUnreadableDiagnosticSchema\n .or(markerNotInHistoryDiagnosticSchema)\n .or(missingInvariantsDiagnosticSchema);\n\nexport type StatusDiagnosticJson = typeof statusDiagnosticSchema.infer;\n\nexport const migrationStatusSpaceSchema = type({\n space: 'string',\n currentContract: 'string | null',\n targetContract: 'string',\n migrations: migrationStatusEntrySchema.array(),\n});\n\nexport type MigrationStatusSpace = typeof migrationStatusSpaceSchema.infer;\n\nexport const migrationStatusJsonResultSchema = successEnvelopeBaseSchema.and(\n type({\n spaces: migrationStatusSpaceSchema.array(),\n diagnostics: statusDiagnosticSchema.array(),\n }),\n);\n\nexport type MigrationStatusResult = typeof migrationStatusJsonResultSchema.infer;\n\nexport const ledgerRecordSchema = type({\n space: 'string',\n name: 'string',\n hash: 'string',\n fromContract: 'string | null',\n toContract: 'string',\n appliedAt: 'string',\n operationCount: 'number',\n});\n\nexport type LedgerRecord = typeof ledgerRecordSchema.infer;\n\nexport const migrationLogResultSchema = successEnvelopeBaseSchema.and(\n type({\n records: ledgerRecordSchema.array(),\n }),\n);\n\nexport type MigrationLogResult = typeof migrationLogResultSchema.infer;\n\nexport const showOperationSchema = type({\n id: 'string',\n label: 'string',\n operationClass: 'string',\n});\n\nexport type ShowOperation = typeof showOperationSchema.infer;\n\nexport const showPreviewStatementSchema = type({\n text: 'string',\n language: 'string',\n});\n\nexport const showMigrationSchema = type({\n space: 'string',\n name: 'string',\n hash: 'string',\n fromContract: 'string | null',\n toContract: 'string',\n createdAt: 'string',\n operations: showOperationSchema.array(),\n preview: type({\n statements: showPreviewStatementSchema.array(),\n }),\n});\n\nexport type ShowMigration = typeof showMigrationSchema.infer;\n\nexport const migrationShowResultSchema = successEnvelopeBaseSchema.and(\n type({\n migration: showMigrationSchema,\n }),\n);\n\nexport type MigrationShowResult = typeof migrationShowResultSchema.infer;\n\nexport const checkFailureSchema = type({\n space: 'string',\n code: 'string',\n where: 'string',\n why: 'string',\n fix: 'string',\n});\n\nexport type CheckFailure = typeof checkFailureSchema.infer;\n\nexport const migrationCheckResultSchema = type({\n ok: 'boolean',\n failures: checkFailureSchema.array(),\n summary: 'string',\n});\n\nexport type MigrationCheckResult = typeof migrationCheckResultSchema.infer;\n"],"mappings":";;AAEA,MAAa,uBAAuB,KAAK;CACvC,MAAM;CACN,MAAM;CACN,cAAc;CACd,YAAY;CACZ,gBAAgB;CAChB,WAAW;CACX,MAAM;CACN,oBAAoB;AACtB,CAAC;AAID,MAAa,oBAAoB,KAAK;CACpC,MAAM;CACN,MAAM;AACR,CAAC;AAID,MAAa,4BAA4B,KAAK;CAC5C,IAAI;CACJ,SAAS;AACX,CAAC;AAID,MAAa,gCAAgC,KAAK;CAChD,OAAO;CACP,YAAY,qBAAqB,MAAM;AACzC,CAAC;AAIwC,0BAA0B,IACjE,KAAK,EACH,QAAQ,8BAA8B,MAAM,EAC9C,CAAC,CACH;AAIA,MAAa,uBAAuB,KAAK;CACvC,MAAM;CACN,MAAM;CACN,cAAc;CACd,YAAY;AACd,CAAC;AAID,MAAa,iCAAiC,KAAK;CACjD,OAAO;CACP,WAAW,kBAAkB,MAAM;CACnC,YAAY,qBAAqB,MAAM;AACzC,CAAC;AAI6C,0BAA0B,IACtE,KAAK,EACH,QAAQ,+BAA+B,MAAM,EAC/C,CAAC,CACH;AAIA,MAAa,6BAA6B,qBAAqB,IAC7D,KAAK,EACH,QAAQ,mCACV,CAAC,CACH;AAIA,MAAM,qCAAqC,KAAK;CAC9C,MAAM;CACN,UAAU;CACV,SAAS;CACT,OAAO;AACT,CAAC;AAED,MAAM,qCAAqC,KAAK;CAC9C,MAAM;CACN,UAAU;CACV,SAAS;CACT,OAAO;AACT,CAAC;AAED,MAAM,oCAAoC,KAAK;CAC7C,MAAM;CACN,QAAQ;CACR,YAAY;CACZ,SAAS;AACX,CAAC;AAED,MAAa,yBAAyB,mCACnC,GAAG,kCAAkC,EACrC,GAAG,iCAAiC;AAIvC,MAAa,6BAA6B,KAAK;CAC7C,OAAO;CACP,iBAAiB;CACjB,gBAAgB;CAChB,YAAY,2BAA2B,MAAM;AAC/C,CAAC;AAID,MAAa,kCAAkC,0BAA0B,IACvE,KAAK;CACH,QAAQ,2BAA2B,MAAM;CACzC,aAAa,uBAAuB,MAAM;AAC5C,CAAC,CACH;AAIA,MAAa,qBAAqB,KAAK;CACrC,OAAO;CACP,MAAM;CACN,MAAM;CACN,cAAc;CACd,YAAY;CACZ,WAAW;CACX,gBAAgB;AAClB,CAAC;AAIuC,0BAA0B,IAChE,KAAK,EACH,SAAS,mBAAmB,MAAM,EACpC,CAAC,CACH;AAIA,MAAa,sBAAsB,KAAK;CACtC,IAAI;CACJ,OAAO;CACP,gBAAgB;AAClB,CAAC;AAID,MAAa,6BAA6B,KAAK;CAC7C,MAAM;CACN,UAAU;AACZ,CAAC;AAED,MAAa,sBAAsB,KAAK;CACtC,OAAO;CACP,MAAM;CACN,MAAM;CACN,cAAc;CACd,YAAY;CACZ,WAAW;CACX,YAAY,oBAAoB,MAAM;CACtC,SAAS,KAAK,EACZ,YAAY,2BAA2B,MAAM,EAC/C,CAAC;AACH,CAAC;AAIwC,0BAA0B,IACjE,KAAK,EACH,WAAW,oBACb,CAAC,CACH;AAcA,MAAa,6BAA6B,KAAK;CAC7C,IAAI;CACJ,UAZgC,KAAK;EACrC,OAAO;EACP,MAAM;EACN,OAAO;EACP,KAAK;EACL,KAAK;CACP,CAMY,EAAmB,MAAM;CACnC,SAAS;AACX,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { D as isCI, O as formatCommandHelp, _ as createTerminalUI, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples } from "./command-helpers-esJGBD4W.mjs";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { readUserConfig, resolveGating, userConfigPath, writeUserConfig } from "@prisma-next/cli-telemetry";
|
|
4
|
+
//#region src/commands/telemetry/status.ts
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the same gate the runtime uses (CI check + `resolveGating`) and
|
|
7
|
+
* projects it into a user-facing status. Pure read: never mints, never
|
|
8
|
+
* writes. The `installationId` value itself is never surfaced — only its
|
|
9
|
+
* presence — so `status` discloses nothing identifying.
|
|
10
|
+
*/
|
|
11
|
+
function resolveTelemetryStatus(inputs) {
|
|
12
|
+
const config = readUserConfig();
|
|
13
|
+
const configPath = userConfigPath();
|
|
14
|
+
const installationIdStored = typeof config.installationId === "string" && config.installationId.length > 0;
|
|
15
|
+
if (inputs.inCI) return {
|
|
16
|
+
enabled: false,
|
|
17
|
+
reason: "ci",
|
|
18
|
+
configPath,
|
|
19
|
+
installationIdStored
|
|
20
|
+
};
|
|
21
|
+
const gating = resolveGating({
|
|
22
|
+
env: inputs.env,
|
|
23
|
+
config
|
|
24
|
+
});
|
|
25
|
+
if (!gating.enabled) return {
|
|
26
|
+
enabled: false,
|
|
27
|
+
reason: gating.reason === "env-override" ? "env-opt-out" : "stored-opt-out",
|
|
28
|
+
configPath,
|
|
29
|
+
installationIdStored
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
enabled: true,
|
|
33
|
+
reason: config.enableTelemetry === true ? "stored-opt-in" : "default-on",
|
|
34
|
+
configPath,
|
|
35
|
+
installationIdStored
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const REASON_EXPLANATION = {
|
|
39
|
+
ci: "CI environment detected — telemetry is hard-disabled.",
|
|
40
|
+
"env-opt-out": "an environment opt-out is set (DO_NOT_TRACK / PRISMA_NEXT_DISABLE_TELEMETRY).",
|
|
41
|
+
"stored-opt-out": "\"enableTelemetry\": false is stored in your config.",
|
|
42
|
+
"stored-opt-in": "\"enableTelemetry\": true is stored in your config.",
|
|
43
|
+
"default-on": "no explicit choice is stored, so the opt-out default applies."
|
|
44
|
+
};
|
|
45
|
+
function formatTelemetryStatusLines(status) {
|
|
46
|
+
return [
|
|
47
|
+
`Telemetry is ${status.enabled ? "enabled" : "disabled"}: ${REASON_EXPLANATION[status.reason]}`,
|
|
48
|
+
`Config file: ${status.configPath}`,
|
|
49
|
+
`Installation ID: ${status.installationIdStored ? "stored" : "not stored"}`
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/commands/telemetry/index.ts
|
|
54
|
+
function createTelemetryStatusCommand() {
|
|
55
|
+
const command = new Command("status");
|
|
56
|
+
setCommandDescriptions(command, "Show whether anonymous CLI telemetry is enabled and why", "Reports whether telemetry is currently enabled or disabled and the reason\n(default-on, stored opt-out, environment opt-out, or CI), the path to your\nuser-level config file, and whether an installation ID has been stored.\nRead-only: never sends an event, never mints an ID, never writes anything.");
|
|
57
|
+
return addGlobalOptions(command).action((options) => {
|
|
58
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
59
|
+
const ui = createTerminalUI(flags);
|
|
60
|
+
const status = resolveTelemetryStatus({
|
|
61
|
+
env: process.env,
|
|
62
|
+
inCI: isCI()
|
|
63
|
+
});
|
|
64
|
+
if (flags.json) ui.output(JSON.stringify(status));
|
|
65
|
+
else for (const line of formatTelemetryStatusLines(status)) ui.output(line);
|
|
66
|
+
process.exit(0);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function createTelemetryEnableCommand() {
|
|
70
|
+
const command = new Command("enable");
|
|
71
|
+
setCommandDescriptions(command, "Enable anonymous CLI telemetry", "Stores \"enableTelemetry\": true in your user-level config and mints an\ninstallation ID if one is not already stored.");
|
|
72
|
+
return addGlobalOptions(command).action((options) => {
|
|
73
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
74
|
+
writeUserConfig({ enableTelemetry: true });
|
|
75
|
+
const ui = createTerminalUI(flags);
|
|
76
|
+
if (flags.json) ui.output(JSON.stringify({
|
|
77
|
+
enableTelemetry: true,
|
|
78
|
+
configPath: userConfigPath()
|
|
79
|
+
}));
|
|
80
|
+
else ui.output(`Telemetry enabled. Preference stored in ${userConfigPath()}.`);
|
|
81
|
+
process.exit(0);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function createTelemetryDisableCommand() {
|
|
85
|
+
const command = new Command("disable");
|
|
86
|
+
setCommandDescriptions(command, "Disable anonymous CLI telemetry", "Stores \"enableTelemetry\": false in your user-level config. No installation\nID is minted and no event is sent.");
|
|
87
|
+
return addGlobalOptions(command).action((options) => {
|
|
88
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
89
|
+
writeUserConfig({ enableTelemetry: false });
|
|
90
|
+
const ui = createTerminalUI(flags);
|
|
91
|
+
if (flags.json) ui.output(JSON.stringify({
|
|
92
|
+
enableTelemetry: false,
|
|
93
|
+
configPath: userConfigPath()
|
|
94
|
+
}));
|
|
95
|
+
else ui.output(`Telemetry disabled. Preference stored in ${userConfigPath()}.`);
|
|
96
|
+
process.exit(0);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function createTelemetryCommand() {
|
|
100
|
+
const command = new Command("telemetry");
|
|
101
|
+
setCommandDescriptions(command, "Inspect and change anonymous CLI telemetry", "Show telemetry status, or enable / disable anonymous CLI usage data.\nTelemetry is on by default (opt-out); see https://prisma-next.dev/docs/cli/telemetry\nfor what is collected and why.");
|
|
102
|
+
setCommandExamples(command, [
|
|
103
|
+
"prisma-next telemetry status",
|
|
104
|
+
"prisma-next telemetry disable",
|
|
105
|
+
"prisma-next telemetry enable"
|
|
106
|
+
]);
|
|
107
|
+
command.configureHelp({
|
|
108
|
+
formatHelp: (cmd) => formatCommandHelp({
|
|
109
|
+
command: cmd,
|
|
110
|
+
flags: parseGlobalFlags({})
|
|
111
|
+
}),
|
|
112
|
+
subcommandDescription: () => ""
|
|
113
|
+
});
|
|
114
|
+
command.addCommand(createTelemetryStatusCommand());
|
|
115
|
+
command.addCommand(createTelemetryEnableCommand());
|
|
116
|
+
command.addCommand(createTelemetryDisableCommand());
|
|
117
|
+
return command;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
export { createTelemetryCommand as t };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=telemetry-CZkgkR_O.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-CZkgkR_O.mjs","names":[],"sources":["../src/commands/telemetry/status.ts","../src/commands/telemetry/index.ts"],"sourcesContent":["import { readUserConfig, resolveGating, userConfigPath } from '@prisma-next/cli-telemetry';\n\n/**\n * Why telemetry resolves the way it does, in the order the CLI's\n * `resolveTelemetryGate` evaluates: CI hard-disables first, then the env\n * opt-outs, then the stored `enableTelemetry`, then the opt-out default.\n */\nexport type TelemetryStatusReason =\n | 'ci'\n | 'env-opt-out'\n | 'stored-opt-out'\n | 'stored-opt-in'\n | 'default-on';\n\nexport interface TelemetryStatus {\n readonly enabled: boolean;\n readonly reason: TelemetryStatusReason;\n readonly configPath: string;\n readonly installationIdStored: boolean;\n}\n\n/**\n * Resolves the same gate the runtime uses (CI check + `resolveGating`) and\n * projects it into a user-facing status. Pure read: never mints, never\n * writes. The `installationId` value itself is never surfaced — only its\n * presence — so `status` discloses nothing identifying.\n */\nexport function resolveTelemetryStatus(inputs: {\n readonly env: Readonly<Record<string, string | undefined>>;\n readonly inCI: boolean;\n}): TelemetryStatus {\n const config = readUserConfig();\n const configPath = userConfigPath();\n const installationIdStored =\n typeof config.installationId === 'string' && config.installationId.length > 0;\n\n if (inputs.inCI) {\n return { enabled: false, reason: 'ci', configPath, installationIdStored };\n }\n\n const gating = resolveGating({ env: inputs.env, config });\n if (!gating.enabled) {\n const reason: TelemetryStatusReason =\n gating.reason === 'env-override' ? 'env-opt-out' : 'stored-opt-out';\n return { enabled: false, reason, configPath, installationIdStored };\n }\n\n const reason: TelemetryStatusReason =\n config.enableTelemetry === true ? 'stored-opt-in' : 'default-on';\n return { enabled: true, reason, configPath, installationIdStored };\n}\n\nconst REASON_EXPLANATION: Record<TelemetryStatusReason, string> = {\n ci: 'CI environment detected — telemetry is hard-disabled.',\n 'env-opt-out': 'an environment opt-out is set (DO_NOT_TRACK / PRISMA_NEXT_DISABLE_TELEMETRY).',\n 'stored-opt-out': '\"enableTelemetry\": false is stored in your config.',\n 'stored-opt-in': '\"enableTelemetry\": true is stored in your config.',\n 'default-on': 'no explicit choice is stored, so the opt-out default applies.',\n};\n\nexport function formatTelemetryStatusLines(status: TelemetryStatus): string[] {\n return [\n `Telemetry is ${status.enabled ? 'enabled' : 'disabled'}: ${REASON_EXPLANATION[status.reason]}`,\n `Config file: ${status.configPath}`,\n `Installation ID: ${status.installationIdStored ? 'stored' : 'not stored'}`,\n ];\n}\n","import { userConfigPath, writeUserConfig } from '@prisma-next/cli-telemetry';\nimport { Command } from 'commander';\nimport {\n addGlobalOptions,\n setCommandDescriptions,\n setCommandExamples,\n} from '../../utils/command-helpers';\nimport { formatCommandHelp } from '../../utils/formatters/help';\nimport {\n type CommonCommandOptions,\n parseGlobalFlags,\n parseGlobalFlagsOrExit,\n} from '../../utils/global-flags';\nimport { isCI } from '../../utils/is-ci';\nimport { createTerminalUI } from '../../utils/terminal-ui';\nimport { formatTelemetryStatusLines, resolveTelemetryStatus } from './status';\n\nfunction createTelemetryStatusCommand(): Command {\n const command = new Command('status');\n setCommandDescriptions(\n command,\n 'Show whether anonymous CLI telemetry is enabled and why',\n 'Reports whether telemetry is currently enabled or disabled and the reason\\n' +\n '(default-on, stored opt-out, environment opt-out, or CI), the path to your\\n' +\n 'user-level config file, and whether an installation ID has been stored.\\n' +\n 'Read-only: never sends an event, never mints an ID, never writes anything.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const status = resolveTelemetryStatus({ env: process.env, inCI: isCI() });\n if (flags.json) {\n ui.output(JSON.stringify(status));\n } else {\n for (const line of formatTelemetryStatusLines(status)) {\n ui.output(line);\n }\n }\n process.exit(0);\n });\n}\n\nfunction createTelemetryEnableCommand(): Command {\n const command = new Command('enable');\n setCommandDescriptions(\n command,\n 'Enable anonymous CLI telemetry',\n 'Stores \"enableTelemetry\": true in your user-level config and mints an\\n' +\n 'installation ID if one is not already stored.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n writeUserConfig({ enableTelemetry: true });\n const ui = createTerminalUI(flags);\n if (flags.json) {\n ui.output(JSON.stringify({ enableTelemetry: true, configPath: userConfigPath() }));\n } else {\n ui.output(`Telemetry enabled. Preference stored in ${userConfigPath()}.`);\n }\n process.exit(0);\n });\n}\n\nfunction createTelemetryDisableCommand(): Command {\n const command = new Command('disable');\n setCommandDescriptions(\n command,\n 'Disable anonymous CLI telemetry',\n 'Stores \"enableTelemetry\": false in your user-level config. No installation\\n' +\n 'ID is minted and no event is sent.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n writeUserConfig({ enableTelemetry: false });\n const ui = createTerminalUI(flags);\n if (flags.json) {\n ui.output(JSON.stringify({ enableTelemetry: false, configPath: userConfigPath() }));\n } else {\n ui.output(`Telemetry disabled. Preference stored in ${userConfigPath()}.`);\n }\n process.exit(0);\n });\n}\n\nexport function createTelemetryCommand(): Command {\n const command = new Command('telemetry');\n setCommandDescriptions(\n command,\n 'Inspect and change anonymous CLI telemetry',\n 'Show telemetry status, or enable / disable anonymous CLI usage data.\\n' +\n 'Telemetry is on by default (opt-out); see https://prisma-next.dev/docs/cli/telemetry\\n' +\n 'for what is collected and why.',\n );\n setCommandExamples(command, [\n 'prisma-next telemetry status',\n 'prisma-next telemetry disable',\n 'prisma-next telemetry enable',\n ]);\n command.configureHelp({\n formatHelp: (cmd) => formatCommandHelp({ command: cmd, flags: parseGlobalFlags({}) }),\n subcommandDescription: () => '',\n });\n command.addCommand(createTelemetryStatusCommand());\n command.addCommand(createTelemetryEnableCommand());\n command.addCommand(createTelemetryDisableCommand());\n return command;\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-ui-
|
|
1
|
+
{"version":3,"file":"terminal-ui-BgLiAOYi.d.mts","names":[],"sources":["../src/utils/glyph-mode.ts","../src/utils/terminal-ui.ts"],"mappings":";;;KAAY,SAAA;AAAA,UAEK,cAAA;EAAA,SACN,KAAA;EAAA,SACA,GAAA,EAAK,QAAQ,CAAC,MAAA;AAAA;;;;;AAJJ;AAErB;;;;;;;;;AAE+B;;;cCmBlB,UAAA;EAAA;;;;EAAA,SAKF,aAAA;EA8BiB;;;EAAA,SAzBjB,QAAA;EA0Ie;;;;EAAA,SApIf,WAAA;EANA;;;EAAA,SAWA,WAAA;EAKK;;;EAAA,SAAL,GAAA,EAAK,QAAA,CAAS,MAAA;EAAA,wBAEC,UAAA;cAEZ,OAAA;IAAA,SACD,KAAA;IAAA,SACA,WAAA;IAAA,SACA,WAAA;IAAA,SACA,WAAA;IAAA,SACA,GAAA,GAAM,QAAA,CAAS,MAAA;EAAA;EAAA,IAUtB,KAAA,CAAA;EAQJ;;;;EAAA,gBAAA,CAAiB,UAAA,YAAsB,SAAA;EAOvC,cAAA,CAAA,GAAkB,cAAA;EAAA,YAIN,cAAA,CAAA;EAWR;;;EAAJ,GAAA,CAAI,OAAA;EAgBC;;;EARL,OAAA,CAAQ,OAAA;EAuBH;;;EAfL,IAAA,CAAK,OAAA;EA+BA;;;EAvBL,KAAA,CAAM,OAAA;EAuCN;;;EAhCA,IAAA,CAAK,OAAA;EA0CmB;;;EAlCxB,IAAA,CAAK,OAAA;EAoI2B;;;EA5HhC,IAAA,CAAK,OAAA,UAAiB,KAAA;EAyJf;;;EAjJP,KAAA,CAAM,KAAA;EA4JF;;;EApJJ,KAAA,CAAM,OAAA;EA0JF;;;;;EAhJJ,OAAA,CAAQ,OAAA,YAAgB,KAAA,CAAM,aAAA;EAsJX;;;;EApDb,OAAA,CAAQ,OAAA,WAAkB,OAAA;;;;;EAchC,MAAA,CAAO,OAAA;;;;;;;EAeP,MAAA,CAAO,IAAA;EAQP,KAAA,CAAM,IAAA;EAGN,GAAA,CAAI,IAAA;EAGJ,IAAA,CAAK,IAAA;EAGL,GAAA,CAAI,IAAA;EAGJ,IAAA,CAAK,IAAA;EAGL,MAAA,CAAO,IAAA;AAAA"}
|