@uniforge/platform-core 0.1.0-alpha.2
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/auth/index.d.cts +184 -0
- package/dist/auth/index.d.ts +184 -0
- package/dist/auth/index.js +62 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/index.mjs +33 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/billing/index.d.cts +213 -0
- package/dist/billing/index.d.ts +213 -0
- package/dist/billing/index.js +43 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/billing/index.mjs +16 -0
- package/dist/billing/index.mjs.map +1 -0
- package/dist/graphql/index.d.cts +100 -0
- package/dist/graphql/index.d.ts +100 -0
- package/dist/graphql/index.js +19 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/graphql/index.mjs +1 -0
- package/dist/graphql/index.mjs.map +1 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -0
- package/dist/multi-store/index.d.cts +242 -0
- package/dist/multi-store/index.d.ts +242 -0
- package/dist/multi-store/index.js +53 -0
- package/dist/multi-store/index.js.map +1 -0
- package/dist/multi-store/index.mjs +23 -0
- package/dist/multi-store/index.mjs.map +1 -0
- package/dist/multi-tenant/index.d.cts +64 -0
- package/dist/multi-tenant/index.d.ts +64 -0
- package/dist/multi-tenant/index.js +19 -0
- package/dist/multi-tenant/index.js.map +1 -0
- package/dist/multi-tenant/index.mjs +1 -0
- package/dist/multi-tenant/index.mjs.map +1 -0
- package/dist/performance/index.d.cts +118 -0
- package/dist/performance/index.d.ts +118 -0
- package/dist/performance/index.js +19 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/performance/index.mjs +1 -0
- package/dist/performance/index.mjs.map +1 -0
- package/dist/platform/index.d.cts +156 -0
- package/dist/platform/index.d.ts +156 -0
- package/dist/platform/index.js +64 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/index.mjs +37 -0
- package/dist/platform/index.mjs.map +1 -0
- package/dist/rbac/index.d.cts +140 -0
- package/dist/rbac/index.d.ts +140 -0
- package/dist/rbac/index.js +55 -0
- package/dist/rbac/index.js.map +1 -0
- package/dist/rbac/index.mjs +27 -0
- package/dist/rbac/index.mjs.map +1 -0
- package/dist/registry-efvajmOd.d.cts +118 -0
- package/dist/registry-efvajmOd.d.ts +118 -0
- package/dist/security/index.d.cts +148 -0
- package/dist/security/index.d.ts +148 -0
- package/dist/security/index.js +40 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/index.mjs +13 -0
- package/dist/security/index.mjs.map +1 -0
- package/dist/types-CgnJiK8Z.d.cts +74 -0
- package/dist/types-CgnJiK8Z.d.ts +74 -0
- package/dist/webhooks/index.d.cts +114 -0
- package/dist/webhooks/index.d.ts +114 -0
- package/dist/webhooks/index.js +19 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/webhooks/index.mjs +1 -0
- package/dist/webhooks/index.mjs.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core webhook types and interfaces.
|
|
3
|
+
*
|
|
4
|
+
* Platform-agnostic types for webhook handling including
|
|
5
|
+
* payloads, handlers, and registration.
|
|
6
|
+
*/
|
|
7
|
+
/** Common Shopify webhook topics. */
|
|
8
|
+
type WebhookTopic = 'APP_UNINSTALLED' | 'APP_SUBSCRIPTIONS_UPDATE' | 'PRODUCTS_CREATE' | 'PRODUCTS_UPDATE' | 'PRODUCTS_DELETE' | 'ORDERS_CREATE' | 'ORDERS_UPDATED' | 'ORDERS_PAID' | 'ORDERS_FULFILLED' | 'CUSTOMERS_CREATE' | 'CUSTOMERS_UPDATE' | 'CUSTOMERS_DELETE' | 'SHOP_UPDATE' | string;
|
|
9
|
+
interface WebhookPayload {
|
|
10
|
+
topic: string;
|
|
11
|
+
shopDomain: string;
|
|
12
|
+
apiVersion: string;
|
|
13
|
+
payload: unknown;
|
|
14
|
+
webhookId: string;
|
|
15
|
+
timestamp: Date;
|
|
16
|
+
}
|
|
17
|
+
interface WebhookHandler {
|
|
18
|
+
handle(payload: WebhookPayload): Promise<WebhookHandlerResult>;
|
|
19
|
+
}
|
|
20
|
+
interface WebhookHandlerResult {
|
|
21
|
+
success: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
interface WebhookRegistration {
|
|
25
|
+
topic: string;
|
|
26
|
+
address: string;
|
|
27
|
+
format?: 'json' | 'xml';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Webhook HMAC validation interfaces.
|
|
32
|
+
*
|
|
33
|
+
* Defines the contract for validating incoming webhook requests
|
|
34
|
+
* using HMAC-SHA256 signatures (base64-encoded for Shopify webhooks).
|
|
35
|
+
*/
|
|
36
|
+
interface WebhookValidator {
|
|
37
|
+
validate(request: WebhookValidationRequest): boolean;
|
|
38
|
+
}
|
|
39
|
+
interface WebhookValidationRequest {
|
|
40
|
+
rawBody: Buffer;
|
|
41
|
+
hmac: string;
|
|
42
|
+
secret: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Webhook queue interfaces.
|
|
47
|
+
*
|
|
48
|
+
* Defines the contract for a Redis-backed webhook processing queue
|
|
49
|
+
* with retry support and dead letter handling.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
type WebhookJobStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'dead';
|
|
53
|
+
interface WebhookQueue {
|
|
54
|
+
enqueue(payload: WebhookPayload): Promise<string>;
|
|
55
|
+
dequeueNext(): Promise<WebhookJob | undefined>;
|
|
56
|
+
getJob(jobId: string): Promise<WebhookJob | undefined>;
|
|
57
|
+
acknowledgeJob(jobId: string, result: WebhookHandlerResult): Promise<void>;
|
|
58
|
+
requeueJob(jobId: string, error: string): Promise<void>;
|
|
59
|
+
getDeadLetterJobs(limit?: number): Promise<WebhookJob[]>;
|
|
60
|
+
}
|
|
61
|
+
interface WebhookJob {
|
|
62
|
+
id: string;
|
|
63
|
+
payload: WebhookPayload;
|
|
64
|
+
status: WebhookJobStatus;
|
|
65
|
+
attempts: number;
|
|
66
|
+
maxAttempts: number;
|
|
67
|
+
lastError?: string;
|
|
68
|
+
createdAt: Date;
|
|
69
|
+
updatedAt: Date;
|
|
70
|
+
nextRetryAt?: Date;
|
|
71
|
+
}
|
|
72
|
+
interface WebhookQueueConfig {
|
|
73
|
+
maxAttempts?: number;
|
|
74
|
+
baseRetryDelayMs?: number;
|
|
75
|
+
maxRetryDelayMs?: number;
|
|
76
|
+
keyPrefix?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* GDPR webhook types.
|
|
81
|
+
*
|
|
82
|
+
* Defines the Shopify mandatory GDPR webhook payload shapes
|
|
83
|
+
* and the handler interface for processing them.
|
|
84
|
+
*/
|
|
85
|
+
interface CustomersDataRequest {
|
|
86
|
+
shop_domain: string;
|
|
87
|
+
customer: {
|
|
88
|
+
id: number;
|
|
89
|
+
email: string;
|
|
90
|
+
phone?: string;
|
|
91
|
+
};
|
|
92
|
+
orders_requested: number[];
|
|
93
|
+
}
|
|
94
|
+
interface CustomersRedact {
|
|
95
|
+
shop_domain: string;
|
|
96
|
+
customer: {
|
|
97
|
+
id: number;
|
|
98
|
+
email: string;
|
|
99
|
+
phone?: string;
|
|
100
|
+
};
|
|
101
|
+
orders_to_redact: number[];
|
|
102
|
+
}
|
|
103
|
+
interface ShopRedact {
|
|
104
|
+
shop_domain: string;
|
|
105
|
+
shop_id: number;
|
|
106
|
+
}
|
|
107
|
+
type GdprWebhookType = 'customers/data_request' | 'customers/redact' | 'shop/redact';
|
|
108
|
+
interface GdprHandler {
|
|
109
|
+
handleDataRequest(payload: CustomersDataRequest): Promise<void>;
|
|
110
|
+
handleCustomerRedact(payload: CustomersRedact): Promise<void>;
|
|
111
|
+
handleShopRedact(payload: ShopRedact): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type { CustomersDataRequest, CustomersRedact, GdprHandler, GdprWebhookType, ShopRedact, WebhookHandler, WebhookHandlerResult, WebhookJob, WebhookJobStatus, WebhookPayload, WebhookQueue, WebhookQueueConfig, WebhookRegistration, WebhookTopic, WebhookValidationRequest, WebhookValidator };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/webhooks/index.ts
|
|
17
|
+
var webhooks_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(webhooks_exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/webhooks/index.ts"],"sourcesContent":["/**\n * @uniforge/platform-core - Webhooks\n *\n * Platform-agnostic webhook interfaces and types.\n */\n\n// Types\nexport type {\n WebhookTopic,\n WebhookPayload,\n WebhookHandler,\n WebhookHandlerResult,\n WebhookRegistration,\n} from './types';\n\n// Validation\nexport type { WebhookValidator, WebhookValidationRequest } from './validation';\n\n// Queue\nexport type {\n WebhookJobStatus,\n WebhookQueue,\n WebhookJob,\n WebhookQueueConfig,\n} from './queue';\n\n// GDPR\nexport type {\n CustomersDataRequest,\n CustomersRedact,\n ShopRedact,\n GdprWebhookType,\n GdprHandler,\n} from './gdpr';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uniforge/platform-core",
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
|
+
"description": "Platform abstraction interfaces for e-commerce platform integrations",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./auth": {
|
|
15
|
+
"types": "./dist/auth/index.d.ts",
|
|
16
|
+
"import": "./dist/auth/index.mjs",
|
|
17
|
+
"require": "./dist/auth/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./multi-tenant": {
|
|
20
|
+
"types": "./dist/multi-tenant/index.d.ts",
|
|
21
|
+
"import": "./dist/multi-tenant/index.mjs",
|
|
22
|
+
"require": "./dist/multi-tenant/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./graphql": {
|
|
25
|
+
"types": "./dist/graphql/index.d.ts",
|
|
26
|
+
"import": "./dist/graphql/index.mjs",
|
|
27
|
+
"require": "./dist/graphql/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./webhooks": {
|
|
30
|
+
"types": "./dist/webhooks/index.d.ts",
|
|
31
|
+
"import": "./dist/webhooks/index.mjs",
|
|
32
|
+
"require": "./dist/webhooks/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./multi-store": {
|
|
35
|
+
"types": "./dist/multi-store/index.d.ts",
|
|
36
|
+
"import": "./dist/multi-store/index.mjs",
|
|
37
|
+
"require": "./dist/multi-store/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./rbac": {
|
|
40
|
+
"types": "./dist/rbac/index.d.ts",
|
|
41
|
+
"import": "./dist/rbac/index.mjs",
|
|
42
|
+
"require": "./dist/rbac/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./billing": {
|
|
45
|
+
"types": "./dist/billing/index.d.ts",
|
|
46
|
+
"import": "./dist/billing/index.mjs",
|
|
47
|
+
"require": "./dist/billing/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./platform": {
|
|
50
|
+
"types": "./dist/platform/index.d.ts",
|
|
51
|
+
"import": "./dist/platform/index.mjs",
|
|
52
|
+
"require": "./dist/platform/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./security": {
|
|
55
|
+
"types": "./dist/security/index.d.ts",
|
|
56
|
+
"import": "./dist/security/index.mjs",
|
|
57
|
+
"require": "./dist/security/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./performance": {
|
|
60
|
+
"types": "./dist/performance/index.d.ts",
|
|
61
|
+
"import": "./dist/performance/index.mjs",
|
|
62
|
+
"require": "./dist/performance/index.js"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"files": [
|
|
66
|
+
"dist"
|
|
67
|
+
],
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"tsup": "^8.3.0",
|
|
70
|
+
"vitest": "^2.1.0"
|
|
71
|
+
},
|
|
72
|
+
"keywords": [
|
|
73
|
+
"uniforge",
|
|
74
|
+
"platform",
|
|
75
|
+
"e-commerce",
|
|
76
|
+
"shopify"
|
|
77
|
+
],
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"access": "public"
|
|
81
|
+
},
|
|
82
|
+
"repository": {
|
|
83
|
+
"type": "git",
|
|
84
|
+
"url": "https://github.com/uniprocessing/uniforge.git",
|
|
85
|
+
"directory": "packages/platform-core"
|
|
86
|
+
},
|
|
87
|
+
"scripts": {
|
|
88
|
+
"build": "tsup",
|
|
89
|
+
"dev": "tsup --watch",
|
|
90
|
+
"test": "vitest",
|
|
91
|
+
"lint": "eslint src/",
|
|
92
|
+
"typecheck": "tsc --noEmit"
|
|
93
|
+
}
|
|
94
|
+
}
|