@se-studio/contentful-cms 4.14.0 → 4.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/pack/contentful/action-log.d.ts +49 -0
- package/pack/contentful/action-log.d.ts.map +1 -0
- package/pack/contentful/action-log.js +191 -0
- package/pack/contentful/action-log.js.map +1 -0
- package/pack/contentful/cma-user-agent.d.ts +10 -0
- package/pack/contentful/cma-user-agent.d.ts.map +1 -0
- package/pack/contentful/cma-user-agent.js +20 -0
- package/pack/contentful/cma-user-agent.js.map +1 -0
- package/pack/generated/version.d.ts +1 -1
- package/pack/generated/version.js +1 -1
- package/pack/telemetry/current-tool.d.ts +10 -0
- package/pack/telemetry/current-tool.d.ts.map +1 -0
- package/pack/telemetry/current-tool.js +21 -0
- package/pack/telemetry/current-tool.js.map +1 -0
- package/package.json +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @se-studio/contentful-cms Changelog
|
|
2
2
|
|
|
3
|
+
## 4.14.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6ffab5b: Publish the action-log build so `@se-studio/contentful-cms/action-log` resolves from the npm tarball, declare `@neondatabase/serverless` as an optional peer, and flush queued worker log rows before the worker CLIs exit.
|
|
8
|
+
|
|
9
|
+
## 4.14.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 6cd368d: Log cms-seo and project-build Contentful writes to the action log as worker writes. Off unless `CONTENTFUL_EVENTS_ACTION_LOG_URL` is set; warns once if the log module cannot be loaded.
|
|
14
|
+
|
|
15
|
+
## 4.14.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- c02907e: Record each cms-edit Contentful write in the contentful-events action log. A logging failure does not fail the write.
|
|
20
|
+
|
|
3
21
|
## 4.14.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type ContentfulActorKind = 'cms-edit' | 'worker';
|
|
2
|
+
export type ContentfulWriteAction = 'create' | 'save' | 'publish' | 'unpublish' | 'archive' | 'unarchive' | 'delete' | 'process' | 'upload';
|
|
3
|
+
export type ContentfulWriteEntity = 'Entry' | 'Asset' | 'ContentType' | 'Upload';
|
|
4
|
+
export interface ContentfulWriteLog {
|
|
5
|
+
spaceId: string;
|
|
6
|
+
environment: string;
|
|
7
|
+
entityType: ContentfulWriteEntity;
|
|
8
|
+
entityId: string;
|
|
9
|
+
contentType?: string | null;
|
|
10
|
+
version: number | null;
|
|
11
|
+
action: ContentfulWriteAction;
|
|
12
|
+
actorKind?: ContentfulActorKind;
|
|
13
|
+
bot?: string | null;
|
|
14
|
+
userId?: string | null;
|
|
15
|
+
}
|
|
16
|
+
interface StoredRow {
|
|
17
|
+
spaceId: string;
|
|
18
|
+
environment: string;
|
|
19
|
+
entityType: ContentfulWriteEntity;
|
|
20
|
+
entityId: string;
|
|
21
|
+
contentType: string | null;
|
|
22
|
+
version: number | null;
|
|
23
|
+
action: ContentfulWriteAction;
|
|
24
|
+
actorKind: ContentfulActorKind;
|
|
25
|
+
bot: string | null;
|
|
26
|
+
session: string | null;
|
|
27
|
+
tool: string | null;
|
|
28
|
+
job: string | null;
|
|
29
|
+
userId: string | null;
|
|
30
|
+
}
|
|
31
|
+
type Inserter = (url: string, row: StoredRow, signal?: AbortSignal) => Promise<void>;
|
|
32
|
+
export declare function versionAfterWrite(result: unknown): number | null;
|
|
33
|
+
export declare function contentTypeIdOf(result: unknown): string | null;
|
|
34
|
+
/** Run a read-only lookup for logging; null on error or after the 300ms cap. */
|
|
35
|
+
export declare function boundedLogLookup<T>(read: () => Promise<T>): Promise<T | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Record one successful Contentful write. Returns immediately.
|
|
38
|
+
* Unset CONTENTFUL_EVENTS_ACTION_LOG_URL, a thrown insert, or a slow insert
|
|
39
|
+
* never rejects and never changes the write that just finished.
|
|
40
|
+
*/
|
|
41
|
+
export declare function logContentfulWrite(input: ContentfulWriteLog): void;
|
|
42
|
+
/** Wait for queued inserts, each already capped at INSERT_TIMEOUT_MS. Never throws. */
|
|
43
|
+
export declare function flushContentfulWriteLog(): Promise<void>;
|
|
44
|
+
/** @internal Test helper. Pass null to restore the Neon insert. */
|
|
45
|
+
export declare function setActionLogInserterForTests(next: Inserter | null): void;
|
|
46
|
+
/** @internal Test helper. */
|
|
47
|
+
export declare function resetActionLogForTests(): void;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=action-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-log.d.ts","sourceRoot":"","sources":["../../src/contentful/action-log.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAExD,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,MAAM,GACN,SAAS,GACT,WAAW,GACX,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEjF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,qBAAqB,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,UAAU,SAAS;IACj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}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { currentTelemetryTool } from '../telemetry/current-tool.js';
|
|
2
|
+
import { CMA_APPLICATION } from './cma-user-agent.js';
|
|
3
|
+
const INSERT_TIMEOUT_MS = 300;
|
|
4
|
+
const clients = new Map();
|
|
5
|
+
const pending = [];
|
|
6
|
+
let inserter = insertRow;
|
|
7
|
+
function textOrNull(value) {
|
|
8
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
9
|
+
}
|
|
10
|
+
export function versionAfterWrite(result) {
|
|
11
|
+
if (typeof result !== 'object' || result === null || !('sys' in result))
|
|
12
|
+
return null;
|
|
13
|
+
const sys = result.sys;
|
|
14
|
+
if (typeof sys !== 'object' || sys === null || !('version' in sys))
|
|
15
|
+
return null;
|
|
16
|
+
return typeof sys.version === 'number' && Number.isInteger(sys.version) ? sys.version : null;
|
|
17
|
+
}
|
|
18
|
+
export function contentTypeIdOf(result) {
|
|
19
|
+
if (typeof result !== 'object' || result === null || !('sys' in result))
|
|
20
|
+
return null;
|
|
21
|
+
const sys = result.sys;
|
|
22
|
+
if (typeof sys !== 'object' || sys === null || !('contentType' in sys))
|
|
23
|
+
return null;
|
|
24
|
+
const contentType = sys.contentType;
|
|
25
|
+
if (typeof contentType !== 'object' || contentType === null || !('sys' in contentType)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const link = contentType.sys;
|
|
29
|
+
if (typeof link !== 'object' || link === null || !('id' in link))
|
|
30
|
+
return null;
|
|
31
|
+
return typeof link.id === 'string' && link.id.length > 0 ? link.id : null;
|
|
32
|
+
}
|
|
33
|
+
function workerBot() {
|
|
34
|
+
const script = textOrNull(process.env['CMS_ACTION_SCRIPT']) ?? 'script';
|
|
35
|
+
return `worker/${script}`;
|
|
36
|
+
}
|
|
37
|
+
function buildRow(input) {
|
|
38
|
+
const actorKind = input.actorKind ?? (process.env['CMS_ACTION_ACTOR'] === 'worker' ? 'worker' : 'cms-edit');
|
|
39
|
+
const bot = textOrNull(input.bot) ?? (actorKind === 'worker' ? workerBot() : CMA_APPLICATION);
|
|
40
|
+
return {
|
|
41
|
+
spaceId: input.spaceId,
|
|
42
|
+
environment: input.environment,
|
|
43
|
+
entityType: input.entityType,
|
|
44
|
+
entityId: input.entityId,
|
|
45
|
+
contentType: textOrNull(input.contentType),
|
|
46
|
+
version: input.version,
|
|
47
|
+
action: input.action,
|
|
48
|
+
actorKind,
|
|
49
|
+
bot,
|
|
50
|
+
session: textOrNull(process.env['CONTENTFUL_CMS_SESSION']),
|
|
51
|
+
tool: currentTelemetryTool(),
|
|
52
|
+
job: textOrNull(process.env['CMS_ACTION_JOB']),
|
|
53
|
+
userId: textOrNull(input.userId),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
let warnedMissingDriver = false;
|
|
57
|
+
function warnDriverUnavailable(error) {
|
|
58
|
+
if (warnedMissingDriver)
|
|
59
|
+
return;
|
|
60
|
+
warnedMissingDriver = true;
|
|
61
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
62
|
+
console.warn(`[cms-action-log] CONTENTFUL_EVENTS_ACTION_LOG_URL is set but @neondatabase/serverless could not be loaded (${reason}). Contentful writes are NOT being logged. Install it where this process runs.`);
|
|
63
|
+
}
|
|
64
|
+
async function openSql(url) {
|
|
65
|
+
let neon;
|
|
66
|
+
try {
|
|
67
|
+
({ neon } = await import('@neondatabase/serverless'));
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
warnDriverUnavailable(error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
return neon(url);
|
|
74
|
+
}
|
|
75
|
+
async function insertRow(url, row, signal) {
|
|
76
|
+
let sql = clients.get(url);
|
|
77
|
+
if (!sql) {
|
|
78
|
+
sql = await openSql(url);
|
|
79
|
+
clients.set(url, sql);
|
|
80
|
+
}
|
|
81
|
+
await sql.query(`insert into cms_action_log (
|
|
82
|
+
space_id, environment, entity_type, entity_id, content_type,
|
|
83
|
+
version, action, actor_kind, bot, session, tool, job, user_id
|
|
84
|
+
) values (
|
|
85
|
+
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13
|
|
86
|
+
)
|
|
87
|
+
on conflict do nothing`, [
|
|
88
|
+
row.spaceId,
|
|
89
|
+
row.environment,
|
|
90
|
+
row.entityType,
|
|
91
|
+
row.entityId,
|
|
92
|
+
row.contentType,
|
|
93
|
+
row.version,
|
|
94
|
+
row.action,
|
|
95
|
+
row.actorKind,
|
|
96
|
+
row.bot,
|
|
97
|
+
row.session,
|
|
98
|
+
row.tool,
|
|
99
|
+
row.job,
|
|
100
|
+
row.userId,
|
|
101
|
+
], { fetchOptions: { signal } });
|
|
102
|
+
}
|
|
103
|
+
async function runBounded(url, row) {
|
|
104
|
+
let timer;
|
|
105
|
+
const controller = new AbortController();
|
|
106
|
+
const insert = inserter(url, row, controller.signal).catch(() => {
|
|
107
|
+
/* se-exception: fail-open — a Neon error must not fail the Contentful write */
|
|
108
|
+
});
|
|
109
|
+
try {
|
|
110
|
+
await Promise.race([
|
|
111
|
+
insert,
|
|
112
|
+
new Promise((resolve) => {
|
|
113
|
+
timer = setTimeout(() => {
|
|
114
|
+
controller.abort();
|
|
115
|
+
resolve();
|
|
116
|
+
}, INSERT_TIMEOUT_MS);
|
|
117
|
+
}),
|
|
118
|
+
]);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
/* se-exception: fail-open — a Neon error must not fail the Contentful write */
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
124
|
+
if (timer !== undefined)
|
|
125
|
+
clearTimeout(timer);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** Run a read-only lookup for logging; null on error or after the 300ms cap. */
|
|
129
|
+
export async function boundedLogLookup(read) {
|
|
130
|
+
let timer;
|
|
131
|
+
const lookup = read().catch(() => null);
|
|
132
|
+
try {
|
|
133
|
+
return await Promise.race([
|
|
134
|
+
lookup,
|
|
135
|
+
new Promise((resolve) => {
|
|
136
|
+
timer = setTimeout(() => resolve(null), INSERT_TIMEOUT_MS);
|
|
137
|
+
}),
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
if (timer !== undefined)
|
|
142
|
+
clearTimeout(timer);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Record one successful Contentful write. Returns immediately.
|
|
147
|
+
* Unset CONTENTFUL_EVENTS_ACTION_LOG_URL, a thrown insert, or a slow insert
|
|
148
|
+
* never rejects and never changes the write that just finished.
|
|
149
|
+
*/
|
|
150
|
+
export function logContentfulWrite(input) {
|
|
151
|
+
try {
|
|
152
|
+
const url = process.env['CONTENTFUL_EVENTS_ACTION_LOG_URL'];
|
|
153
|
+
if (!url || !input.spaceId || !input.environment || !input.entityId)
|
|
154
|
+
return;
|
|
155
|
+
const row = buildRow(input);
|
|
156
|
+
const work = runBounded(url, row);
|
|
157
|
+
pending.push(work);
|
|
158
|
+
void work.finally(() => {
|
|
159
|
+
const index = pending.indexOf(work);
|
|
160
|
+
if (index >= 0)
|
|
161
|
+
pending.splice(index, 1);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
/* se-exception: fail-open — a Neon error must not fail the Contentful write */
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/** Wait for queued inserts, each already capped at INSERT_TIMEOUT_MS. Never throws. */
|
|
169
|
+
export async function flushContentfulWriteLog() {
|
|
170
|
+
try {
|
|
171
|
+
const batch = pending.splice(0, pending.length);
|
|
172
|
+
await Promise.all(batch);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
/* se-exception: fail-open — a Neon error must not fail the Contentful write */
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/** @internal Test helper. Pass null to restore the Neon insert. */
|
|
179
|
+
export function setActionLogInserterForTests(next) {
|
|
180
|
+
inserter = next ?? insertRow;
|
|
181
|
+
clients.clear();
|
|
182
|
+
warnedMissingDriver = false;
|
|
183
|
+
}
|
|
184
|
+
/** @internal Test helper. */
|
|
185
|
+
export function resetActionLogForTests() {
|
|
186
|
+
pending.splice(0, pending.length);
|
|
187
|
+
inserter = insertRow;
|
|
188
|
+
clients.clear();
|
|
189
|
+
warnedMissingDriver = false;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=action-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-log.js","sourceRoot":"","sources":["../../src/contentful/action-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAgD9B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAqB,CAAC;AAC7C,MAAM,OAAO,GAAoB,EAAE,CAAC;AAEpC,IAAI,QAAQ,GAAa,SAAS,CAAC;AAEnC,SAAS,UAAU,CAAC,KAAgC;IAClD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACrF,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IACvB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAChF,OAAO,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,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1,10 @@
|
|
|
1
|
+
/** SDK `application` value. Becomes `app cms-edit/<version>` in X-Contentful-User-Agent. */
|
|
2
|
+
export declare const CMA_APPLICATION = "cms-edit/4.14.3";
|
|
3
|
+
export declare function cmaClientOptions(accessToken: string): {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
application: string;
|
|
6
|
+
};
|
|
7
|
+
/** App segment of X-Contentful-User-Agent for raw CMA fetch (SDK also appends sdk/platform/os). */
|
|
8
|
+
export declare function cmaUserAgentHeader(): string;
|
|
9
|
+
export declare function cmaFetchHeaders(accessToken: string): Record<string, string>;
|
|
10
|
+
//# sourceMappingURL=cma-user-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cma-user-agent.d.ts","sourceRoot":"","sources":["../../src/contentful/cma-user-agent.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,eAAO,MAAM,eAAe,oBAAiC,CAAC;AAE9D,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAKA;AAED,mGAAmG;AACnG,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAK3E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CMS_EDIT_VERSION } from '../version.js';
|
|
2
|
+
/** SDK `application` value. Becomes `app cms-edit/<version>` in X-Contentful-User-Agent. */
|
|
3
|
+
export const CMA_APPLICATION = `cms-edit/${CMS_EDIT_VERSION}`;
|
|
4
|
+
export function cmaClientOptions(accessToken) {
|
|
5
|
+
return {
|
|
6
|
+
accessToken,
|
|
7
|
+
application: CMA_APPLICATION,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/** App segment of X-Contentful-User-Agent for raw CMA fetch (SDK also appends sdk/platform/os). */
|
|
11
|
+
export function cmaUserAgentHeader() {
|
|
12
|
+
return `app ${CMA_APPLICATION}`;
|
|
13
|
+
}
|
|
14
|
+
export function cmaFetchHeaders(accessToken) {
|
|
15
|
+
return {
|
|
16
|
+
Authorization: `Bearer ${accessToken}`,
|
|
17
|
+
'X-Contentful-User-Agent': cmaUserAgentHeader(),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=cma-user-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cma-user-agent.js","sourceRoot":"","sources":["../../src/contentful/cma-user-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,gBAAgB,EAAE,CAAC;AAE9D,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAIlD,OAAO;QACL,WAAW;QACX,WAAW,EAAE,eAAe;KAC7B,CAAC;AACJ,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,eAAe,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,OAAO;QACL,aAAa,EAAE,UAAU,WAAW,EAAE;QACtC,yBAAyB,EAAE,kBAAkB,EAAE;KAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Leaf state for the action log. Kept out of record.ts so the published pack does not pull telemetry. */
|
|
2
|
+
export declare function setCurrentTelemetryTool(cmd: string, sub?: string): void;
|
|
3
|
+
export declare function readCurrentTelemetryCommand(): {
|
|
4
|
+
command: string | undefined;
|
|
5
|
+
subcommand: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
/** Command name stored by beginTelemetryCommand, for the action log. */
|
|
8
|
+
export declare function currentTelemetryTool(): string | null;
|
|
9
|
+
export declare function resetCurrentTelemetryTool(): void;
|
|
10
|
+
//# sourceMappingURL=current-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-tool.d.ts","sourceRoot":"","sources":["../../src/telemetry/current-tool.ts"],"names":[],"mappings":"AAGA,0GAA0G;AAC1G,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAGvE;AAED,wBAAgB,2BAA2B,IAAI;IAC7C,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAEA;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAGpD;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
let command;
|
|
2
|
+
let subcommand;
|
|
3
|
+
/** Leaf state for the action log. Kept out of record.ts so the published pack does not pull telemetry. */
|
|
4
|
+
export function setCurrentTelemetryTool(cmd, sub) {
|
|
5
|
+
command = cmd;
|
|
6
|
+
subcommand = sub;
|
|
7
|
+
}
|
|
8
|
+
export function readCurrentTelemetryCommand() {
|
|
9
|
+
return { command, subcommand };
|
|
10
|
+
}
|
|
11
|
+
/** Command name stored by beginTelemetryCommand, for the action log. */
|
|
12
|
+
export function currentTelemetryTool() {
|
|
13
|
+
if (!command)
|
|
14
|
+
return null;
|
|
15
|
+
return subcommand ? `${command} ${subcommand}` : command;
|
|
16
|
+
}
|
|
17
|
+
export function resetCurrentTelemetryTool() {
|
|
18
|
+
command = undefined;
|
|
19
|
+
subcommand = undefined;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=current-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-tool.js","sourceRoot":"","sources":["../../src/telemetry/current-tool.ts"],"names":[],"mappings":"AAAA,IAAI,OAA2B,CAAC;AAChC,IAAI,UAA8B,CAAC;AAEnC,0GAA0G;AAC1G,MAAM,UAAU,uBAAuB,CAAC,GAAW,EAAE,GAAY;IAC/D,OAAO,GAAG,GAAG,CAAC;IACd,UAAU,GAAG,GAAG,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,2BAA2B;IAIzC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACjC,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,GAAG,SAAS,CAAC;IACpB,UAAU,GAAG,SAAS,CAAC;AACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/contentful-cms",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.3",
|
|
4
4
|
"description": "Editor-pack CLI for hosted cms-edit. Content editing runs on the hosted editor, not this package.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./pack/pack-public.d.ts",
|
|
20
20
|
"import": "./pack/pack-public.js"
|
|
21
|
+
},
|
|
22
|
+
"./action-log": {
|
|
23
|
+
"types": "./pack/contentful/action-log.d.ts",
|
|
24
|
+
"import": "./pack/contentful/action-log.js"
|
|
21
25
|
}
|
|
22
26
|
},
|
|
23
27
|
"bin": {
|
|
@@ -33,6 +37,14 @@
|
|
|
33
37
|
"commander": "^15.1.0",
|
|
34
38
|
"zod": "^4.6.7"
|
|
35
39
|
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@neondatabase/serverless": "^1.2.1"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"@neondatabase/serverless": {
|
|
45
|
+
"optional": true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
36
48
|
"devDependencies": {
|
|
37
49
|
"@biomejs/biome": "^2.6.8",
|
|
38
50
|
"@contentful/rich-text-types": "^17.2.7",
|