@perkamo/sdk-core 0.1.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/CHANGELOG.md +19 -0
- package/README.md +39 -0
- package/dist/index.d.ts +132 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 - 2026-06-02
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Initial public SDK core package for shared Perkamo event and profile types.
|
|
8
|
+
- Added `PerkamoApiError`, event ingest response types, batch response types,
|
|
9
|
+
wallet delta types, profile state types, identify response types and reward
|
|
10
|
+
redemption response types.
|
|
11
|
+
- Added `canonicalJson` for stable JSON serialization of SDK payload facts.
|
|
12
|
+
- Added `createTransactionId` for secure transaction ID generation.
|
|
13
|
+
- Added `assertSafeEventInput` to validate required event fields and reject
|
|
14
|
+
reserved context keys that Perkamo computes server-side.
|
|
15
|
+
|
|
16
|
+
### Security
|
|
17
|
+
|
|
18
|
+
- Rejects client-authored computed fields such as `xp`, `wallet`, `wallets`,
|
|
19
|
+
`rewards`, `level`, `perks` and `achievements` in event context.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# `@perkamo/sdk-core`
|
|
2
|
+
|
|
3
|
+
Runtime-independent event types, response types, and helpers for Perkamo SDKs.
|
|
4
|
+
|
|
5
|
+
See the full customer developer guide in
|
|
6
|
+
[`../../docs/sdk-api.md`](../../docs/sdk-api.md).
|
|
7
|
+
|
|
8
|
+
## Exports
|
|
9
|
+
|
|
10
|
+
### Types
|
|
11
|
+
|
|
12
|
+
- `PerkamoContextValue` / `PerkamoEventContext` / `PerkamoEventInput`
|
|
13
|
+
- `EventIngestResponse` / `BatchIngestResponse`
|
|
14
|
+
- `PerkamoProfile` / `PerkamoLevel` / `PerkamoUnlockedPerk` / `PerkamoProfileFlags`
|
|
15
|
+
- `IdentifyResponse` / `RedeemRewardResponse`
|
|
16
|
+
- `PerkamoApiError` — error class with `status: number` and `body: unknown`
|
|
17
|
+
|
|
18
|
+
### Helpers
|
|
19
|
+
|
|
20
|
+
- `assertSafeEventInput(input)` — validates fields and rejects server-authoritative context keys
|
|
21
|
+
- `createTransactionId(prefix?)` — generates a `tx_<uuid>` idempotency key
|
|
22
|
+
- `canonicalJson(value)` — deterministic JSON for comparison and logging
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { assertSafeEventInput, createTransactionId } from "@perkamo/sdk-core";
|
|
28
|
+
|
|
29
|
+
const input = {
|
|
30
|
+
tenant: "commerce-test",
|
|
31
|
+
user_id: "customer_123",
|
|
32
|
+
event: "purchase.completed",
|
|
33
|
+
transaction_id: createTransactionId(),
|
|
34
|
+
context: { order_id: "order_1092" },
|
|
35
|
+
occurred_at: new Date().toISOString(),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
assertSafeEventInput(input);
|
|
39
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export type PerkamoContextValue = string | number | boolean | null | PerkamoContextValue[] | {
|
|
2
|
+
[key: string]: PerkamoContextValue;
|
|
3
|
+
};
|
|
4
|
+
export type PerkamoEventContext = Record<string, PerkamoContextValue>;
|
|
5
|
+
export type PerkamoEventInput = {
|
|
6
|
+
tenant: string;
|
|
7
|
+
user_id: string;
|
|
8
|
+
event: string;
|
|
9
|
+
transaction_id: string;
|
|
10
|
+
context?: PerkamoEventContext;
|
|
11
|
+
occurred_at?: string;
|
|
12
|
+
};
|
|
13
|
+
export type WalletDelta = {
|
|
14
|
+
wallet: string;
|
|
15
|
+
amount: number;
|
|
16
|
+
};
|
|
17
|
+
export type PerkamoLevel = {
|
|
18
|
+
wallet: string;
|
|
19
|
+
level: number;
|
|
20
|
+
current: number;
|
|
21
|
+
currentLevelAt: number;
|
|
22
|
+
nextLevelAt: number | null;
|
|
23
|
+
progress: number;
|
|
24
|
+
};
|
|
25
|
+
export type PerkamoLevelProgress = {
|
|
26
|
+
point_name: string;
|
|
27
|
+
into_level: number;
|
|
28
|
+
to_next: number;
|
|
29
|
+
ratio: number;
|
|
30
|
+
current_level_floor: number;
|
|
31
|
+
next_level_at: number | null;
|
|
32
|
+
};
|
|
33
|
+
export type PerkamoUnlocked = {
|
|
34
|
+
type: string;
|
|
35
|
+
key: string;
|
|
36
|
+
name: string;
|
|
37
|
+
};
|
|
38
|
+
export type EventIngestResponse = {
|
|
39
|
+
applied: boolean;
|
|
40
|
+
duplicate: boolean;
|
|
41
|
+
delta: WalletDelta[];
|
|
42
|
+
leveled_up: boolean;
|
|
43
|
+
unlocked: PerkamoUnlocked[];
|
|
44
|
+
wallet_state: Record<string, number>;
|
|
45
|
+
level: PerkamoLevel | null;
|
|
46
|
+
};
|
|
47
|
+
export type BatchIngestResponse = {
|
|
48
|
+
results: EventIngestResponse[];
|
|
49
|
+
};
|
|
50
|
+
export type PerkamoUnlockedPerk = {
|
|
51
|
+
key: string;
|
|
52
|
+
unlocked_at: string;
|
|
53
|
+
metadata: Record<string, unknown>;
|
|
54
|
+
};
|
|
55
|
+
export type PerkamoNextPerk = {
|
|
56
|
+
key: string;
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
trigger?: Record<string, unknown>;
|
|
60
|
+
card?: {
|
|
61
|
+
title: string;
|
|
62
|
+
description: string;
|
|
63
|
+
animation: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export type PerkamoAchievements = {
|
|
67
|
+
completed: Array<{
|
|
68
|
+
key: string;
|
|
69
|
+
name: string;
|
|
70
|
+
}>;
|
|
71
|
+
in_progress: Array<{
|
|
72
|
+
key: string;
|
|
73
|
+
name: string;
|
|
74
|
+
current: number;
|
|
75
|
+
target: number;
|
|
76
|
+
}>;
|
|
77
|
+
unlocked: Array<{
|
|
78
|
+
key: string;
|
|
79
|
+
cycle: number;
|
|
80
|
+
}>;
|
|
81
|
+
};
|
|
82
|
+
export type PerkamoProfileFlags = {
|
|
83
|
+
levels: Record<string, boolean>;
|
|
84
|
+
has_level_at_least: Record<string, boolean>;
|
|
85
|
+
perks: Record<string, boolean>;
|
|
86
|
+
};
|
|
87
|
+
export type PerkamoProfile = {
|
|
88
|
+
user_id: string;
|
|
89
|
+
traits?: Record<string, unknown>;
|
|
90
|
+
wallets: Record<string, number>;
|
|
91
|
+
level: PerkamoLevel;
|
|
92
|
+
progress?: PerkamoLevelProgress;
|
|
93
|
+
perks: PerkamoUnlockedPerk[];
|
|
94
|
+
next_perks: PerkamoNextPerk[];
|
|
95
|
+
achievements: PerkamoAchievements;
|
|
96
|
+
flags: PerkamoProfileFlags;
|
|
97
|
+
};
|
|
98
|
+
export type IdentifyResponse = {
|
|
99
|
+
identified: boolean;
|
|
100
|
+
user_id: string;
|
|
101
|
+
registration_event: EventIngestResponse | null;
|
|
102
|
+
profile: {
|
|
103
|
+
tenant: string;
|
|
104
|
+
user_id: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export type RedeemRewardResponse = {
|
|
108
|
+
redeemed: boolean;
|
|
109
|
+
duplicate: boolean;
|
|
110
|
+
reward: {
|
|
111
|
+
key: string;
|
|
112
|
+
name: string;
|
|
113
|
+
description: string;
|
|
114
|
+
cost: {
|
|
115
|
+
wallet: string;
|
|
116
|
+
amount: number;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
delta: WalletDelta[];
|
|
120
|
+
effect: Record<string, unknown>;
|
|
121
|
+
wallet_state: Record<string, number>;
|
|
122
|
+
level: PerkamoLevel | null;
|
|
123
|
+
};
|
|
124
|
+
export declare class PerkamoApiError extends Error {
|
|
125
|
+
readonly status: number;
|
|
126
|
+
readonly body: unknown;
|
|
127
|
+
constructor(status: number, body: unknown);
|
|
128
|
+
}
|
|
129
|
+
export declare function canonicalJson(value: PerkamoContextValue): string;
|
|
130
|
+
export declare function createTransactionId(prefix?: string): string;
|
|
131
|
+
export declare function assertSafeEventInput(input: PerkamoEventInput): void;
|
|
132
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,mBAAmB,EAAE,GACrB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAA;CAAE,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAIF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC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AAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1C,CAAC;IACF,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;CAC5B,CAAC;AAIF,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAU1C;AAkBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAYhE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,SAAO,GAAG,MAAM,CAKzD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CA6BnE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// ─── Error ───────────────────────────────────────────────────────────────────
|
|
2
|
+
export class PerkamoApiError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(status, body) {
|
|
6
|
+
const message = body != null && typeof body === "object" && "message" in body
|
|
7
|
+
? String(body.message)
|
|
8
|
+
: `HTTP ${status}`;
|
|
9
|
+
super(`Perkamo API error: ${message}`);
|
|
10
|
+
this.name = "PerkamoApiError";
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.body = body;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
// ─── Signing helpers ─────────────────────────────────────────────────────────
|
|
16
|
+
const reservedContextKeys = new Set([
|
|
17
|
+
"xp",
|
|
18
|
+
"wallet",
|
|
19
|
+
"wallets",
|
|
20
|
+
"rewards",
|
|
21
|
+
"level",
|
|
22
|
+
"perks",
|
|
23
|
+
"achievements",
|
|
24
|
+
]);
|
|
25
|
+
function stableEntries(value) {
|
|
26
|
+
return Object.entries(value).sort(([left], [right]) => left.localeCompare(right));
|
|
27
|
+
}
|
|
28
|
+
export function canonicalJson(value) {
|
|
29
|
+
if (value === null || typeof value !== "object") {
|
|
30
|
+
return JSON.stringify(value);
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
return `[${value.map((item) => canonicalJson(item)).join(",")}]`;
|
|
34
|
+
}
|
|
35
|
+
return `{${stableEntries(value)
|
|
36
|
+
.map(([key, item]) => `${JSON.stringify(key)}:${canonicalJson(item)}`)
|
|
37
|
+
.join(",")}}`;
|
|
38
|
+
}
|
|
39
|
+
export function createTransactionId(prefix = "tx") {
|
|
40
|
+
if (!globalThis.crypto?.randomUUID) {
|
|
41
|
+
throw new Error("Secure randomUUID support is required to create transaction IDs");
|
|
42
|
+
}
|
|
43
|
+
return `${prefix}_${globalThis.crypto.randomUUID()}`;
|
|
44
|
+
}
|
|
45
|
+
export function assertSafeEventInput(input) {
|
|
46
|
+
const required = [
|
|
47
|
+
["tenant", input.tenant, 128],
|
|
48
|
+
["user_id", input.user_id, 256],
|
|
49
|
+
["event", input.event, 128],
|
|
50
|
+
["transaction_id", input.transaction_id, 256],
|
|
51
|
+
];
|
|
52
|
+
for (const [field, value, maxLen] of required) {
|
|
53
|
+
if (!value || typeof value !== "string") {
|
|
54
|
+
throw new Error(`Perkamo event field '${field}' is required and must be a string`);
|
|
55
|
+
}
|
|
56
|
+
if (value.length > maxLen) {
|
|
57
|
+
throw new Error(`Perkamo event field '${field}' exceeds max length of ${maxLen} characters`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const key of Object.keys(input.context ?? {})) {
|
|
61
|
+
if (reservedContextKeys.has(key.toLowerCase())) {
|
|
62
|
+
throw new Error(`Refusing to send reserved Perkamo context field '${key}' from the SDK — ` +
|
|
63
|
+
`Perkamo computes this value server-side from your rules`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4HA,gFAAgF;AAEhF,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,MAAM,CAAS;IACf,IAAI,CAAU;IAEvB,YAAY,MAAc,EAAE,IAAa;QACvC,MAAM,OAAO,GACX,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,SAAS,IAAI,IAAI;YAC3D,CAAC,CAAC,MAAM,CAAE,IAAgC,CAAC,OAAO,CAAC;YACnD,CAAC,CAAC,QAAQ,MAAM,EAAE,CAAC;QACvB,KAAK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,gFAAgF;AAEhF,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,IAAI;IACJ,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OAAO;IACP,OAAO;IACP,cAAc;CACf,CAAC,CAAC;AAEH,SAAS,aAAa,CAAC,KAA0C;IAC/D,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAA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AE,GAAG,CAAC;KAC9C,CAAC;IAEF,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC9C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CACb,wBAAwB,KAAK,oCAAoC,CAClE,CAAC;QACJ,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,wBAAwB,KAAK,2BAA2B,MAAM,aAAa,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QACnD,IAAI,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CACb,oDAAoD,GAAG,mBAAmB;gBACxE,yDAAyD,CAC5D,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@perkamo/sdk-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Runtime-independent types and security helpers for Perkamo SDKs.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"CHANGELOG.md"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc -p tsconfig.json",
|
|
29
|
+
"test": "vitest run src",
|
|
30
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
31
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
32
|
+
"format": "prettier --write src",
|
|
33
|
+
"format:check": "prettier --check src"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"vitest": "4.1.7"
|
|
37
|
+
}
|
|
38
|
+
}
|