@memberjunction/archiving-action 0.0.1 → 5.29.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.
@@ -0,0 +1,18 @@
1
+ import { BaseAction } from '@memberjunction/actions';
2
+ import { ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
3
+ /**
4
+ * Action that executes an archive run for a given ArchiveConfiguration.
5
+ * Delegates to ArchiveEngine.Instance.RunArchive() and maps the result
6
+ * to an ActionResultSimple.
7
+ *
8
+ * Required Parameters:
9
+ * - ConfigurationID: ID of the ArchiveConfiguration to execute
10
+ */
11
+ export declare class ArchiveDataAction extends BaseAction {
12
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
13
+ /**
14
+ * Extracts a parameter value by name (case-insensitive) from the action params.
15
+ */
16
+ private GetParamValue;
17
+ }
18
+ //# sourceMappingURL=ArchiveDataAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArchiveDataAction.d.ts","sourceRoot":"","sources":["../src/ArchiveDataAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAInF;;;;;;;GAOG;AACH,qBACa,iBAAkB,SAAQ,UAAU;cAC7B,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAyCvF;;OAEG;IACH,OAAO,CAAC,aAAa;CAKxB"}
@@ -0,0 +1,70 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { RegisterClass } from '@memberjunction/global';
8
+ import { BaseAction } from '@memberjunction/actions';
9
+ import { LogError, LogStatus } from '@memberjunction/core';
10
+ import { ArchiveEngine } from '@memberjunction/archiving-engine';
11
+ /**
12
+ * Action that executes an archive run for a given ArchiveConfiguration.
13
+ * Delegates to ArchiveEngine.Instance.RunArchive() and maps the result
14
+ * to an ActionResultSimple.
15
+ *
16
+ * Required Parameters:
17
+ * - ConfigurationID: ID of the ArchiveConfiguration to execute
18
+ */
19
+ let ArchiveDataAction = class ArchiveDataAction extends BaseAction {
20
+ async InternalRunAction(params) {
21
+ const configId = this.GetParamValue(params, 'configurationid');
22
+ if (!configId) {
23
+ return {
24
+ Success: false,
25
+ ResultCode: 'MISSING_CONFIGURATION_ID',
26
+ Message: 'ConfigurationID parameter is required',
27
+ };
28
+ }
29
+ try {
30
+ LogStatus(`ArchiveDataAction: Starting archive run for configuration ${configId}`);
31
+ const result = await ArchiveEngine.Instance.RunArchive(configId, params.ContextUser);
32
+ if (result.Success) {
33
+ return {
34
+ Success: true,
35
+ ResultCode: 'ARCHIVE_COMPLETE',
36
+ Message: `Archive run ${result.ArchiveRunId} completed successfully. ` +
37
+ `Archived: ${result.ArchivedRecords}, Skipped: ${result.SkippedRecords}, ` +
38
+ `Failed: ${result.FailedRecords}, Bytes: ${result.TotalBytesArchived}`,
39
+ };
40
+ }
41
+ return {
42
+ Success: false,
43
+ ResultCode: 'ARCHIVE_FAILED',
44
+ Message: result.ErrorMessage ?? 'Archive run failed with no error message',
45
+ };
46
+ }
47
+ catch (error) {
48
+ const message = error instanceof Error ? error.message : String(error);
49
+ LogError(`ArchiveDataAction failed: ${message}`);
50
+ return {
51
+ Success: false,
52
+ ResultCode: 'ARCHIVE_ERROR',
53
+ Message: message,
54
+ };
55
+ }
56
+ }
57
+ /**
58
+ * Extracts a parameter value by name (case-insensitive) from the action params.
59
+ */
60
+ GetParamValue(params, name) {
61
+ const lowerName = name.toLowerCase();
62
+ const param = params.Params.find(p => p.Name.toLowerCase() === lowerName);
63
+ return param?.Value != null ? String(param.Value) : undefined;
64
+ }
65
+ };
66
+ ArchiveDataAction = __decorate([
67
+ RegisterClass(BaseAction, 'Archive Data')
68
+ ], ArchiveDataAction);
69
+ export { ArchiveDataAction };
70
+ //# sourceMappingURL=ArchiveDataAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArchiveDataAction.js","sourceRoot":"","sources":["../src/ArchiveDataAction.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE;;;;;;;GAOG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IACnC,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,0BAA0B;gBACtC,OAAO,EAAE,uCAAuC;aACnD,CAAC;QACN,CAAC;QAED,IAAI,CAAC;YACD,SAAS,CAAC,6DAA6D,QAAQ,EAAE,CAAC,CAAC;YACnF,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;YAErF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,kBAAkB;oBA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junction/actions-base';
3
+ /**
4
+ * Action that restores a previously archived record version.
5
+ * Delegates to ArchiveEngine.Instance.Recovery.RestoreVersion() and maps
6
+ * the result to an ActionResultSimple.
7
+ *
8
+ * Required Parameters:
9
+ * - ArchiveRunDetailID: ID of the ArchiveRunDetail record to restore
10
+ */
11
+ export declare class RestoreRecordAction extends BaseAction {
12
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
13
+ /**
14
+ * Extracts a parameter value by name (case-insensitive) from the action params.
15
+ */
16
+ private GetParamValue;
17
+ }
18
+ //# sourceMappingURL=RestoreRecordAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RestoreRecordAction.d.ts","sourceRoot":"","sources":["../src/RestoreRecordAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAInF;;;;;;;GAOG;AACH,qBACa,mBAAoB,SAAQ,UAAU;cAC/B,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwCvF;;OAEG;IACH,OAAO,CAAC,aAAa;CAKxB"}
@@ -0,0 +1,69 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { RegisterClass } from '@memberjunction/global';
8
+ import { BaseAction } from '@memberjunction/actions';
9
+ import { LogError, LogStatus } from '@memberjunction/core';
10
+ import { ArchiveEngine } from '@memberjunction/archiving-engine';
11
+ /**
12
+ * Action that restores a previously archived record version.
13
+ * Delegates to ArchiveEngine.Instance.Recovery.RestoreVersion() and maps
14
+ * the result to an ActionResultSimple.
15
+ *
16
+ * Required Parameters:
17
+ * - ArchiveRunDetailID: ID of the ArchiveRunDetail record to restore
18
+ */
19
+ let RestoreRecordAction = class RestoreRecordAction extends BaseAction {
20
+ async InternalRunAction(params) {
21
+ const detailId = this.GetParamValue(params, 'archiverundetailid');
22
+ if (!detailId) {
23
+ return {
24
+ Success: false,
25
+ ResultCode: 'MISSING_DETAIL_ID',
26
+ Message: 'ArchiveRunDetailID parameter is required',
27
+ };
28
+ }
29
+ try {
30
+ LogStatus(`RestoreRecordAction: Restoring archived version from detail ${detailId}`);
31
+ const result = await ArchiveEngine.Instance.Recovery.RestoreVersion(detailId, params.ContextUser);
32
+ if (result.Success) {
33
+ return {
34
+ Success: true,
35
+ ResultCode: 'RESTORE_COMPLETE',
36
+ Message: `Record restored successfully. ` +
37
+ `Restored fields: ${result.RestoredFields.join(', ') || 'none'}`,
38
+ };
39
+ }
40
+ return {
41
+ Success: false,
42
+ ResultCode: 'RESTORE_FAILED',
43
+ Message: result.ErrorMessage ?? 'Restore failed with no error message',
44
+ };
45
+ }
46
+ catch (error) {
47
+ const message = error instanceof Error ? error.message : String(error);
48
+ LogError(`RestoreRecordAction failed: ${message}`);
49
+ return {
50
+ Success: false,
51
+ ResultCode: 'RESTORE_ERROR',
52
+ Message: message,
53
+ };
54
+ }
55
+ }
56
+ /**
57
+ * Extracts a parameter value by name (case-insensitive) from the action params.
58
+ */
59
+ GetParamValue(params, name) {
60
+ const lowerName = name.toLowerCase();
61
+ const param = params.Params.find(p => p.Name.toLowerCase() === lowerName);
62
+ return param?.Value != null ? String(param.Value) : undefined;
63
+ }
64
+ };
65
+ RestoreRecordAction = __decorate([
66
+ RegisterClass(BaseAction, 'Restore Archived Record')
67
+ ], RestoreRecordAction);
68
+ export { RestoreRecordAction };
69
+ //# sourceMappingURL=R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zE,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,QAAQ,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;YACnD,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,eAAe;gBAC3B,OAAO,EAAE,OAAO;aACnB,CAAC;QACN,CAAC;IACL,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,MAAuB,EAAE,IAAY;QACvD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,CAAC;QAC1E,OAAO,KAAK,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;CACJ,CAAA;AAjDY,mBAAmB;IAD/B,aAAa,CAAC,UAAU,EAAE,yBAAyB,CAAC;GACxC,mBAAmB,CAiD/B"}
@@ -0,0 +1,26 @@
1
+ import { BaseAction } from '@memberjunction/actions';
2
+ import { ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
3
+ /**
4
+ * Action that discovers all active ArchiveConfigurations and executes each one.
5
+ * Designed for scheduled daily/weekly runs where all active configurations should
6
+ * be processed in a single invocation.
7
+ *
8
+ * No parameters required — the action queries for active configurations automatically.
9
+ */
10
+ export declare class RunAllActiveArchivesAction extends BaseAction {
11
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
12
+ /**
13
+ * Queries the database for all active ArchiveConfiguration IDs.
14
+ */
15
+ private LoadActiveConfigurationIds;
16
+ /**
17
+ * Executes all configurations sequentially. Sequential execution prevents
18
+ * overwhelming the storage backend and database with concurrent archive runs.
19
+ */
20
+ private ExecuteAllConfigurations;
21
+ /**
22
+ * Aggregates individual run results into a single ActionResultSimple.
23
+ */
24
+ private BuildSummaryResult;
25
+ }
26
+ //# sourceMappingURL=RunAllActiveArchivesAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunAllActiveArchivesAction.d.ts","sourceRoot":"","sources":["../src/RunAllActiveArchivesAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKnF;;;;;;GAMG;AACH,qBACa,0BAA2B,SAAQ,UAAU;cACtC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA0BvF;;OAEG;YACW,0BAA0B;IAgBxC;;;OAGG;YACW,wBAAwB;IAiCtC;;OAEG;IACH,OAAO,CAAC,kBAAkB;CA0B7B"}
@@ -0,0 +1,120 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { RegisterClass } from '@memberjunction/global';
8
+ import { BaseAction } from '@memberjunction/actions';
9
+ import { LogError, LogStatus, RunView } from '@memberjunction/core';
10
+ import { ArchiveEngine } from '@memberjunction/archiving-engine';
11
+ /**
12
+ * Action that discovers all active ArchiveConfigurations and executes each one.
13
+ * Designed for scheduled daily/weekly runs where all active configurations should
14
+ * be processed in a single invocation.
15
+ *
16
+ * No parameters required — the action queries for active configurations automatically.
17
+ */
18
+ let RunAllActiveArchivesAction = class RunAllActiveArchivesAction extends BaseAction {
19
+ async InternalRunAction(params) {
20
+ try {
21
+ const configIds = await this.LoadActiveConfigurationIds(params);
22
+ if (configIds.length === 0) {
23
+ return {
24
+ Success: true,
25
+ ResultCode: 'NO_ACTIVE_CONFIGS',
26
+ Message: 'No active archive configurations found. Nothing to do.',
27
+ };
28
+ }
29
+ LogStatus(`RunAllActiveArchives: Found ${configIds.length} active configuration(s). Starting execution...`);
30
+ const results = await this.ExecuteAllConfigurations(configIds, params);
31
+ return this.BuildSummaryResult(results);
32
+ }
33
+ catch (error) {
34
+ const message = error instanceof Error ? error.message : String(error);
35
+ LogError(`RunAllActiveArchives failed: ${message}`);
36
+ return {
37
+ Success: false,
38
+ ResultCode: 'ARCHIVE_BATCH_ERROR',
39
+ Message: message,
40
+ };
41
+ }
42
+ }
43
+ /**
44
+ * Queries the database for all active ArchiveConfiguration IDs.
45
+ */
46
+ async LoadActiveConfigurationIds(params) {
47
+ const rv = new RunView();
48
+ const result = await rv.RunView({
49
+ EntityName: 'MJ: Archive Configurations',
50
+ ExtraFilter: `IsActive=1 AND Status <> 'Running'`,
51
+ Fields: ['ID'],
52
+ ResultType: 'simple',
53
+ }, params.ContextUser);
54
+ if (!result.Success) {
55
+ throw new Error(`Failed to query active configurations: ${result.ErrorMessage}`);
56
+ }
57
+ return result.Results.map(r => r.ID);
58
+ }
59
+ /**
60
+ * Executes all configurations sequentially. Sequential execution prevents
61
+ * overwhelming the storage backend and database with concurrent archive runs.
62
+ */
63
+ async ExecuteAllConfigurations(configIds, params) {
64
+ const outcomes = [];
65
+ for (const configId of configIds) {
66
+ try {
67
+ LogStatus(`RunAllActiveArchives: Running configuration ${configId}`);
68
+ const result = await ArchiveEngine.Instance.RunArchive(configId, params.ContextUser);
69
+ outcomes.push({ ConfigId: configId, Result: result });
70
+ }
71
+ catch (error) {
72
+ const message = error instanceof Error ? error.message : String(error);
73
+ LogError(`RunAllActiveArchives: Configuration ${configId} threw an error: ${message}`);
74
+ outcomes.push({
75
+ ConfigId: configId,
76
+ Result: {
77
+ Success: false,
78
+ ArchiveRunId: '',
79
+ TotalRecords: 0,
80
+ ArchivedRecords: 0,
81
+ FailedRecords: 0,
82
+ SkippedRecords: 0,
83
+ TotalBytesArchived: 0,
84
+ ErrorMessage: message,
85
+ },
86
+ });
87
+ }
88
+ }
89
+ return outcomes;
90
+ }
91
+ /**
92
+ * Aggregates individual run results into a single ActionResultSimple.
93
+ */
94
+ BuildSummaryResult(outcomes) {
95
+ const succeeded = outcomes.filter(o => o.Result.Success).length;
96
+ const failed = outcomes.length - succeeded;
97
+ const totalArchived = outcomes.reduce((sum, o) => sum + o.Result.ArchivedRecords, 0);
98
+ const totalFailed = outcomes.reduce((sum, o) => sum + o.Result.FailedRecords, 0);
99
+ const totalBytes = outcomes.reduce((sum, o) => sum + o.Result.TotalBytesArchived, 0);
100
+ const allSucceeded = failed === 0;
101
+ const resultCode = allSucceeded ? 'ALL_ARCHIVES_COMPLETE' : 'SOME_ARCHIVES_FAILED';
102
+ const lines = outcomes.map(o => {
103
+ const status = o.Result.Success ? 'OK' : 'FAILED';
104
+ return ` [${status}] ${o.ConfigId}: archived=${o.Result.ArchivedRecords}, failed=${o.Result.FailedRecords}${o.Result.ErrorMessage ? `, error=${o.Result.ErrorMessage}` : ''}`;
105
+ });
106
+ const message = `Ran ${outcomes.length} configuration(s): ${succeeded} succeeded, ${failed} failed. ` +
107
+ `Total archived: ${totalArchived}, total failed: ${totalFailed}, total bytes: ${totalBytes}\n` +
108
+ lines.join('\n');
109
+ return {
110
+ Success: allSucceeded,
111
+ ResultCode: resultCode,
112
+ Message: message,
113
+ };
114
+ }
115
+ };
116
+ RunAllActiveArchivesAction = __decorate([
117
+ RegisterClass(BaseAction, 'Run All Active Archives')
118
+ ], RunAllActiveArchivesAction);
119
+ export { RunAllActiveArchivesAction };
120
+ //# sourceMappingURL=RunAllActiveArchivesAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunAllActiveArchivesAction.js","sourceRoot":"","sources":["../src/RunAllActiveArchivesAction.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE;;;;;;GAMG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU;IAC5C,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;YAChE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,mBAAmB;oBAC/B,OAAO,EAAE,wDAAwD;iBACpE,CAAC;YACN,CAAC;YAED,SAAS,CAAC,+BAA+B,SAAS,CAAC,MAAM,iDAAiD,CAAC,CAAC;YAE5G,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACvE,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,QAAQ,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAC;YACpD,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,U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AC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,sBAAsB,CAAC;QAEnF,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YAC3B,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;YAClD,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,QAAQ,cAAc,CAAC,CAAC,MAAM,CAAC,eAAe,YAAY,CAAC,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACnL,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,GACT,OAAO,QAAQ,CAAC,MAAM,sBAAsB,SAAS,eAAe,MAAM,WAAW;YACrF,mBAAmB,aAAa,mBAAmB,WAAW,kBAAkB,UAAU,IAAI;YAC9F,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErB,OAAO;YACH,OAAO,EAAE,YAAY;YACrB,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,OAAO;SACnB,CAAC;IACN,CAAC;CACJ,CAAA;AAhHY,0BAA0B;IADtC,aAAa,CAAC,UAAU,EAAE,yBAAyB,CAAC;GACxC,0BAA0B,CAgHtC"}
@@ -0,0 +1,4 @@
1
+ export * from './ArchiveDataAction.js';
2
+ export * from './RestoreRecordAction.js';
3
+ export * from './RunAllActiveArchivesAction.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './ArchiveDataAction.js';
2
+ export * from './RestoreRecordAction.js';
3
+ export * from './RunAllActiveArchivesAction.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,28 @@
1
1
  {
2
2
  "name": "@memberjunction/archiving-action",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @memberjunction/archiving-action",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
3
+ "type": "module",
4
+ "version": "5.29.0",
5
+ "description": "Archive and restore actions for MemberJunction Archiving Engine",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "/dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc && tsc-alias -f",
13
+ "watch": "tsc -w"
14
+ },
15
+ "author": "MemberJunction.com",
16
+ "license": "ISC",
17
+ "dependencies": {
18
+ "@memberjunction/core": "5.29.0",
19
+ "@memberjunction/global": "5.29.0",
20
+ "@memberjunction/actions-base": "5.29.0",
21
+ "@memberjunction/actions": "5.29.0",
22
+ "@memberjunction/archiving-engine": "5.29.0"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/MemberJunction/MJ"
27
+ }
10
28
  }
package/README.md DELETED
@@ -1,45 +0,0 @@
1
- # @memberjunction/archiving-action
2
-
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@memberjunction/archiving-action`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**