@camunda/ccma-shared-types 12.9.0 → 12.10.0
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.
|
@@ -4,8 +4,12 @@ export declare const ACTIVITY_RETENTION_FLAG = "shared.activityRetention";
|
|
|
4
4
|
export declare const ACTIVITY_RETENTION_KEEP_FOREVER = 0;
|
|
5
5
|
/** The most entries in one chunk of the sync to audit-logger. */
|
|
6
6
|
export declare const ACTIVITY_RETENTION_SYNC_CHUNK = 1000;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The period of a new org: Keep forever. The purge then has no work for these
|
|
9
|
+
* orgs until an owner, or an explicit selection in enterprise onboarding, sets
|
|
10
|
+
* a period. An onboarding of an existing org with no value keeps its period.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ACTIVITY_RETENTION_DEFAULT_MONTHS = 0;
|
|
9
13
|
/** The periods that an owner can select, in months. 0 is "Keep forever". */
|
|
10
14
|
export declare const ACTIVITY_RETENTION_CHOICES: readonly [6, 12, 18, 24, 36, 60, 0];
|
|
11
15
|
export type ActivityRetentionMonths = (typeof ACTIVITY_RETENTION_CHOICES)[number];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const ACTIVITY_RETENTION_FLAG = "shared.activityRetention";
|
|
2
2
|
const ACTIVITY_RETENTION_KEEP_FOREVER = 0;
|
|
3
3
|
const ACTIVITY_RETENTION_SYNC_CHUNK = 1e3;
|
|
4
|
-
const ACTIVITY_RETENTION_DEFAULT_MONTHS =
|
|
4
|
+
const ACTIVITY_RETENTION_DEFAULT_MONTHS = ACTIVITY_RETENTION_KEEP_FOREVER;
|
|
5
5
|
const ACTIVITY_RETENTION_CHOICES = [6, 12, 18, 24, 36, 60, 0];
|
|
6
6
|
const LABELS = {
|
|
7
7
|
0: "Keep forever",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants/activity-retention.const.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\n/** The feature flag that gates the whole activity retention feature. */\nexport const ACTIVITY_RETENTION_FLAG = 'shared.activityRetention'\n\n/** The stored value for \"Keep forever\". Months are never 0 otherwise. */\nexport const ACTIVITY_RETENTION_KEEP_FOREVER = 0\n\n/** The most entries in one chunk of the sync to audit-logger. */\nexport const ACTIVITY_RETENTION_SYNC_CHUNK = 1000\n\n
|
|
5
|
-
"mappings": "AAOO,MAAM,0BAA0B;AAGhC,MAAM,kCAAkC;AAGxC,MAAM,gCAAgC;
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\n/** The feature flag that gates the whole activity retention feature. */\nexport const ACTIVITY_RETENTION_FLAG = 'shared.activityRetention'\n\n/** The stored value for \"Keep forever\". Months are never 0 otherwise. */\nexport const ACTIVITY_RETENTION_KEEP_FOREVER = 0\n\n/** The most entries in one chunk of the sync to audit-logger. */\nexport const ACTIVITY_RETENTION_SYNC_CHUNK = 1000\n\n/**\n * The period of a new org: Keep forever. The purge then has no work for these\n * orgs until an owner, or an explicit selection in enterprise onboarding, sets\n * a period. An onboarding of an existing org with no value keeps its period.\n */\nexport const ACTIVITY_RETENTION_DEFAULT_MONTHS = ACTIVITY_RETENTION_KEEP_FOREVER\n\n/** The periods that an owner can select, in months. 0 is \"Keep forever\". */\nexport const ACTIVITY_RETENTION_CHOICES = [6, 12, 18, 24, 36, 60, 0] as const\n\nexport type ActivityRetentionMonths =\n (typeof ACTIVITY_RETENTION_CHOICES)[number]\n\nconst LABELS: Record<ActivityRetentionMonths, string> = {\n 0: 'Keep forever',\n 6: '6 months',\n 12: '1 year',\n 18: '1.5 years',\n 24: '2 years',\n 36: '3 years',\n 60: '5 years',\n}\n\n/** The text of a period, the same in Activity entries and approval summaries. */\nexport const activityRetentionLabel = (months: ActivityRetentionMonths) =>\n LABELS[months]\n\nexport const isActivityRetentionMonths = (\n value: unknown,\n): value is ActivityRetentionMonths =>\n ACTIVITY_RETENTION_CHOICES.some((choice) => choice === value)\n\n/** True for a period that deletes entries: a valid period, not \"Keep forever\". */\nexport const isLimitedActivityRetention = (\n value: unknown,\n): value is ActivityRetentionMonths =>\n isActivityRetentionMonths(value) && value !== ACTIVITY_RETENTION_KEEP_FOREVER\n\n/**\n * The date before which an entry is too old. It subtracts calendar months in\n * UTC. If the target month is shorter, it takes the last day of that month.\n */\nexport const activityRetentionCutoff = (now: Date, months: number): Date => {\n const target = new Date(now.getTime())\n // Day 1 first, so setUTCMonth cannot overflow into the next month.\n target.setUTCDate(1)\n target.setUTCMonth(target.getUTCMonth() - months)\n const lastDay = new Date(\n Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0),\n ).getUTCDate()\n target.setUTCDate(Math.min(now.getUTCDate(), lastDay))\n return target\n}\n"],
|
|
5
|
+
"mappings": "AAOO,MAAM,0BAA0B;AAGhC,MAAM,kCAAkC;AAGxC,MAAM,gCAAgC;AAOtC,MAAM,oCAAoC;AAG1C,MAAM,6BAA6B,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC;AAKnE,MAAM,SAAkD;AAAA,EACtD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAGO,MAAM,yBAAyB,CAAC,WACrC,OAAO,MAAM;AAER,MAAM,4BAA4B,CACvC,UAEA,2BAA2B,KAAK,CAAC,WAAW,WAAW,KAAK;AAGvD,MAAM,6BAA6B,CACxC,UAEA,0BAA0B,KAAK,KAAK,UAAU;AAMzC,MAAM,0BAA0B,CAAC,KAAW,WAAyB;AAC1E,QAAM,SAAS,IAAI,KAAK,IAAI,QAAQ,CAAC;AAErC,SAAO,WAAW,CAAC;AACnB,SAAO,YAAY,OAAO,YAAY,IAAI,MAAM;AAChD,QAAM,UAAU,IAAI;AAAA,IAClB,KAAK,IAAI,OAAO,eAAe,GAAG,OAAO,YAAY,IAAI,GAAG,CAAC;AAAA,EAC/D,EAAE,WAAW;AACb,SAAO,WAAW,KAAK,IAAI,IAAI,WAAW,GAAG,OAAO,CAAC;AACrD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED