@icsnpc/onepass-tools 0.0.0-stage → 1.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.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @icsnpc/onepass-tools
3
+ * Official Tools SDK for notification dispatching, anonymous verification, and scope inspection.
4
+ */
5
+ export interface OnePassToolsConfig {
6
+ baseUrl?: string;
7
+ serverToken?: string;
8
+ token?: string;
9
+ }
10
+ export interface SendNotificationPayload {
11
+ title: string;
12
+ message: string;
13
+ urgency?: 'normal' | 'critical';
14
+ user_id?: string | number;
15
+ course?: string;
16
+ target?: string;
17
+ }
18
+ export interface AnalyticsMetric {
19
+ key: string;
20
+ label: string;
21
+ value: string | number;
22
+ type?: 'currency' | 'number' | 'status' | 'percent' | 'text';
23
+ trend?: string;
24
+ alert_level?: 'normal' | 'info' | 'warning' | 'critical';
25
+ }
26
+ export interface PushAnalyticsPayload {
27
+ app_id: string;
28
+ app_name?: string;
29
+ timestamp?: string;
30
+ metrics: AnalyticsMetric[];
31
+ }
32
+ export interface PushHealthPayload {
33
+ app_id: string;
34
+ status: 'healthy' | 'online' | 'operational' | 'degraded' | 'warning' | 'offline' | 'down' | 'error';
35
+ services?: Record<string, string>;
36
+ latency_ms?: number;
37
+ timestamp?: string;
38
+ }
39
+ export declare class OnePassTools {
40
+ readonly baseUrl: string;
41
+ private readonly token;
42
+ constructor(config?: OnePassToolsConfig);
43
+ private request;
44
+ readonly tools: {
45
+ verifyAnonymous: (query: string, salt?: string) => Promise<any>;
46
+ sendNotification: (payload: SendNotificationPayload) => Promise<any>;
47
+ getScopeCatalog: () => Promise<any>;
48
+ getDirectoryApps: () => Promise<any>;
49
+ checkHealth: () => Promise<any>;
50
+ pushAnalytics: (payload: PushAnalyticsPayload) => Promise<any>;
51
+ pushHealth: (payload: PushHealthPayload) => Promise<any>;
52
+ };
53
+ }
54
+ export default OnePassTools;
55
+ //# sourceMappingURL=index.d.ts.map
@@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IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,YAAY;IACvB,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;gBAE1B,MAAM,GAAE,kBAAuB;YAK7B,OAAO;IAkBrB,SAAgB,KAAK;iCACY,MAAM,SAAQ,MAAM;oCAMjB,uBAAuB;;;;iCAe1B,oBAAoB;8BAMvB,iBAAiB;MAM7C;CACH;AAED,eAAe,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @icsnpc/onepass-tools
3
+ * Official Tools SDK for notification dispatching, anonymous verification, and scope inspection.
4
+ */
5
+ export class OnePassTools {
6
+ baseUrl;
7
+ token;
8
+ constructor(config = {}) {
9
+ this.baseUrl = (config.baseUrl || 'https://onepass-gdbe.onrender.com').replace(/\/+$/, '');
10
+ this.token = config.serverToken || config.token || null;
11
+ }
12
+ async request(endpoint, options = {}) {
13
+ const url = `${this.baseUrl}/${endpoint.replace(/^\//, '')}`;
14
+ const headers = {
15
+ 'Accept': 'application/json',
16
+ 'Content-Type': 'application/json',
17
+ ...(this.token ? { 'Authorization': `Bearer ${this.token}` } : {}),
18
+ ...(options.headers || {}),
19
+ };
20
+ const res = await fetch(url, { ...options, headers });
21
+ if (!res.ok) {
22
+ const err = await res.json().catch(() => ({ message: res.statusText }));
23
+ throw new Error(err.message || err.error || `Tools request failed with status ${res.status}`);
24
+ }
25
+ return res.json();
26
+ }
27
+ tools = {
28
+ verifyAnonymous: async (query, salt = 'onepass_anon_v1') => {
29
+ return this.request('/api/v1/tools/anonymous-verify', {
30
+ method: 'POST',
31
+ body: JSON.stringify({ query, salt }),
32
+ });
33
+ },
34
+ sendNotification: async (payload) => {
35
+ return this.request('/api/v1/notifications/send', {
36
+ method: 'POST',
37
+ body: JSON.stringify(payload),
38
+ });
39
+ },
40
+ getScopeCatalog: async () => {
41
+ return this.request('/api/scopes');
42
+ },
43
+ getDirectoryApps: async () => {
44
+ return this.request('/api/v1/directory/apps');
45
+ },
46
+ checkHealth: async () => {
47
+ return this.request('/api/health');
48
+ },
49
+ pushAnalytics: async (payload) => {
50
+ return this.request('/api/v1/admin/analytics/push', {
51
+ method: 'POST',
52
+ body: JSON.stringify(payload),
53
+ });
54
+ },
55
+ pushHealth: async (payload) => {
56
+ return this.request('/api/v1/admin/health/push', {
57
+ method: 'POST',
58
+ body: JSON.stringify(payload),
59
+ });
60
+ },
61
+ };
62
+ }
63
+ export default OnePassTools;
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyCH,MAAM,OAAO,YAAY;IACP,OAAO,CAAS;IACf,KAAK,CAAgB;IAEtC,YAAY,SAA6B,EAAE;QACzC,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,mCAAmC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC3F,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC;IAC1D,CAAC;IAEO,KAAK,CAAC,OAAO,CAAU,QAAgB,EAAE,UAAuB,EAAE;QACxE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC;QAC7D,MAAM,OAAO,GAA2B;YACtC,QAAQ,EAAE,kBAAkB;YAC5B,cAAc,EAAE,kBAAkB;YAClC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAClE,GAAG,CAAE,OAAO,CAAC,OAAkC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E,KAAK,IAAI,EAAE;YACtB,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,OAA6B,EAAE,EAAE;YACrD,OAAO,IAAI,CAAC,OAAO,CAAC,8BAA8B,EAAE;gBAClD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aAC9B,CAAC,CAAC;QACL,CAAC;QACD,UAAU,EAAE,KAAK,EAAE,OAA0B,EAAE,EAAE;YAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE;gBAC/C,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aAC9B,CAAC,CAAC;QACL,CAAC;KACF,CAAC;CACH;AAED,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "@icsnpc/onepass-tools",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Official TypeScript & JavaScript Tools SDK for anonymous participation, notification dispatch, and identity validation.",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "src",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "clean": "rm -rf dist"
23
+ },
24
+ "keywords": [
25
+ "onepass",
26
+ "ics",
27
+ "tools-sdk",
28
+ "notifications",
29
+ "anonymous-participation",
30
+ "verification"
31
+ ],
32
+ "author": "Integrated Computer Society (NPC)",
33
+ "license": "MIT"
34
+ }
package/src/index.ts ADDED
@@ -0,0 +1,110 @@
1
+ /**
2
+ * @icsnpc/onepass-tools
3
+ * Official Tools SDK for notification dispatching, anonymous verification, and scope inspection.
4
+ */
5
+
6
+ export interface OnePassToolsConfig {
7
+ baseUrl?: string;
8
+ serverToken?: string;
9
+ token?: string;
10
+ }
11
+
12
+ export interface SendNotificationPayload {
13
+ title: string;
14
+ message: string;
15
+ urgency?: 'normal' | 'critical';
16
+ user_id?: string | number;
17
+ course?: string;
18
+ target?: string;
19
+ }
20
+
21
+ export interface AnalyticsMetric {
22
+ key: string;
23
+ label: string;
24
+ value: string | number;
25
+ type?: 'currency' | 'number' | 'status' | 'percent' | 'text';
26
+ trend?: string;
27
+ alert_level?: 'normal' | 'info' | 'warning' | 'critical';
28
+ }
29
+
30
+ export interface PushAnalyticsPayload {
31
+ app_id: string;
32
+ app_name?: string;
33
+ timestamp?: string;
34
+ metrics: AnalyticsMetric[];
35
+ }
36
+
37
+ export interface PushHealthPayload {
38
+ app_id: string;
39
+ status: 'healthy' | 'online' | 'operational' | 'degraded' | 'warning' | 'offline' | 'down' | 'error';
40
+ services?: Record<string, string>;
41
+ latency_ms?: number;
42
+ timestamp?: string;
43
+ }
44
+
45
+ export class OnePassTools {
46
+ public readonly baseUrl: string;
47
+ private readonly token: string | null;
48
+
49
+ constructor(config: OnePassToolsConfig = {}) {
50
+ this.baseUrl = (config.baseUrl || 'https://onepass-gdbe.onrender.com').replace(/\/+$/, '');
51
+ this.token = config.serverToken || config.token || null;
52
+ }
53
+
54
+ private async request<T = any>(endpoint: string, options: RequestInit = {}): Promise<T> {
55
+ const url = `${this.baseUrl}/${endpoint.replace(/^\//, '')}`;
56
+ const headers: Record<string, string> = {
57
+ 'Accept': 'application/json',
58
+ 'Content-Type': 'application/json',
59
+ ...(this.token ? { 'Authorization': `Bearer ${this.token}` } : {}),
60
+ ...((options.headers as Record<string, string>) || {}),
61
+ };
62
+
63
+ const res = await fetch(url, { ...options, headers });
64
+ if (!res.ok) {
65
+ const err = await res.json().catch(() => ({ message: res.statusText }));
66
+ throw new Error(err.message || err.error || `Tools request failed with status ${res.status}`);
67
+ }
68
+
69
+ return res.json() as Promise<T>;
70
+ }
71
+
72
+ public readonly tools = {
73
+ verifyAnonymous: async (query: string, salt: string = 'onepass_anon_v1') => {
74
+ return this.request('/api/v1/tools/anonymous-verify', {
75
+ method: 'POST',
76
+ body: JSON.stringify({ query, salt }),
77
+ });
78
+ },
79
+ sendNotification: async (payload: SendNotificationPayload) => {
80
+ return this.request('/api/v1/notifications/send', {
81
+ method: 'POST',
82
+ body: JSON.stringify(payload),
83
+ });
84
+ },
85
+ getScopeCatalog: async () => {
86
+ return this.request('/api/scopes');
87
+ },
88
+ getDirectoryApps: async () => {
89
+ return this.request('/api/v1/directory/apps');
90
+ },
91
+ checkHealth: async () => {
92
+ return this.request('/api/health');
93
+ },
94
+ pushAnalytics: async (payload: PushAnalyticsPayload) => {
95
+ return this.request('/api/v1/admin/analytics/push', {
96
+ method: 'POST',
97
+ body: JSON.stringify(payload),
98
+ });
99
+ },
100
+ pushHealth: async (payload: PushHealthPayload) => {
101
+ return this.request('/api/v1/admin/health/push', {
102
+ method: 'POST',
103
+ body: JSON.stringify(payload),
104
+ });
105
+ },
106
+ };
107
+ }
108
+
109
+ export default OnePassTools;
110
+
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.