@gurulu/node 0.1.2 → 1.0.1
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/LICENSE +22 -0
- package/README.md +64 -31
- package/dist/context.d.ts +12 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/core.d.ts +60 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/errors.d.ts +32 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/identify.d.ts +9 -0
- package/dist/identify.d.ts.map +1 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +947 -28
- package/dist/middleware/express.d.ts +25 -0
- package/dist/middleware/express.d.ts.map +1 -0
- package/dist/middleware/express.js +66 -0
- package/dist/middleware/fastify.d.ts +20 -0
- package/dist/middleware/fastify.d.ts.map +1 -0
- package/dist/middleware/fastify.js +68 -0
- package/dist/middleware/next.d.ts +10 -0
- package/dist/middleware/next.d.ts.map +1 -0
- package/dist/middleware/next.js +69 -0
- package/dist/queue.d.ts +20 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/track.d.ts +10 -0
- package/dist/track.d.ts.map +1 -0
- package/dist/transport.d.ts +16 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/types.d.ts +129 -45
- package/dist/types.d.ts.map +1 -0
- package/dist/webhooks/custom.d.ts +30 -0
- package/dist/webhooks/custom.d.ts.map +1 -0
- package/dist/webhooks/custom.js +123 -0
- package/dist/webhooks/lemonsqueezy.d.ts +30 -0
- package/dist/webhooks/lemonsqueezy.d.ts.map +1 -0
- package/dist/webhooks/lemonsqueezy.js +140 -0
- package/dist/webhooks/shopify.d.ts +18 -0
- package/dist/webhooks/shopify.d.ts.map +1 -0
- package/dist/webhooks/shopify.js +142 -0
- package/dist/webhooks/stripe.d.ts +31 -0
- package/dist/webhooks/stripe.d.ts.map +1 -0
- package/dist/webhooks/stripe.js +160 -0
- package/package.json +97 -16
- package/dist/business-events.d.ts +0 -73
- package/dist/business-events.js +0 -111
- package/dist/client.d.ts +0 -150
- package/dist/client.js +0 -442
- package/dist/middleware.d.ts +0 -31
- package/dist/middleware.js +0 -138
- package/dist/types.js +0 -30
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MONAFY LTD (UK Company No. 17031485)
|
|
4
|
+
4 Raven Road, Unit 1C3-1051, London, United Kingdom, E18 1HB
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,49 +1,82 @@
|
|
|
1
1
|
# @gurulu/node
|
|
2
2
|
|
|
3
|
-
Server
|
|
3
|
+
Server SDK for [Gurulu](https://gurulu.io) — Truth Layer for product analytics.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Outcome verification, webhook ingestion, and framework middleware for Node.js / Bun.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
npm install @gurulu/node
|
|
11
|
+
# or
|
|
12
|
+
bun add @gurulu/node
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
##
|
|
15
|
+
## Quick start
|
|
12
16
|
|
|
13
|
-
```
|
|
14
|
-
import {
|
|
17
|
+
```ts
|
|
18
|
+
import { createGurulu } from '@gurulu/node';
|
|
15
19
|
|
|
16
|
-
const gurulu =
|
|
17
|
-
|
|
18
|
-
apiKey:
|
|
20
|
+
const gurulu = createGurulu({
|
|
21
|
+
workspace: 'pk_xxxxxxxxxxxx',
|
|
22
|
+
apiKey: process.env.GURULU_API_KEY,
|
|
19
23
|
});
|
|
20
24
|
|
|
21
|
-
//
|
|
22
|
-
gurulu.track('
|
|
23
|
-
|
|
25
|
+
// Server-truth event (verified outcome, not client-claimed)
|
|
26
|
+
await gurulu.track('purchase.completed', {
|
|
27
|
+
user_id: 'u_42',
|
|
28
|
+
order_id: 'o_123',
|
|
29
|
+
total: 49.99,
|
|
30
|
+
currency: 'USD',
|
|
24
31
|
});
|
|
32
|
+
```
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
34
|
+
## Framework middleware
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// Express
|
|
38
|
+
import { guruluMiddleware } from '@gurulu/node/middleware/express';
|
|
39
|
+
app.use(guruluMiddleware({ workspace: 'pk_xxx' }));
|
|
40
|
+
|
|
41
|
+
// Fastify
|
|
42
|
+
import { guruluPlugin } from '@gurulu/node/middleware/fastify';
|
|
43
|
+
fastify.register(guruluPlugin, { workspace: 'pk_xxx' });
|
|
44
|
+
|
|
45
|
+
// Next.js (Route Handler)
|
|
46
|
+
import { guruluHandler } from '@gurulu/node/middleware/next';
|
|
47
|
+
export const POST = guruluHandler({ workspace: 'pk_xxx' });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Webhook helpers
|
|
31
51
|
|
|
32
|
-
|
|
33
|
-
await gurulu.flush();
|
|
52
|
+
Signature-verified, automatically mapped to canonical events:
|
|
34
53
|
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
```ts
|
|
55
|
+
import { handleStripeWebhook } from '@gurulu/node/webhooks/stripe';
|
|
56
|
+
// Also: /webhooks/shopify, /webhooks/lemonsqueezy, /webhooks/custom
|
|
57
|
+
|
|
58
|
+
app.post('/webhooks/stripe', async (req, res) => {
|
|
59
|
+
const event = await handleStripeWebhook(req, {
|
|
60
|
+
secret: process.env.STRIPE_WEBHOOK_SECRET,
|
|
61
|
+
workspace: 'pk_xxx',
|
|
62
|
+
});
|
|
63
|
+
res.json({ ok: true });
|
|
64
|
+
});
|
|
37
65
|
```
|
|
38
66
|
|
|
39
|
-
##
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
## Features
|
|
68
|
+
|
|
69
|
+
- **Outcome verification** — browser claims `purchase_initiated`; server confirms `purchase.completed` as truth.
|
|
70
|
+
- **Webhook helpers** — Stripe, Shopify, Lemon Squeezy with signature verify + canonical event mapping.
|
|
71
|
+
- **Framework middleware** — Express 4/5, Fastify 4/5, Next.js 14/15 Route Handlers.
|
|
72
|
+
- **Type-safe** — registry-bound event types via codegen.
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
[gurulu.io/docs](https://gurulu.io/docs)
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT — see [LICENSE](./LICENSE).
|
|
81
|
+
|
|
82
|
+
Copyright © 2026 MONAFY LTD (UK Company No. 17031485).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import type { ServerContext } from './types.ts';
|
|
3
|
+
export declare const contextStorage: AsyncLocalStorage<ServerContext>;
|
|
4
|
+
/** Middleware tarafından kullanılır — callback içinde tüm async call'lar context'i görür. */
|
|
5
|
+
export declare function runWithContext<T>(ctx: ServerContext, fn: () => T): T;
|
|
6
|
+
/** Mevcut store'u getir (yoksa undefined). */
|
|
7
|
+
export declare function getContext(): ServerContext | undefined;
|
|
8
|
+
/** Merge: explicit context (track/identify call) > stored context > empty. */
|
|
9
|
+
export declare function mergeContext(explicit?: ServerContext): ServerContext;
|
|
10
|
+
/** Random UUID-ish request_id (Node 20+ crypto.randomUUID native). */
|
|
11
|
+
export declare function generateRequestId(): string;
|
|
12
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,eAAO,MAAM,cAAc,kCAAyC,CAAC;AAErE,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEpE;AAED,8CAA8C;AAC9C,wBAAgB,UAAU,IAAI,aAAa,GAAG,SAAS,CAEtD;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,aAAa,CAWpE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C"}
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ExpressMiddlewareOptions } from './middleware/express.ts';
|
|
2
|
+
import { type FastifyPluginOptions } from './middleware/fastify.ts';
|
|
3
|
+
import { createNextHandler, type NextHandlerOptions } from './middleware/next.ts';
|
|
4
|
+
import type { EventClass, FlushResult, IdentifyResult, IdentifyTraits, OutgoingEvent, ServerContext, ServerSDKConfig, TrackResult } from './types.ts';
|
|
5
|
+
import { type CreateCustomWebhookOptions, type CustomWebhookHandler } from './webhooks/custom.ts';
|
|
6
|
+
export declare class Gurulu {
|
|
7
|
+
private config;
|
|
8
|
+
private queue;
|
|
9
|
+
private sigtermBound;
|
|
10
|
+
private sigtermHandler;
|
|
11
|
+
constructor(initial?: ServerSDKConfig);
|
|
12
|
+
/** Initialize SDK. May be called once (idempotent guard). */
|
|
13
|
+
init(input: ServerSDKConfig): void;
|
|
14
|
+
private requireConfig;
|
|
15
|
+
/** Server-side identify (backend doğrulanmış user). */
|
|
16
|
+
identify(externalUserId: string, traits?: IdentifyTraits, explicitContext?: ServerContext): Promise<IdentifyResult>;
|
|
17
|
+
/** Outcome event track (queue + auto-flush). */
|
|
18
|
+
track(eventKey: string, properties?: Record<string, unknown>, explicitContext?: ServerContext, eventType?: EventClass): TrackResult;
|
|
19
|
+
/** Manual flush (force send current queue). */
|
|
20
|
+
flush(): Promise<FlushResult>;
|
|
21
|
+
/** Graceful shutdown — flush + cancel timer + max 10s timeout. */
|
|
22
|
+
shutdown(timeoutMs?: number): Promise<FlushResult>;
|
|
23
|
+
private bindSignals;
|
|
24
|
+
private unbindSignals;
|
|
25
|
+
/** Webhook helpers (lazy-bound to enqueue). */
|
|
26
|
+
get webhooks(): {
|
|
27
|
+
stripe: {
|
|
28
|
+
verify: (rawBody: string, sig: string | undefined, secret: string) => void;
|
|
29
|
+
map: (payload: import("./webhooks/stripe.ts").StripeEventPayload, options?: import("./index.ts").StripeHandleOptions) => OutgoingEvent;
|
|
30
|
+
handle: (req: import("./webhooks/stripe.ts").StripeHandleReq, secret: string, options?: import("./index.ts").StripeHandleOptions) => Promise<import("./types.ts").HandleResult>;
|
|
31
|
+
};
|
|
32
|
+
shopify: {
|
|
33
|
+
verify: typeof import("./index.ts").verifyShopify;
|
|
34
|
+
map: typeof import("./index.ts").mapShopifyEvent;
|
|
35
|
+
handle: (req: import("./webhooks/shopify.ts").ShopifyHandleReq, secret: string, options?: import("./index.ts").ShopifyHandleOptions) => Promise<import("./types.ts").HandleResult>;
|
|
36
|
+
};
|
|
37
|
+
lemonsqueezy: {
|
|
38
|
+
verify: typeof import("./index.ts").verifyLemonSqueezy;
|
|
39
|
+
map: typeof import("./index.ts").mapLemonSqueezyEvent;
|
|
40
|
+
handle: (req: import("./webhooks/lemonsqueezy.ts").LemonSqueezyHandleReq, secret: string, options?: import("./index.ts").LemonSqueezyHandleOptions) => Promise<import("./types.ts").HandleResult>;
|
|
41
|
+
};
|
|
42
|
+
custom: (options: CreateCustomWebhookOptions) => CustomWebhookHandler;
|
|
43
|
+
};
|
|
44
|
+
/** Framework integrations (middleware factories). */
|
|
45
|
+
get express(): {
|
|
46
|
+
middleware: (opts?: ExpressMiddlewareOptions) => (req: import("./middleware/express.ts").ExpressReqLike, res: import("./middleware/express.ts").ExpressResLike, next: import("./middleware/express.ts").NextFn) => void;
|
|
47
|
+
};
|
|
48
|
+
get fastify(): {
|
|
49
|
+
plugin: (opts?: FastifyPluginOptions) => (fastify: import("./middleware/fastify.ts").FastifyInstanceLike) => Promise<void>;
|
|
50
|
+
};
|
|
51
|
+
get next(): {
|
|
52
|
+
handler: typeof createNextHandler;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Convenience factory — `const gurulu = createGurulu({ workspaceKey: 'sk_...' });`. */
|
|
56
|
+
export declare function createGurulu(config: ServerSDKConfig): Gurulu;
|
|
57
|
+
export declare function getDefault(): Gurulu;
|
|
58
|
+
export declare function initDefault(config: ServerSDKConfig): Gurulu;
|
|
59
|
+
export type { ExpressMiddlewareOptions, FastifyPluginOptions, NextHandlerOptions };
|
|
60
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAIlF,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EAGb,aAAa,EACb,eAAe,EACf,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EAE1B,MAAM,sBAAsB,CAAC;AA2C9B,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,cAAc,CAA6B;gBAEvC,OAAO,CAAC,EAAE,eAAe;IAIrC,6DAA6D;IAC7D,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAOlC,OAAO,CAAC,aAAa;IAKrB,uDAAuD;IACjD,QAAQ,CACZ,cAAc,EAAE,MAAM,EACtB,MAAM,CAAC,EAAE,cAAc,EACvB,eAAe,CAAC,EAAE,aAAa,GAC9B,OAAO,CAAC,cAAc,CAAC;IAO1B,gDAAgD;IAChD,KAAK,CACH,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,eAAe,CAAC,EAAE,aAAa,EAC/B,SAAS,GAAE,UAAsB,GAChC,WAAW;IAad,+CAA+C;IACzC,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;IAKnC,kEAAkE;IAC5D,QAAQ,CAAC,SAAS,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IASxD,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,aAAa;IAUrB,+CAA+C;IAC/C,IAAI,QAAQ;;;qFA5BS,CAAC;iGAOnB,CAAC;;;;;mGAjCgB,CAAC;;;;;6GAIQ,CAAC;;0BA2DR,0BAA0B,KAAG,oBAAoB;MAGtE;IAED,qDAAqD;IACrD,IAAI,OAAO;4BACoB,wBAAwB;MACtD;IAED,IAAI,OAAO;wBACgB,oBAAoB;MAC9C;IAED,IAAI,IAAI;;MAEP;CACF;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAE5D;AAKD,wBAAgB,UAAU,IAAI,MAAM,CAGnC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAI3D;AAED,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare class GuruluSDKError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
constructor(code: string, message: string);
|
|
4
|
+
}
|
|
5
|
+
/** Init çağrılmadan track/identify. */
|
|
6
|
+
export declare class NotInitializedError extends GuruluSDKError {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
/** workspaceKey formatı yanlış (sk_ prefix yok). */
|
|
10
|
+
export declare class InvalidWorkspaceKeyError extends GuruluSDKError {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
/** Webhook signature verification fail. */
|
|
14
|
+
export declare class WebhookSignatureError extends GuruluSDKError {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
/** Vendor event'i Gurulu mapping'inde yok. */
|
|
18
|
+
export declare class WebhookMappingNotFoundError extends GuruluSDKError {
|
|
19
|
+
constructor(message: string);
|
|
20
|
+
}
|
|
21
|
+
/** Network/HTTP fail after retry exhaust. */
|
|
22
|
+
export declare class TransportError extends GuruluSDKError {
|
|
23
|
+
readonly status?: number;
|
|
24
|
+
readonly attempts: number;
|
|
25
|
+
constructor(message: string, attempts: number, status?: number);
|
|
26
|
+
}
|
|
27
|
+
/** Queue overflow — drop oldest sırasında warn için. */
|
|
28
|
+
export declare class QueueOverflowError extends GuruluSDKError {
|
|
29
|
+
readonly dropped: number;
|
|
30
|
+
constructor(dropped: number);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED,uCAAuC;AACvC,qBAAa,mBAAoB,SAAQ,cAAc;;CAItD;AAED,oDAAoD;AACpD,qBAAa,wBAAyB,SAAQ,cAAc;gBAC9C,OAAO,EAAE,MAAM;CAG5B;AAED,2CAA2C;AAC3C,qBAAa,qBAAsB,SAAQ,cAAc;gBAC3C,OAAO,EAAE,MAAM;CAG5B;AAED,8CAA8C;AAC9C,qBAAa,2BAA4B,SAAQ,cAAc;gBACjD,OAAO,EAAE,MAAM;CAG5B;AAED,6CAA6C;AAC7C,qBAAa,cAAe,SAAQ,cAAc;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBACd,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAK/D;AAED,wDAAwD;AACxD,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBACb,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IdentifyTraits, OutgoingIdentify, ResolvedConfig, ServerContext } from './types.ts';
|
|
2
|
+
export interface BuildIdentifyInput {
|
|
3
|
+
config: ResolvedConfig;
|
|
4
|
+
externalUserId: string;
|
|
5
|
+
traits?: IdentifyTraits;
|
|
6
|
+
explicitContext?: ServerContext;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildIdentify(input: BuildIdentifyInput): OutgoingIdentify;
|
|
9
|
+
//# sourceMappingURL=identify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../src/identify.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAElG,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,eAAe,CAAC,EAAE,aAAa,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,gBAAgB,CAqBzE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
export type {
|
|
9
|
-
export type {
|
|
10
|
-
export
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
|
|
1
|
+
export declare const VERSION = "0.1.0";
|
|
2
|
+
export { contextStorage, getContext, mergeContext, runWithContext } from './context.ts';
|
|
3
|
+
export { createGurulu, Gurulu, getDefault, initDefault } from './core.ts';
|
|
4
|
+
export { GuruluSDKError, InvalidWorkspaceKeyError, NotInitializedError, QueueOverflowError, TransportError, WebhookMappingNotFoundError, WebhookSignatureError, } from './errors.ts';
|
|
5
|
+
export { createExpressMiddleware, type ExpressMiddlewareOptions, } from './middleware/express.ts';
|
|
6
|
+
export { createFastifyPlugin, type FastifyPluginOptions } from './middleware/fastify.ts';
|
|
7
|
+
export { createNextHandler, type NextHandlerOptions } from './middleware/next.ts';
|
|
8
|
+
export type { EventClass, FlushResult, HandleResult, IdentifyResult, IdentifyTraits, OutgoingEvent, OutgoingIdentify, ServerConsentSnapshot, ServerContext, ServerProducer, ServerSDKConfig, TrackResult, } from './types.ts';
|
|
9
|
+
export type { CreateCustomWebhookOptions, CustomMapResult } from './webhooks/custom.ts';
|
|
10
|
+
export { LEMONSQUEEZY_DEFAULT_MAPPING, type LemonSqueezyHandleOptions, mapLemonSqueezyEvent, verifyLemonSqueezy, } from './webhooks/lemonsqueezy.ts';
|
|
11
|
+
export { mapShopifyEvent, SHOPIFY_DEFAULT_MAPPING, type ShopifyHandleOptions, verifyShopify, } from './webhooks/shopify.ts';
|
|
12
|
+
export { mapStripeEvent, STRIPE_DEFAULT_MAPPING, STRIPE_REPLAY_TOLERANCE_SECONDS, type StripeHandleOptions, verifyStripe, } from './webhooks/stripe.ts';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG1E,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAElF,YAAY,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAExF,OAAO,EACL,4BAA4B,EAC5B,KAAK,yBAAyB,EAC9B,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,+BAA+B,EAC/B,KAAK,mBAAmB,EACxB,YAAY,GACb,MAAM,sBAAsB,CAAC"}
|