@memberjunction/ng-workspace-initializer 0.0.1 → 3.0.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.
- package/dist/lib/models/workspace-types.d.ts +21 -0
- package/dist/lib/models/workspace-types.d.ts.map +1 -0
- package/dist/lib/models/workspace-types.js +7 -0
- package/dist/lib/models/workspace-types.js.map +1 -0
- package/dist/lib/services/workspace-initializer.service.d.ts +32 -0
- package/dist/lib/services/workspace-initializer.service.d.ts.map +1 -0
- package/dist/lib/services/workspace-initializer.service.js +204 -0
- package/dist/lib/services/workspace-initializer.service.js.map +1 -0
- package/dist/lib/workspace-initializer.module.d.ts +7 -0
- package/dist/lib/workspace-initializer.module.d.ts.map +1 -0
- package/dist/lib/workspace-initializer.module.js +25 -0
- package/dist/lib/workspace-initializer.module.js.map +1 -0
- package/dist/public-api.d.ts +7 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +7 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +44 -6
- package/README.md +0 -45
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Initializer - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Extracted from MJExplorer AppComponent to make workspace initialization reusable
|
|
5
|
+
*/
|
|
6
|
+
export interface WorkspaceEnvironment {
|
|
7
|
+
GRAPHQL_URI: string;
|
|
8
|
+
GRAPHQL_WS_URI: string;
|
|
9
|
+
MJ_CORE_SCHEMA_NAME: string;
|
|
10
|
+
}
|
|
11
|
+
export interface WorkspaceInitResult {
|
|
12
|
+
success: boolean;
|
|
13
|
+
error?: WorkspaceInitError;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkspaceInitError {
|
|
16
|
+
type: 'no_roles' | 'no_access' | 'token_expired' | 'network' | 'unknown';
|
|
17
|
+
message: string;
|
|
18
|
+
userMessage: string;
|
|
19
|
+
shouldRetry: boolean;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=workspace-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-types.d.ts","sourceRoot":"","sources":["../../../src/lib/models/workspace-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,eAAe,GAAG,SAAS,GAAG,SAAS,CAAC;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-types.js","sourceRoot":"","sources":["../../../src/lib/models/workspace-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MJAuthBase, StandardUserInfo } from '@memberjunction/ng-auth-services';
|
|
2
|
+
import { StartupValidationService } from '@memberjunction/ng-explorer-core';
|
|
3
|
+
import { WorkspaceEnvironment, WorkspaceInitResult, WorkspaceInitError } from '../models/workspace-types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class WorkspaceInitializerService {
|
|
6
|
+
private authBase;
|
|
7
|
+
private startupValidationService;
|
|
8
|
+
constructor(authBase: MJAuthBase, startupValidationService: StartupValidationService);
|
|
9
|
+
/**
|
|
10
|
+
* Initialize workspace with authenticated user
|
|
11
|
+
* Replaces all the logic from AppComponent.handleLogin()
|
|
12
|
+
*/
|
|
13
|
+
initializeWorkspace(token: string, userInfo: StandardUserInfo, environment: WorkspaceEnvironment): Promise<WorkspaceInitResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Classify errors into actionable types
|
|
16
|
+
* Replaces AppComponent error handling logic
|
|
17
|
+
*/
|
|
18
|
+
classifyError(err: any): WorkspaceInitError;
|
|
19
|
+
/**
|
|
20
|
+
* Helper function to safely check if an error is related to missing user roles
|
|
21
|
+
* Extracted from AppComponent.isNoUserRolesError()
|
|
22
|
+
*/
|
|
23
|
+
private isNoUserRolesError;
|
|
24
|
+
/**
|
|
25
|
+
* Handle authentication retry with backoff
|
|
26
|
+
* Replaces AppComponent.handleAuthRetry() logic
|
|
27
|
+
*/
|
|
28
|
+
handleAuthRetry(error: WorkspaceInitError, currentPath: string): Promise<boolean>;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkspaceInitializerService, never>;
|
|
30
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WorkspaceInitializerService>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=workspace-initializer.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-initializer.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/workspace-initializer.service.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAiB,MAAM,kCAAkC,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;;AAG1G,qBAGa,2BAA2B;IAEpC,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,wBAAwB;gBADxB,QAAQ,EAAE,UAAU,EACpB,wBAAwB,EAAE,wBAAwB;IAG5D;;;OAGG;IACG,mBAAmB,CACvB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,gBAAgB,EAC1B,WAAW,EAAE,oBAAoB,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAqE/B;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,kBAAkB;IAsD3C;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IA0C1B;;;OAGG;IACG,eAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;yCA/L5E,2BAA2B;6CAA3B,2BAA2B;CAqNvC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Initializer Service
|
|
3
|
+
*
|
|
4
|
+
* Extracted from MJExplorer AppComponent to make workspace initialization reusable
|
|
5
|
+
* across all MemberJunction applications. Handles GraphQL setup, user validation,
|
|
6
|
+
* error classification, and auth retry logic.
|
|
7
|
+
*/
|
|
8
|
+
import { Injectable } from '@angular/core';
|
|
9
|
+
import { LogStatus, Metadata } from '@memberjunction/core';
|
|
10
|
+
import { setupGraphQLClient, GraphQLProviderConfigData } from '@memberjunction/graphql-dataprovider';
|
|
11
|
+
import { AuthErrorType } from '@memberjunction/ng-auth-services';
|
|
12
|
+
import { SharedService } from '@memberjunction/ng-shared';
|
|
13
|
+
import { lastValueFrom } from 'rxjs';
|
|
14
|
+
import * as i0 from "@angular/core";
|
|
15
|
+
import * as i1 from "@memberjunction/ng-auth-services";
|
|
16
|
+
import * as i2 from "@memberjunction/ng-explorer-core";
|
|
17
|
+
export class WorkspaceInitializerService {
|
|
18
|
+
authBase;
|
|
19
|
+
startupValidationService;
|
|
20
|
+
constructor(authBase, startupValidationService) {
|
|
21
|
+
this.authBase = authBase;
|
|
22
|
+
this.startupValidationService = startupValidationService;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Initialize workspace with authenticated user
|
|
26
|
+
* Replaces all the logic from AppComponent.handleLogin()
|
|
27
|
+
*/
|
|
28
|
+
async initializeWorkspace(token, userInfo, environment) {
|
|
29
|
+
if (!token) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
error: {
|
|
33
|
+
type: 'unknown',
|
|
34
|
+
message: 'No token provided',
|
|
35
|
+
userMessage: 'Authentication token is missing. Please log in again.',
|
|
36
|
+
shouldRetry: false
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const start = Date.now();
|
|
42
|
+
// 1. Setup GraphQL client with token refresh callback
|
|
43
|
+
const config = new GraphQLProviderConfigData(token, environment.GRAPHQL_URI, environment.GRAPHQL_WS_URI, async () => {
|
|
44
|
+
// v3.0 API - clean abstraction, no provider-specific logic!
|
|
45
|
+
const token = await this.authBase.refreshToken();
|
|
46
|
+
return token.idToken;
|
|
47
|
+
}, environment.MJ_CORE_SCHEMA_NAME);
|
|
48
|
+
await setupGraphQLClient(config);
|
|
49
|
+
const end = Date.now();
|
|
50
|
+
console.log(`[Workspace] GraphQL client setup complete: ${end - start}ms`);
|
|
51
|
+
// 2. Load metadata and validate user
|
|
52
|
+
await SharedService.RefreshData(true);
|
|
53
|
+
const md = new Metadata();
|
|
54
|
+
if (!md.CurrentUser) {
|
|
55
|
+
return {
|
|
56
|
+
success: false,
|
|
57
|
+
error: {
|
|
58
|
+
type: 'no_access',
|
|
59
|
+
message: "User doesn't have access to the application",
|
|
60
|
+
userMessage: "You don't have access to the application, contact your system administrator.",
|
|
61
|
+
shouldRetry: false
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// 3. Run startup validation checks (with small delay for initialization)
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
this.startupValidationService.validateSystemSetup();
|
|
68
|
+
}, 500);
|
|
69
|
+
// Clear any JWT retry timestamps on successful login
|
|
70
|
+
localStorage.removeItem('jwt-retry-ts');
|
|
71
|
+
return {
|
|
72
|
+
success: true
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
const error = this.classifyError(err);
|
|
77
|
+
return {
|
|
78
|
+
success: false,
|
|
79
|
+
error
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Classify errors into actionable types
|
|
85
|
+
* Replaces AppComponent error handling logic
|
|
86
|
+
*/
|
|
87
|
+
classifyError(err) {
|
|
88
|
+
// Check for no-roles error first (highest priority)
|
|
89
|
+
if (this.isNoUserRolesError(err)) {
|
|
90
|
+
// Add the validation issue through the service
|
|
91
|
+
this.startupValidationService.addNoRolesValidationIssue();
|
|
92
|
+
return {
|
|
93
|
+
type: 'no_roles',
|
|
94
|
+
message: err.message || 'No user roles assigned',
|
|
95
|
+
userMessage: 'Your account does not have any roles assigned. Please contact your administrator.',
|
|
96
|
+
shouldRetry: false
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// Check for access denied
|
|
100
|
+
if (err.message?.includes("don't have access")) {
|
|
101
|
+
return {
|
|
102
|
+
type: 'no_access',
|
|
103
|
+
message: err.message,
|
|
104
|
+
userMessage: err.message,
|
|
105
|
+
shouldRetry: false
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// Check for token expiration
|
|
109
|
+
const authError = this.authBase.classifyError(err);
|
|
110
|
+
if (authError.type === AuthErrorType.TOKEN_EXPIRED) {
|
|
111
|
+
return {
|
|
112
|
+
type: 'token_expired',
|
|
113
|
+
message: authError.message,
|
|
114
|
+
userMessage: authError.userMessage || 'Your session has expired. Please log in again.',
|
|
115
|
+
shouldRetry: true
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// Network errors
|
|
119
|
+
if (err.message?.includes('network') || err.message?.includes('fetch')) {
|
|
120
|
+
return {
|
|
121
|
+
type: 'network',
|
|
122
|
+
message: err.message,
|
|
123
|
+
userMessage: 'Network error. Please check your connection and try again.',
|
|
124
|
+
shouldRetry: true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
// Unknown error
|
|
128
|
+
return {
|
|
129
|
+
type: 'unknown',
|
|
130
|
+
message: err.message || 'Unknown error',
|
|
131
|
+
userMessage: 'An unexpected error occurred. Please try again.',
|
|
132
|
+
shouldRetry: false
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Helper function to safely check if an error is related to missing user roles
|
|
137
|
+
* Extracted from AppComponent.isNoUserRolesError()
|
|
138
|
+
*/
|
|
139
|
+
isNoUserRolesError(err) {
|
|
140
|
+
try {
|
|
141
|
+
// Check if error has response with errors array
|
|
142
|
+
if (!err || typeof err !== 'object')
|
|
143
|
+
return false;
|
|
144
|
+
// Check for GraphQL-style errors
|
|
145
|
+
if (err.response && Array.isArray(err.response.errors)) {
|
|
146
|
+
return err.response.errors.some((e) => e && e.message && typeof e.message === 'string' &&
|
|
147
|
+
e.message.includes('does not have read permissions on User Roles'));
|
|
148
|
+
}
|
|
149
|
+
// Check for specific "ResourceTypes" error which happens when user has no roles
|
|
150
|
+
if (err.toString && typeof err.toString === 'function') {
|
|
151
|
+
const errorString = err.toString();
|
|
152
|
+
// This is the specific error we're seeing that indicates no roles
|
|
153
|
+
if (errorString.includes("Cannot read properties of undefined (reading 'ResourceTypes')")) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Check for error message directly on the error object
|
|
158
|
+
if (err.message && typeof err.message === 'string') {
|
|
159
|
+
const message = err.message;
|
|
160
|
+
return message.includes('does not have read permissions on User Roles') ||
|
|
161
|
+
message.includes("Cannot read properties of undefined (reading 'ResourceTypes')");
|
|
162
|
+
}
|
|
163
|
+
// Check for nested error object
|
|
164
|
+
if (err.error && typeof err.error === 'object') {
|
|
165
|
+
return this.isNoUserRolesError(err.error);
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
console.error('Error while checking for user roles error:', e);
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Handle authentication retry with backoff
|
|
176
|
+
* Replaces AppComponent.handleAuthRetry() logic
|
|
177
|
+
*/
|
|
178
|
+
async handleAuthRetry(error, currentPath) {
|
|
179
|
+
if (!error.shouldRetry) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
const retryKey = 'auth-retry-dt';
|
|
183
|
+
const lastRetryDateTime = localStorage.getItem(retryKey);
|
|
184
|
+
const yesterday = +new Date(Date.now() - 1 * 24 * 60 * 60 * 1000);
|
|
185
|
+
const retriedRecently = lastRetryDateTime && +new Date(lastRetryDateTime) > yesterday;
|
|
186
|
+
if (!retriedRecently && error.type === 'token_expired') {
|
|
187
|
+
LogStatus('JWT Expired, retrying once: ' + error.message);
|
|
188
|
+
localStorage.setItem(retryKey, new Date().toISOString());
|
|
189
|
+
const login$ = this.authBase.login({ appState: { target: currentPath } });
|
|
190
|
+
await lastValueFrom(login$);
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
static ɵfac = function WorkspaceInitializerService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || WorkspaceInitializerService)(i0.ɵɵinject(i1.MJAuthBase), i0.ɵɵinject(i2.StartupValidationService)); };
|
|
196
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: WorkspaceInitializerService, factory: WorkspaceInitializerService.ɵfac, providedIn: 'root' });
|
|
197
|
+
}
|
|
198
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WorkspaceInitializerService, [{
|
|
199
|
+
type: Injectable,
|
|
200
|
+
args: [{
|
|
201
|
+
providedIn: 'root'
|
|
202
|
+
}]
|
|
203
|
+
}], () => [{ type: i1.MJAuthBase }, { type: i2.StartupValidationService }], null); })();
|
|
204
|
+
//# sourceMappingURL=workspace-initializer.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-initializer.service.js","sourceRoot":"","sources":["../../../src/lib/services/workspace-initializer.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,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
static ɵfac: i0.ɵɵFactoryDeclaration<WorkspaceInitializerModule, never>;
|
|
4
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<WorkspaceInitializerModule, never, never, never>;
|
|
5
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<WorkspaceInitializerModule>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=workspace-initializer.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-initializer.module.d.ts","sourceRoot":"","sources":["../../src/lib/workspace-initializer.module.ts"],"names":[],"mappings":";AAUA,qBAKa,0BAA0B;yCAA1B,0BAA0B;0CAA1B,0BAA0B;0CAA1B,0BAA0B;CAAG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Initializer Module
|
|
3
|
+
*
|
|
4
|
+
* Provides WorkspaceInitializerService for reusable workspace initialization logic
|
|
5
|
+
* across all MemberJunction applications.
|
|
6
|
+
*/
|
|
7
|
+
import { NgModule } from '@angular/core';
|
|
8
|
+
import { WorkspaceInitializerService } from './services/workspace-initializer.service';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export class WorkspaceInitializerModule {
|
|
11
|
+
static ɵfac = function WorkspaceInitializerModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || WorkspaceInitializerModule)(); };
|
|
12
|
+
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: WorkspaceInitializerModule });
|
|
13
|
+
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
|
|
14
|
+
WorkspaceInitializerService
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WorkspaceInitializerModule, [{
|
|
18
|
+
type: NgModule,
|
|
19
|
+
args: [{
|
|
20
|
+
providers: [
|
|
21
|
+
WorkspaceInitializerService
|
|
22
|
+
]
|
|
23
|
+
}]
|
|
24
|
+
}], null, null); })();
|
|
25
|
+
//# sourceMappingURL=workspace-initializer.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-initializer.module.js","sourceRoot":"","sources":["../../src/lib/workspace-initializer.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;;AAOvF,MAAM,OAAO,0BAA0B;oHAA1B,0BAA0B;4DAA1B,0BAA0B;iEAJ1B;YACT,2BAA2B;SAC5B;;iFAEU,0BAA0B;cALtC,QAAQ;eAAC;gBACR,SAAS,EAAE;oBACT,2BAA2B;iBAC5B;aACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API Surface of @memberjunction/ng-workspace-initializer
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/models/workspace-types';
|
|
5
|
+
export * from './lib/services/workspace-initializer.service';
|
|
6
|
+
export * from './lib/workspace-initializer.module';
|
|
7
|
+
//# sourceMappingURL=public-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API Surface of @memberjunction/ng-workspace-initializer
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/models/workspace-types';
|
|
5
|
+
export * from './lib/services/workspace-initializer.service';
|
|
6
|
+
export * from './lib/workspace-initializer.module';
|
|
7
|
+
//# sourceMappingURL=public-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oCAAoC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-workspace-initializer",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "MemberJunction: Workspace Initialization Service and Components",
|
|
5
|
+
"main": "./dist/public-api.js",
|
|
6
|
+
"typings": "./dist/public-api.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
+
"build": "ngc"
|
|
13
|
+
},
|
|
5
14
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
15
|
+
"memberjunction",
|
|
16
|
+
"workspace",
|
|
17
|
+
"initialization",
|
|
18
|
+
"angular"
|
|
19
|
+
],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@angular/compiler": "18.2.14",
|
|
24
|
+
"@angular/compiler-cli": "18.2.14"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@angular/common": "18.2.14",
|
|
28
|
+
"@angular/core": "18.2.14",
|
|
29
|
+
"@angular/forms": "18.2.14",
|
|
30
|
+
"@angular/router": "18.2.14"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@memberjunction/core": "3.0.0",
|
|
34
|
+
"@memberjunction/global": "3.0.0",
|
|
35
|
+
"@memberjunction/graphql-dataprovider": "3.0.0",
|
|
36
|
+
"@memberjunction/ng-auth-services": "3.0.0",
|
|
37
|
+
"@memberjunction/ng-explorer-core": "3.0.0",
|
|
38
|
+
"@memberjunction/ng-shared": "3.0.0",
|
|
39
|
+
"@memberjunction/ng-shared-generic": "3.0.0",
|
|
40
|
+
"rxjs": "^7.8.1",
|
|
41
|
+
"tslib": "^2.3.0"
|
|
42
|
+
},
|
|
43
|
+
"sideEffects": false,
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
47
|
+
}
|
|
10
48
|
}
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @memberjunction/ng-workspace-initializer
|
|
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/ng-workspace-initializer`
|
|
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**
|