@instantdb/platform 1.0.30 → 1.0.31
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/.turbo/turbo-build.log +9 -9
- package/dist/commonjs/api.d.ts +15 -1
- package/dist/commonjs/api.d.ts.map +1 -1
- package/dist/commonjs/api.js +20 -0
- package/dist/commonjs/api.js.map +1 -1
- package/dist/commonjs/index.d.ts +2 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +4 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/api.d.ts +15 -1
- package/dist/esm/api.d.ts.map +1 -1
- package/dist/esm/api.js +20 -0
- package/dist/esm/api.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/standalone/index.js +2335 -1682
- package/dist/standalone/index.umd.cjs +22 -22
- package/package.json +4 -3
- package/src/api.ts +28 -0
- package/src/index.ts +40 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantdb/platform",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"description": "Instant's platform package for managing Instant apps.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/platform",
|
|
@@ -55,8 +55,9 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@babel/parser": "^8.0.0-beta.0",
|
|
57
57
|
"@babel/types": "^8.0.0-beta.0",
|
|
58
|
-
"@instantdb/core": "1.0.
|
|
59
|
-
"@instantdb/version": "1.0.
|
|
58
|
+
"@instantdb/core": "1.0.31",
|
|
59
|
+
"@instantdb/version": "1.0.31",
|
|
60
|
+
"@instantdb/webhooks": "1.0.31"
|
|
60
61
|
},
|
|
61
62
|
"scripts": {
|
|
62
63
|
"test": "vitest",
|
package/src/api.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
version as coreVersion,
|
|
4
4
|
InstantRules,
|
|
5
5
|
InstantSchemaDef,
|
|
6
|
+
InstantUnknownSchema,
|
|
6
7
|
EntitiesDef,
|
|
7
8
|
LinksDef,
|
|
8
9
|
RoomsDef,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
InstantDBInferredType,
|
|
14
15
|
DataAttrDef,
|
|
15
16
|
} from '@instantdb/core';
|
|
17
|
+
import { Webhooks, type WithAuth } from '@instantdb/webhooks';
|
|
16
18
|
import version from './version.ts';
|
|
17
19
|
import {
|
|
18
20
|
attrFwdLabel,
|
|
@@ -1850,4 +1852,30 @@ export class PlatformApi {
|
|
|
1850
1852
|
}
|
|
1851
1853
|
return this.withRetry(tokenInfo, [this.#apiURI, this.token()]);
|
|
1852
1854
|
}
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* Returns a {@link Webhooks} instance scoped to `appId`. You don't need
|
|
1858
|
+
* auth on this PlatformApi to verify signatures or process incoming
|
|
1859
|
+
* deliveries — only `webhooks(appId).manager.*` requires it, and those
|
|
1860
|
+
* calls are routed through {@link withRetry}, so an expired access token
|
|
1861
|
+
* is transparently refreshed.
|
|
1862
|
+
*
|
|
1863
|
+
* Pass `schema` (e.g. from {@link apiSchemaToInstantSchemaDef}) for typed
|
|
1864
|
+
* handler records and typed `etypes` on `manager.create`/`update`.
|
|
1865
|
+
*/
|
|
1866
|
+
webhooks<
|
|
1867
|
+
Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,
|
|
1868
|
+
>(appId: string, opts?: { schema?: Schema }): Webhooks<Schema> {
|
|
1869
|
+
const withAuth: WithAuth = (operation) =>
|
|
1870
|
+
this.withRetry(
|
|
1871
|
+
(_apiURI: string, token: string) => operation(token),
|
|
1872
|
+
[this.#apiURI, this.token()],
|
|
1873
|
+
);
|
|
1874
|
+
return new Webhooks<Schema>({
|
|
1875
|
+
appId,
|
|
1876
|
+
apiURI: this.#apiURI,
|
|
1877
|
+
schema: opts?.schema,
|
|
1878
|
+
withAuth,
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1853
1881
|
}
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,27 @@ import { ProgressPromise } from './ProgressPromise.ts';
|
|
|
27
27
|
import { i, type InstantRules } from '@instantdb/core';
|
|
28
28
|
import { exchangeCodeForToken, exchangeRefreshToken } from './serverOAuth.ts';
|
|
29
29
|
import { clerkDomainFromPublishableKey } from './clerk.ts';
|
|
30
|
+
import {
|
|
31
|
+
Webhooks,
|
|
32
|
+
type WebhookAction,
|
|
33
|
+
type WebhookStatus,
|
|
34
|
+
type WebhookEventStatus,
|
|
35
|
+
type WebhookInfo,
|
|
36
|
+
type WebhookAttempt,
|
|
37
|
+
type WebhookEventInfo,
|
|
38
|
+
type WebhookEventsPage,
|
|
39
|
+
type WebhookBody,
|
|
40
|
+
type WebhookEntity,
|
|
41
|
+
type WebhookPayload,
|
|
42
|
+
type WebhookPayloadRecord,
|
|
43
|
+
type WebhookPayloadRecordFor,
|
|
44
|
+
type WebhookHandlerFn,
|
|
45
|
+
type WebhookHandlers,
|
|
46
|
+
type WebhookHelpers,
|
|
47
|
+
type CreateWebhookParams,
|
|
48
|
+
type UpdateWebhookParams,
|
|
49
|
+
WebhooksManager,
|
|
50
|
+
} from '@instantdb/webhooks';
|
|
30
51
|
|
|
31
52
|
export {
|
|
32
53
|
type InstantAPIPlatformSchema,
|
|
@@ -52,6 +73,25 @@ export {
|
|
|
52
73
|
exchangeRefreshToken,
|
|
53
74
|
clerkDomainFromPublishableKey,
|
|
54
75
|
i,
|
|
76
|
+
Webhooks,
|
|
77
|
+
WebhooksManager,
|
|
78
|
+
type WebhookAction,
|
|
79
|
+
type WebhookStatus,
|
|
80
|
+
type WebhookEventStatus,
|
|
81
|
+
type WebhookInfo,
|
|
82
|
+
type WebhookAttempt,
|
|
83
|
+
type WebhookEventInfo,
|
|
84
|
+
type WebhookEventsPage,
|
|
85
|
+
type WebhookBody,
|
|
86
|
+
type WebhookEntity,
|
|
87
|
+
type WebhookPayload,
|
|
88
|
+
type WebhookPayloadRecord,
|
|
89
|
+
type WebhookPayloadRecordFor,
|
|
90
|
+
type WebhookHandlerFn,
|
|
91
|
+
type WebhookHandlers,
|
|
92
|
+
type WebhookHelpers,
|
|
93
|
+
type CreateWebhookParams,
|
|
94
|
+
type UpdateWebhookParams,
|
|
55
95
|
};
|
|
56
96
|
|
|
57
97
|
export {
|