@01.software/sdk 0.20.0 → 0.22.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@01.software/sdk",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "01.software SDK",
5
5
  "author": "<office@01.works>",
6
6
  "keywords": [],
@@ -19,6 +19,16 @@
19
19
  "default": "./dist/index.cjs"
20
20
  }
21
21
  },
22
+ "./server": {
23
+ "import": {
24
+ "types": "./dist/server.d.ts",
25
+ "default": "./dist/server.js"
26
+ },
27
+ "require": {
28
+ "types": "./dist/server.d.cts",
29
+ "default": "./dist/server.cjs"
30
+ }
31
+ },
22
32
  "./analytics": {
23
33
  "import": {
24
34
  "types": "./dist/analytics.d.ts",
@@ -148,8 +158,8 @@
148
158
  "shadcn": "^3.6.3",
149
159
  "tsup": "^8.3.7",
150
160
  "vitest": "^3.2.3",
151
- "@repo/typescript-config": "0.0.0",
152
- "@repo/eslint-config": "0.0.0"
161
+ "@repo/eslint-config": "0.0.0",
162
+ "@repo/typescript-config": "0.0.0"
153
163
  },
154
164
  "dependencies": {
155
165
  "@payloadcms/richtext-lexical": ">=3.82.0",
@@ -160,8 +170,7 @@
160
170
  "qs-esm": "^7.0.2",
161
171
  "quickjs-emscripten": "0.29.2",
162
172
  "shiki": "^4.0.1",
163
- "sucrase": "^3.35.1",
164
- "@01.software/contracts": "0.1.0"
173
+ "sucrase": "^3.35.1"
165
174
  },
166
175
  "peerDependencies": {
167
176
  "@mux/mux-player-react": ">=3",
@@ -188,7 +197,8 @@
188
197
  "lint": "eslint ./src",
189
198
  "test": "vitest run",
190
199
  "test:react": "vitest run --config vitest.config.react.ts",
191
- "test:all": "vitest run && vitest run --config vitest.config.react.ts",
200
+ "test:types": "tsc --noEmit -p tsconfig.type-tests.json",
201
+ "test:all": "vitest run && vitest run --config vitest.config.react.ts && pnpm run test:types",
192
202
  "test:watch": "vitest --watch",
193
203
  "test:publish": "publint --strict && attw --pack --ignore-rules no-resolution",
194
204
  "check-types": "tsc --noEmit",
@@ -1,61 +0,0 @@
1
- import { C as Collection } from './const-BApEF1Hu.cjs';
2
- import { l as CustomerProfile, h as Post, m as Comment, n as Reaction, C as Config } from './payload-types-D7lnu9By.cjs';
3
-
4
- type PublicCustomerProfile = Omit<CustomerProfile, 'tenant' | 'customer' | 'isPublic' | 'anonymizedAt' | 'metadata'>;
5
- type PublicProfileRelation = string | PublicCustomerProfile;
6
- type PublicPost = Omit<Post, 'authorProfile' | 'lastCommentByProfile'> & {
7
- authorProfile: PublicProfileRelation;
8
- lastCommentByProfile?: PublicProfileRelation | null;
9
- };
10
- type PublicComment = Omit<Comment, 'authorProfile'> & {
11
- authorProfile: PublicProfileRelation;
12
- };
13
- type PublicReaction = Omit<Reaction, 'actorProfile'> & {
14
- actorProfile: PublicProfileRelation;
15
- };
16
- type PublicCollectionOverrides = {
17
- 'customer-profiles': PublicCustomerProfile;
18
- posts: PublicPost;
19
- comments: PublicComment;
20
- reactions: PublicReaction;
21
- };
22
- type CollectionType<T extends string> = T extends keyof PublicCollectionOverrides ? PublicCollectionOverrides[T] : T extends keyof Config['collections'] ? Config['collections'][T] : never;
23
-
24
- type WebhookOperation = string;
25
- interface WebhookEvent<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>> {
26
- collection: T;
27
- operation: WebhookOperation;
28
- data: TData;
29
- timestamp?: string;
30
- deliveryId?: string;
31
- }
32
- type WebhookHandler<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>> = (event: WebhookEvent<T, TData>) => Promise<void> | void;
33
- interface WebhookOptions {
34
- secret?: string;
35
- /** Max accepted skew for signed webhook delivery timestamps. Default: 300s. */
36
- toleranceSeconds?: number;
37
- }
38
- declare function isValidWebhookEvent(data: unknown): data is WebhookEvent;
39
- declare const CUSTOMER_PASSWORD_RESET_OPERATION: "password-reset";
40
- interface CustomerPasswordResetWebhookData {
41
- customerId: string | number;
42
- email: string;
43
- name: string;
44
- resetPasswordToken: string;
45
- resetPasswordExpiresAt: string;
46
- }
47
- type CustomerPasswordResetWebhookEvent = WebhookEvent<'customers', CustomerPasswordResetWebhookData> & {
48
- operation: typeof CUSTOMER_PASSWORD_RESET_OPERATION;
49
- };
50
- type CustomerAuthWebhookEvent = CustomerPasswordResetWebhookEvent;
51
- type MaybePromise<T> = T | Promise<T>;
52
- interface CustomerAuthWebhookHandlers {
53
- passwordReset?: (data: CustomerPasswordResetWebhookData, event: CustomerPasswordResetWebhookEvent) => MaybePromise<void>;
54
- unhandled?: (event: WebhookEvent<string, unknown>) => MaybePromise<void>;
55
- }
56
- declare function isCustomerPasswordResetWebhookEvent(event: WebhookEvent<string, unknown>): event is CustomerPasswordResetWebhookEvent;
57
- declare function createCustomerAuthWebhookHandler(handlers: CustomerAuthWebhookHandlers): WebhookHandler<string, unknown>;
58
- declare function handleWebhook<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>>(request: Request, handler: WebhookHandler<T, TData>, options?: WebhookOptions): Promise<Response>;
59
- declare function createTypedWebhookHandler<T extends Collection>(collection: T, handler: (event: WebhookEvent<T>) => Promise<void> | void): WebhookHandler<T>;
60
-
61
- export { type CollectionType as C, type WebhookOperation as W, type WebhookEvent as a, type WebhookHandler as b, type WebhookOptions as c, CUSTOMER_PASSWORD_RESET_OPERATION as d, type CustomerPasswordResetWebhookData as e, type CustomerPasswordResetWebhookEvent as f, type CustomerAuthWebhookEvent as g, type CustomerAuthWebhookHandlers as h, isValidWebhookEvent as i, isCustomerPasswordResetWebhookEvent as j, createCustomerAuthWebhookHandler as k, handleWebhook as l, createTypedWebhookHandler as m };
@@ -1,61 +0,0 @@
1
- import { C as Collection } from './const-BNJRuk3V.js';
2
- import { l as CustomerProfile, h as Post, m as Comment, n as Reaction, C as Config } from './payload-types-D7lnu9By.js';
3
-
4
- type PublicCustomerProfile = Omit<CustomerProfile, 'tenant' | 'customer' | 'isPublic' | 'anonymizedAt' | 'metadata'>;
5
- type PublicProfileRelation = string | PublicCustomerProfile;
6
- type PublicPost = Omit<Post, 'authorProfile' | 'lastCommentByProfile'> & {
7
- authorProfile: PublicProfileRelation;
8
- lastCommentByProfile?: PublicProfileRelation | null;
9
- };
10
- type PublicComment = Omit<Comment, 'authorProfile'> & {
11
- authorProfile: PublicProfileRelation;
12
- };
13
- type PublicReaction = Omit<Reaction, 'actorProfile'> & {
14
- actorProfile: PublicProfileRelation;
15
- };
16
- type PublicCollectionOverrides = {
17
- 'customer-profiles': PublicCustomerProfile;
18
- posts: PublicPost;
19
- comments: PublicComment;
20
- reactions: PublicReaction;
21
- };
22
- type CollectionType<T extends string> = T extends keyof PublicCollectionOverrides ? PublicCollectionOverrides[T] : T extends keyof Config['collections'] ? Config['collections'][T] : never;
23
-
24
- type WebhookOperation = string;
25
- interface WebhookEvent<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>> {
26
- collection: T;
27
- operation: WebhookOperation;
28
- data: TData;
29
- timestamp?: string;
30
- deliveryId?: string;
31
- }
32
- type WebhookHandler<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>> = (event: WebhookEvent<T, TData>) => Promise<void> | void;
33
- interface WebhookOptions {
34
- secret?: string;
35
- /** Max accepted skew for signed webhook delivery timestamps. Default: 300s. */
36
- toleranceSeconds?: number;
37
- }
38
- declare function isValidWebhookEvent(data: unknown): data is WebhookEvent;
39
- declare const CUSTOMER_PASSWORD_RESET_OPERATION: "password-reset";
40
- interface CustomerPasswordResetWebhookData {
41
- customerId: string | number;
42
- email: string;
43
- name: string;
44
- resetPasswordToken: string;
45
- resetPasswordExpiresAt: string;
46
- }
47
- type CustomerPasswordResetWebhookEvent = WebhookEvent<'customers', CustomerPasswordResetWebhookData> & {
48
- operation: typeof CUSTOMER_PASSWORD_RESET_OPERATION;
49
- };
50
- type CustomerAuthWebhookEvent = CustomerPasswordResetWebhookEvent;
51
- type MaybePromise<T> = T | Promise<T>;
52
- interface CustomerAuthWebhookHandlers {
53
- passwordReset?: (data: CustomerPasswordResetWebhookData, event: CustomerPasswordResetWebhookEvent) => MaybePromise<void>;
54
- unhandled?: (event: WebhookEvent<string, unknown>) => MaybePromise<void>;
55
- }
56
- declare function isCustomerPasswordResetWebhookEvent(event: WebhookEvent<string, unknown>): event is CustomerPasswordResetWebhookEvent;
57
- declare function createCustomerAuthWebhookHandler(handlers: CustomerAuthWebhookHandlers): WebhookHandler<string, unknown>;
58
- declare function handleWebhook<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>>(request: Request, handler: WebhookHandler<T, TData>, options?: WebhookOptions): Promise<Response>;
59
- declare function createTypedWebhookHandler<T extends Collection>(collection: T, handler: (event: WebhookEvent<T>) => Promise<void> | void): WebhookHandler<T>;
60
-
61
- export { type CollectionType as C, type WebhookOperation as W, type WebhookEvent as a, type WebhookHandler as b, type WebhookOptions as c, CUSTOMER_PASSWORD_RESET_OPERATION as d, type CustomerPasswordResetWebhookData as e, type CustomerPasswordResetWebhookEvent as f, type CustomerAuthWebhookEvent as g, type CustomerAuthWebhookHandlers as h, isValidWebhookEvent as i, isCustomerPasswordResetWebhookEvent as j, createCustomerAuthWebhookHandler as k, handleWebhook as l, createTypedWebhookHandler as m };