@reopt-ai/workspace-sdk 0.1.0-rc.14 → 0.1.0-rc.15

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 CHANGED
@@ -7,6 +7,38 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.0-rc.15] — 2026-11-22
11
+
12
+ Pre-release (`npm i @reopt-ai/workspace-sdk@next`). 깨지는 변경 없음(웹훅 등록의 scope 규칙이 서버에서 바뀐다 — 아래 Changed).
13
+
14
+ ### Added
15
+
16
+ - **`postsChanged` 웹훅** — 워크스페이스의 글이 바뀌면(발행·게시 중 수정·내림·삭제·순서·태그·그룹) 등록한 주소로 온다.
17
+ 공개 사이트가 캐시 주기를 기다리지 않고 다시 굽는 신호다. 한 요청의 변경은 한 번으로 묶여 오고, `data.published`에
18
+ **지금 게시 중인** 글의 주소가 실린다(초안의 주소는 싣지 않는다). id가 100개를 넘으면 `data.truncated`. 구독에는
19
+ `posts:read` scope가 필요하다.
20
+ `platform.webhooks.upsert({ triggers: ["postsChanged"] })`, 수신은 `/webhooks`의 `handlers.postsChanged`.
21
+ 타입 `PostsChangedData`, 스키마 `platformPostsChangedEventSchema`.
22
+ - **`signWebhookRequest`**(`/webhooks`) — 리옵트와 같은 형식으로 서명한 요청을 만든다. 수신 핸들러를 따로 시험할 때 쓴다
23
+ (틀린 서명·오래된 시각·중복 전달).
24
+ - **`/testing` — 웹훅** — 에뮬레이터가 기계 표면의 `/v1/webhooks`(등록·목록·삭제)를 답하고, 등록한 주소로 `postsChanged`를
25
+ **실제로 보낸다**(운영과 같은 서명 — 진짜 수신 핸들러가 검증한다). 운영처럼 위임 표면의 글 쓰기마다 따라 나간다.
26
+ `devPlatform.emitPostsChanged()`(스튜디오에서 바뀐 것처럼 신호만), `settled()`, `webhookDeliveries`,
27
+ 옵션 `webhooks.fetch`·`machine.scopes`. 등록 규칙(새 주소의 비밀, 트리거별 scope)은 서버와 같다.
28
+
29
+ - `PLATFORM_WEBHOOK_TRIGGER_SCOPES` — 트리거를 구독하는 데 필요한 scope의 표(서버·설치 선언 검증·에뮬레이터가 같은 값을 읽는다).
30
+
31
+ ### Changed
32
+
33
+ - **웹훅 등록은 트리거마다 그 자료의 scope를 본다**(서버). `workTaskStageChanged`는 `works:write`, `postsChanged`는
34
+ `posts:read`(둘 다 `workspace:admin`이면 통과). 지금까지는 트리거가 하나뿐이라 `works:write` 하나로 충분했다.
35
+ - **기계 자격은 자기가 만든 웹훅만 본다**(서버). `platform.webhooks.list()`·`upsert`·`delete`가 이 자격(또는 같은 설치)이
36
+ 등록한 행만 다룬다 — 지금까지는 scope만 맞으면 그 워크스페이스의 플랫폼 웹훅 전부였다. 남이 등록한 주소에 `upsert`하면
37
+ 새로 만들거나 덮지 않고 403 `FORBIDDEN`이다. `workspace:admin`은 그대로 전부를 본다. 이 변경 이전에 만든 업무 웹훅
38
+ (`workTaskStageChanged`만 가진 행)은 `works:write`로 계속 다룰 수 있고, 처음 고친 자격의 것이 된다.
39
+ - **설치 선언** — `postsChanged` 웹훅을 선언하면 어떤 클라이언트가 `posts:read`(또는 `workspace:admin`)를 청해야 한다.
40
+ 아니면 `installationManifestSchema`가 거절한다(승인 화면의 권한 목록에 없는 자료를 받지 않게).
41
+
10
42
  ## [0.1.0-rc.14] — 2026-11-22
11
43
 
12
44
  Pre-release (`npm i @reopt-ai/workspace-sdk@next`). 깨지는 변경 없음.
package/README.md CHANGED
@@ -20,7 +20,9 @@ a company site, a service that files work into Studio) rather than being one bra
20
20
  per-field messages, `labelAnswers` for admin screens. See `docs/forms.md`.
21
21
  - **Mentions** (`/mentions`, no dependencies) — `mentionToken`, `splitMentions` for task comments.
22
22
  - **Webhooks** (`/webhooks`, no dependencies) — receive Reopt's events with the signature and
23
- replay window checked: `createWebhookHandler({ secret, handlers })`.
23
+ replay window checked: `createWebhookHandler({ secret, handlers })`. Events: `workTaskStageChanged`
24
+ (a task moved in Studio) and `postsChanged` (the workspace's posts changed — revalidate your
25
+ public site). `signWebhookRequest` builds a signed request for tests and local development.
24
26
  - **Machine credentials** (`/machine`) — `private_key_jwt` + DPoP, key generation (`reopt-keygen`), JWKS.
25
27
  - **Installations** (`/installation`) — declare, sign and request your app's connection.
26
28
  - **Resource verifier** (`/resource`), **social operations** (`/social`), **id host resolution** (`/urls`).
@@ -1,9 +1,9 @@
1
- import { l as SDK_VERSION, n as PlatformApiError } from "./errors-COUem1Rg.js";
2
- import { n as readPlatformFailure } from "./transport-DIZFMpfn.js";
1
+ import { l as SDK_VERSION, n as PlatformApiError } from "./errors-Cnh-XDtf.js";
2
+ import { n as readPlatformFailure } from "./transport-C8zLAgkC.js";
3
3
  import { resolvePlatformUrls } from "./urls.js";
4
4
  import { o as readClientKeyRing } from "./keys--ef_VwZ-.js";
5
5
  import { r as createMachineClient } from "./client-BLaFMBbS.js";
6
- import { B as platformPublishedPostPageSchema, C as platformEavSchemaApplyResultSchema, D as platformLockAcquiredSchema, F as platformPipelineSchema, G as platformResourcesV2Schema, K as platformTaskSchema, O as platformLockReleasedSchema, P as platformPipelineResourceSchema, V as platformPublishedPostSchema, Z as platformWebhookSchema, _ as platformBrandappResourceSchema, et as platformWriteMetaSchema, h as platformBrandResourceSchema, j as platformOAuthClientResourceSchema, k as platformMeSchema } from "./schemas-eWh_FUfh.js";
6
+ import { $ as platformWebhookSchema, A as platformMeSchema, F as platformPipelineResourceSchema, H as platformPublishedPostPageSchema, I as platformPipelineSchema, J as platformTaskSchema, M as platformOAuthClientResourceSchema, O as platformLockAcquiredSchema, U as platformPublishedPostSchema, g as platformBrandResourceSchema, k as platformLockReleasedSchema, nt as platformWriteMetaSchema, q as platformResourcesV2Schema, v as platformBrandappResourceSchema, w as platformEavSchemaApplyResultSchema } from "./schemas-BBUKRn_G.js";
7
7
 
8
8
  //#region src/workspace/client.ts
9
9
  const DEFAULT_PLATFORM_SCOPES = ["works:read", "works:write"];
@@ -272,4 +272,4 @@ function createPlatformClient(config) {
272
272
 
273
273
  //#endregion
274
274
  export { createPlatformClient as n, createPlatformRequester as r, DEFAULT_PLATFORM_SCOPES as t };
275
- //# sourceMappingURL=client-BkRONcRm.js.map
275
+ //# sourceMappingURL=client-BqdU2uJM.js.map
@@ -16,7 +16,13 @@ import { z } from "zod";
16
16
  */
17
17
  declare const PLATFORM_TASK_PRIORITIES: readonly ["low", "medium", "high", "urgent"];
18
18
  declare const PLATFORM_TASK_OUTCOMES: readonly ["completed", "canceled"];
19
- declare const PLATFORM_WEBHOOK_TRIGGERS: readonly ["workTaskStageChanged"];
19
+ declare const PLATFORM_WEBHOOK_TRIGGERS: readonly ["workTaskStageChanged", "postsChanged"];
20
+ /**
21
+ * 트리거를 구독하는 데 필요한 기계 scope — **그 사건의 자료를 다루는 scope**다(`workspace:admin`은 전부).
22
+ * 웹훅의 `data`는 그 자료의 일부라, 표가 없으면 업무 쓰기 열쇠가 글 변경을 구독해 scope 밖의 것을 받는다.
23
+ * 서버(`/v1/webhooks`)·설치 선언 검증·개발 에뮬레이터가 이 표 하나를 읽는다.
24
+ */
25
+ declare const PLATFORM_WEBHOOK_TRIGGER_SCOPES: Readonly<Record<(typeof PLATFORM_WEBHOOK_TRIGGERS)[number], string>>;
20
26
  type PlatformTaskPriority = (typeof PLATFORM_TASK_PRIORITIES)[number];
21
27
  type PlatformTaskOutcome = (typeof PLATFORM_TASK_OUTCOMES)[number] | null;
22
28
  type PlatformWebhookTrigger = (typeof PLATFORM_WEBHOOK_TRIGGERS)[number];
@@ -211,6 +217,28 @@ type PlatformWorkTaskStageChangedEvent = {
211
217
  label: string | null;
212
218
  }>;
213
219
  };
220
+ /**
221
+ * 웹훅 `postsChanged`의 `data` — "이 워크스페이스의 글이 바뀌었으니 다시 읽어라".
222
+ *
223
+ * 발행·게시 중 수정·내림·삭제·순서·태그·그룹 변경이 전부 이 하나로 온다(초안만 바뀐 경우에도 올 수 있다 —
224
+ * 받는 쪽은 다시 읽기만 하면 되므로 틀리지 않는다). 한 요청의 변경은 한 번으로 묶여 온다.
225
+ */
226
+ type PlatformPostsChangedEvent = {
227
+ /** 바뀐 글의 id(100개까지). 지워진 글·초안도 여기에는 있다. 그룹이나 브랜드를 통째로 지우면 글 id 없이 `groupIds`만 온다 */
228
+ postIds: string[];
229
+ /** 바뀐 글 그룹의 id(100개까지) */
230
+ groupIds: string[];
231
+ /** `postIds` 가운데 **지금 게시 중인** 글 — 여기 없는 것은 내렸거나 지웠거나 초안이다 */
232
+ published: Array<{
233
+ id: string;
234
+ groupId: string;
235
+ slug: string;
236
+ }>;
237
+ /** id가 100개를 넘어 잘렸다 — 주소별이 아니라 통째로 다시 굽는다 */
238
+ truncated: boolean;
239
+ /** 보낸 시각(ms epoch). 순서를 보는 값이다 — 이 값이 작다고 사건을 버리지 않는다(늦게 온 재전송도 자기 id를 싣고 있다) */
240
+ version: number;
241
+ };
214
242
  declare const platformTaskSchema: z.ZodType<PlatformTask>;
215
243
  declare const platformWriteMetaSchema: z.ZodType<PlatformWriteMeta>;
216
244
  declare const platformPipelineSchema: z.ZodType<PlatformPipeline>;
@@ -240,6 +268,7 @@ declare const platformPublishedPostDetailQuerySchema: z.ZodType<{
240
268
  }, unknown>;
241
269
  declare const platformWebhookSchema: z.ZodType<PlatformWebhook>;
242
270
  declare const platformErrorSchema: z.ZodType<PlatformErrorBody>;
271
+ declare const platformPostsChangedEventSchema: z.ZodType<PlatformPostsChangedEvent>;
243
272
  declare const platformWorkTaskStageChangedEventSchema: z.ZodType<PlatformWorkTaskStageChangedEvent>;
244
273
  declare const PLATFORM_ADMIN_SCOPE: "workspace:admin";
245
274
  declare const PLATFORM_MANAGED_BY_VALUES: readonly ["code"];
@@ -685,5 +714,5 @@ type PlatformClient = {
685
714
  };
686
715
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
687
716
  //#endregion
688
- export { PlatformStageColor as $, PlatformEavSchemaApplyResult as A, platformOAuthClientUpsertInputSchema as At, PlatformOAuthClientUpsertInput as B, platformPublishedPostSummarySchema as Bt, PlatformBrandappUpsertInput as C, platformErrorSchema as Ct, PlatformEavDataType as D, platformMeSchema as Dt, PlatformEavBrandappResources as E, platformLockReleasedSchema as Et, PlatformManagedBy as F, platformPipelineUpsertInputSchema as Ft, PlatformPipelineUpsertInput as G, platformTaskStageInputSchema as Gt, PlatformPipelineImportInput as H, platformResourcesSchema as Ht, PlatformMe as I, platformPublishedPostDetailQuerySchema as It, PlatformPublishedPostListOptions as J, platformWebhookResourceSchema as Jt, PlatformPublishedPost as K, platformTaskStageSchema as Kt, PlatformOAuthClientImportInput as L, platformPublishedPostListQuerySchema as Lt, PlatformErrorBody as M, platformPipelineResourceSchema as Mt, PlatformLockAcquired as N, platformPipelineSchema as Nt, PlatformEavEntityResource as O, platformOAuthClientImportInputSchema as Ot, PlatformLockReleased as P, platformPipelineStageInputSchema as Pt, PlatformResourcesV2 as Q, platformWriteMetaSchema as Qt, PlatformOAuthClientPurpose as R, platformPublishedPostPageSchema as Rt, PlatformBrandappResource as S, platformEavSchemaOperationSchema as St, PlatformDomainStatus as T, platformLockAcquiredSchema as Tt, PlatformPipelineResource as U, platformResourcesV2Schema as Ut, PlatformPipeline as V, platformResourceKeySchema as Vt, PlatformPipelineStageInput as W, platformTaskSchema as Wt, PlatformPublishedPostSummary as X, platformWebhookUpsertInputSchema as Xt, PlatformPublishedPostPage as Y, platformWebhookSchema as Yt, PlatformResources as Z, platformWorkTaskStageChangedEventSchema as Zt, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS as _, platformCustomerUpsertInputSchema as _t, createPlatformClient as a, PlatformTaskUpsertInput as at, PlatformBrandResource as b, platformEavSchemaApplyInputSchema as bt, PLATFORM_DOMAIN_STATUSES as c, PlatformWebhookTrigger as ct, PLATFORM_OAUTH_APPLICATION_TYPES as d, PlatformWriteMeta as dt, PlatformTask as et, PLATFORM_OAUTH_CLIENT_PURPOSES as f, platformBrandImportInputSchema as ft, PLATFORM_TASK_PRIORITIES as g, platformBrandappUpsertInputSchema as gt, PLATFORM_TASK_OUTCOMES as h, platformBrandappResourceSchema as ht, PlatformWriteResult as i, PlatformTaskStageInput as it, PlatformEavSchemaOperation as j, platformPipelineImportInputSchema as jt, PlatformEavSchemaApplyInput as k, platformOAuthClientResourceSchema as kt, PLATFORM_EAV_DATA_TYPES as l, PlatformWebhookUpsertInput as lt, PLATFORM_STAGE_COLORS as m, platformBrandUpsertInputSchema as mt, PlatformClient as n, PlatformTaskPriority as nt, PLATFORM_ADMIN_SCOPE as o, PlatformWebhook as ot, PLATFORM_OAUTH_GRANT_TYPES as p, platformBrandResourceSchema as pt, PlatformPublishedPostGetOptions as q, platformTaskUpsertInputSchema as qt, PlatformClientConfig as r, PlatformTaskStage as rt, PLATFORM_BRANDAPP_STATUSES as s, PlatformWebhookResource as st, DEFAULT_PLATFORM_SCOPES as t, PlatformTaskOutcome as tt, PLATFORM_MANAGED_BY_VALUES as u, PlatformWorkTaskStageChangedEvent as ut, PLATFORM_WEBHOOK_TRIGGERS as v, platformEavBrandappResourcesSchema as vt, PlatformCustomerUpsertInput as w, platformExternalIdSchema as wt, PlatformBrandUpsertInput as x, platformEavSchemaApplyResultSchema as xt, PlatformBrandImportInput as y, platformEavEntityResourceSchema as yt, PlatformOAuthClientResource as z, platformPublishedPostSchema as zt };
689
- //# sourceMappingURL=client-olMIaJZH.d.ts.map
717
+ export { PlatformResources as $, platformWebhookUpsertInputSchema as $t, PlatformEavSchemaApplyInput as A, platformOAuthClientImportInputSchema as At, PlatformOAuthClientResource as B, platformPublishedPostListQuerySchema as Bt, PlatformBrandappResource as C, platformEavSchemaApplyResultSchema as Ct, PlatformEavBrandappResources as D, platformLockAcquiredSchema as Dt, PlatformDomainStatus as E, platformExternalIdSchema as Et, PlatformLockReleased as F, platformPipelineSchema as Ft, PlatformPipelineStageInput as G, platformResourcesSchema as Gt, PlatformPipeline as H, platformPublishedPostSchema as Ht, PlatformManagedBy as I, platformPipelineStageInputSchema as It, PlatformPublishedPost as J, platformTaskStageInputSchema as Jt, PlatformPipelineUpsertInput as K, platformResourcesV2Schema as Kt, PlatformMe as L, platformPipelineUpsertInputSchema as Lt, PlatformEavSchemaOperation as M, platformOAuthClientUpsertInputSchema as Mt, PlatformErrorBody as N, platformPipelineImportInputSchema as Nt, PlatformEavDataType as O, platformLockReleasedSchema as Ot, PlatformLockAcquired as P, platformPipelineResourceSchema as Pt, PlatformPublishedPostSummary as Q, platformWebhookSchema as Qt, PlatformOAuthClientImportInput as R, platformPostsChangedEventSchema as Rt, PlatformBrandUpsertInput as S, platformEavSchemaApplyInputSchema as St, PlatformCustomerUpsertInput as T, platformErrorSchema as Tt, PlatformPipelineImportInput as U, platformPublishedPostSummarySchema as Ut, PlatformOAuthClientUpsertInput as V, platformPublishedPostPageSchema as Vt, PlatformPipelineResource as W, platformResourceKeySchema as Wt, PlatformPublishedPostListOptions as X, platformTaskUpsertInputSchema as Xt, PlatformPublishedPostGetOptions as Y, platformTaskStageSchema as Yt, PlatformPublishedPostPage as Z, platformWebhookResourceSchema as Zt, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS as _, platformBrandappResourceSchema as _t, createPlatformClient as a, PlatformTaskStage as at, PlatformBrandImportInput as b, platformEavBrandappResourcesSchema as bt, PLATFORM_DOMAIN_STATUSES as c, PlatformWebhook as ct, PLATFORM_OAUTH_APPLICATION_TYPES as d, PlatformWebhookUpsertInput as dt, platformWorkTaskStageChangedEventSchema as en, PlatformResourcesV2 as et, PLATFORM_OAUTH_CLIENT_PURPOSES as f, PlatformWorkTaskStageChangedEvent as ft, PLATFORM_TASK_PRIORITIES as g, platformBrandUpsertInputSchema as gt, PLATFORM_TASK_OUTCOMES as h, platformBrandResourceSchema as ht, PlatformWriteResult as i, PlatformTaskPriority as it, PlatformEavSchemaApplyResult as j, platformOAuthClientResourceSchema as jt, PlatformEavEntityResource as k, platformMeSchema as kt, PLATFORM_EAV_DATA_TYPES as l, PlatformWebhookResource as lt, PLATFORM_STAGE_COLORS as m, platformBrandImportInputSchema as mt, PlatformClient as n, PlatformTask as nt, PLATFORM_ADMIN_SCOPE as o, PlatformTaskStageInput as ot, PLATFORM_OAUTH_GRANT_TYPES as p, PlatformWriteMeta as pt, PlatformPostsChangedEvent as q, platformTaskSchema as qt, PlatformClientConfig as r, PlatformTaskOutcome as rt, PLATFORM_BRANDAPP_STATUSES as s, PlatformTaskUpsertInput as st, DEFAULT_PLATFORM_SCOPES as t, platformWriteMetaSchema as tn, PlatformStageColor as tt, PLATFORM_MANAGED_BY_VALUES as u, PlatformWebhookTrigger as ut, PLATFORM_WEBHOOK_TRIGGERS as v, platformBrandappUpsertInputSchema as vt, PlatformBrandappUpsertInput as w, platformEavSchemaOperationSchema as wt, PlatformBrandResource as x, platformEavEntityResourceSchema as xt, PLATFORM_WEBHOOK_TRIGGER_SCOPES as y, platformCustomerUpsertInputSchema as yt, PlatformOAuthClientPurpose as z, platformPublishedPostDetailQuerySchema as zt };
718
+ //# sourceMappingURL=client-C-J5e2Zo.d.ts.map
package/dist/connect.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as isPermissionDenied, c as isSignInRequired, i as isNotImplemented, n as PlatformApiError, o as isPlatformApiError, r as SDK_ERROR_CODES, s as isPlatformError, t as PLATFORM_ERROR_CODES } from "./errors-COUem1Rg.js";
1
+ import { a as isPermissionDenied, c as isSignInRequired, i as isNotImplemented, n as PlatformApiError, o as isPlatformApiError, r as SDK_ERROR_CODES, s as isPlatformError, t as PLATFORM_ERROR_CODES } from "./errors-Cnh-XDtf.js";
2
2
  import { CONNECT_OPERATIONS, CONNECT_OPERATION_NAMES, CONNECT_SCOPES, WORKSPACE_PERMISSION_KEYS, can, canAll, canAny, canCall } from "./permissions.js";
3
3
  import { mentionToken, splitMentions } from "./mentions.js";
4
- import { _ as connectPostSummarySchema, a as connectEavRecordSchema, b as createConnectClient, c as connectFolderSchema, d as connectInquirySchema, f as connectMeSchema, g as connectPostSchema, h as connectPostGroupSchema, i as connectEavEntitySchema, l as connectFormSchema, m as connectPipelineSchema, n as listAll, o as connectFileSchema, p as connectMemberSchema, r as connectBrandSchema, s as connectFileUsageSchema, t as iterate, u as connectInquiryDetailSchema, v as connectPostTagSchema, y as connectTaskSchema } from "./page-CJObTXTG.js";
4
+ import { _ as connectPostSummarySchema, a as connectEavRecordSchema, b as createConnectClient, c as connectFolderSchema, d as connectInquirySchema, f as connectMeSchema, g as connectPostSchema, h as connectPostGroupSchema, i as connectEavEntitySchema, l as connectFormSchema, m as connectPipelineSchema, n as listAll, o as connectFileSchema, p as connectMemberSchema, r as connectBrandSchema, s as connectFileUsageSchema, t as iterate, u as connectInquiryDetailSchema, v as connectPostTagSchema, y as connectTaskSchema } from "./page-Ck2IVCQF.js";
5
5
 
6
6
  export { CONNECT_OPERATIONS, CONNECT_OPERATION_NAMES, CONNECT_SCOPES, PLATFORM_ERROR_CODES, PlatformApiError, SDK_ERROR_CODES, WORKSPACE_PERMISSION_KEYS, can, canAll, canAny, canCall, connectBrandSchema, connectEavEntitySchema, connectEavRecordSchema, connectFileSchema, connectFileUsageSchema, connectFolderSchema, connectFormSchema, connectInquiryDetailSchema, connectInquirySchema, connectMeSchema, connectMemberSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectPostTagSchema, connectTaskSchema, createConnectClient, isNotImplemented, isPermissionDenied, isPlatformApiError, isPlatformError, isSignInRequired, iterate, listAll, mentionToken, splitMentions };
@@ -1,6 +1,6 @@
1
1
  //#region src/version.ts
2
2
  /** 이 패키지(`@reopt-ai/workspace-sdk`)의 버전 — 빌드가 package.json에서 주입한다(미번들 실행은 `0.0.0-dev`). */
3
- const SDK_VERSION = "0.1.0-rc.14";
3
+ const SDK_VERSION = "0.1.0-rc.15";
4
4
 
5
5
  //#endregion
6
6
  //#region src/workspace/errors.ts
@@ -120,4 +120,4 @@ function isPermissionDenied(error) {
120
120
 
121
121
  //#endregion
122
122
  export { isPermissionDenied as a, isSignInRequired as c, isNotImplemented as i, SDK_VERSION as l, PlatformApiError as n, isPlatformApiError as o, SDK_ERROR_CODES as r, isPlatformError as s, PLATFORM_ERROR_CODES as t };
123
- //# sourceMappingURL=errors-COUem1Rg.js.map
123
+ //# sourceMappingURL=errors-Cnh-XDtf.js.map
package/dist/index.d.ts CHANGED
@@ -4,5 +4,5 @@ import { a as PlatformSdkErrorCode, c as isNotImplemented, d as isPlatformError,
4
4
  import { $ as ConnectSignedUrl, A as ConnectInquiryListQuery, At as connectMemberSchema, B as ConnectPostAuthor, Bt as createConnectClient, C as ConnectFolder, Ct as connectFolderSchema, D as ConnectFormType, Dt as connectInquirySchema, E as ConnectFormStatus, Et as connectInquiryMoveResultSchema, F as ConnectMemberRole, Ft as connectPostSummarySchema, G as ConnectPostMetaInput, H as ConnectPostGroup, I as ConnectNotification, It as connectPostTagSchema, J as ConnectPostStatus, K as ConnectPostSortField, L as ConnectNotificationKind, Lt as connectTaskCommentSchema, M as ConnectInquirySummary, Mt as connectPipelineSchema, N as ConnectMe, Nt as connectPostGroupSchema, O as ConnectInquiry, Ot as connectInquirySummarySchema, P as ConnectMember, Pt as connectPostSchema, Q as ConnectRequestOptions, R as ConnectPipeline, Rt as connectTaskFeedItemSchema, S as ConnectFileVisibility, St as connectFileUsageSchema, T as ConnectForm, Tt as connectInquiryDetailSchema, U as ConnectPostGroupKind, V as ConnectPostCreateInput, W as ConnectPostListQuery, X as ConnectPostTag, Y as ConnectPostSummary, Z as ConnectPostUpdateInput, _ as ConnectEavRecord, _t as connectCustomerSchema, a as ConnectClientConfig, at as ConnectTaskComment, b as ConnectFileSortField, bt as connectEavRecordSchema, c as ConnectCustomerEvent, ct as ConnectTaskFeedMember, d as ConnectCustomerNote, dt as ConnectTaskPriority, et as ConnectSignedUrlOptions, f as ConnectCustomerRecord, ft as ConnectTaskSortField, g as ConnectEavEntity, gt as connectCustomerNoteSchema, h as ConnectCustomerUpdateInput, ht as connectBrandSchema, i as ConnectClient, it as ConnectTaskActivity, j as ConnectInquiryMoveResult, jt as connectNotificationSchema, k as ConnectInquiryDetail, kt as connectMeSchema, l as ConnectCustomerField, lt as ConnectTaskListQuery, m as ConnectCustomerTag, mt as ConnectWorkspaceTier, n as ConnectAnswerValue, nt as ConnectStageOutcome, o as ConnectCustomer, ot as ConnectTaskCreateInput, p as ConnectCustomerSummary, pt as ConnectTaskUpdateInput, q as ConnectPostSpec, r as ConnectBrand, rt as ConnectTask, s as ConnectCustomerCreateInput, st as ConnectTaskFeedItem, t as ConnectAccessToken, tt as ConnectStageColor, u as ConnectCustomerListQuery, ut as ConnectTaskMoveInput, v as ConnectFile, vt as connectCustomerSummarySchema, w as ConnectFolderKind, wt as connectFormSchema, x as ConnectFileUsage, xt as connectFileSchema, y as ConnectFileListQuery, yt as connectEavEntitySchema, z as ConnectPost, zt as connectTaskSchema } from "./connect-aWLB141V.js";
5
5
  import { n as mentionToken, r as splitMentions, t as MentionSegment } from "./mentions-BMI2c7O6.js";
6
6
  import { a as REOPT_PLATFORM_URLS, c as resolvePlatformUrls, i as REOPT_PLATFORM_ID_URLS, n as PlatformUrls } from "./urls-DiYp_PHg.js";
7
- import { $ as PlatformStageColor, A as PlatformEavSchemaApplyResult, At as platformOAuthClientUpsertInputSchema, B as PlatformOAuthClientUpsertInput, Bt as platformPublishedPostSummarySchema, C as PlatformBrandappUpsertInput, Ct as platformErrorSchema, D as PlatformEavDataType, Dt as platformMeSchema, E as PlatformEavBrandappResources, Et as platformLockReleasedSchema, F as PlatformManagedBy, Ft as platformPipelineUpsertInputSchema, G as PlatformPipelineUpsertInput, Gt as platformTaskStageInputSchema, H as PlatformPipelineImportInput, Ht as platformResourcesSchema, I as PlatformMe, It as platformPublishedPostDetailQuerySchema, J as PlatformPublishedPostListOptions, Jt as platformWebhookResourceSchema, K as PlatformPublishedPost, Kt as platformTaskStageSchema, L as PlatformOAuthClientImportInput, Lt as platformPublishedPostListQuerySchema, M as PlatformErrorBody, Mt as platformPipelineResourceSchema, N as PlatformLockAcquired, Nt as platformPipelineSchema, O as PlatformEavEntityResource, Ot as platformOAuthClientImportInputSchema, P as PlatformLockReleased, Pt as platformPipelineStageInputSchema, Q as PlatformResourcesV2, Qt as platformWriteMetaSchema, R as PlatformOAuthClientPurpose, Rt as platformPublishedPostPageSchema, S as PlatformBrandappResource, St as platformEavSchemaOperationSchema, T as PlatformDomainStatus, Tt as platformLockAcquiredSchema, U as PlatformPipelineResource, Ut as platformResourcesV2Schema, V as PlatformPipeline, Vt as platformResourceKeySchema, W as PlatformPipelineStageInput, Wt as platformTaskSchema, X as PlatformPublishedPostSummary, Xt as platformWebhookUpsertInputSchema, Y as PlatformPublishedPostPage, Yt as platformWebhookSchema, Z as PlatformResources, Zt as platformWorkTaskStageChangedEventSchema, _ as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, _t as platformCustomerUpsertInputSchema, a as createPlatformClient, at as PlatformTaskUpsertInput, b as PlatformBrandResource, bt as platformEavSchemaApplyInputSchema, c as PLATFORM_DOMAIN_STATUSES, ct as PlatformWebhookTrigger, d as PLATFORM_OAUTH_APPLICATION_TYPES, dt as PlatformWriteMeta, et as PlatformTask, f as PLATFORM_OAUTH_CLIENT_PURPOSES, ft as platformBrandImportInputSchema, g as PLATFORM_TASK_PRIORITIES, gt as platformBrandappUpsertInputSchema, h as PLATFORM_TASK_OUTCOMES, ht as platformBrandappResourceSchema, i as PlatformWriteResult, it as PlatformTaskStageInput, j as PlatformEavSchemaOperation, jt as platformPipelineImportInputSchema, k as PlatformEavSchemaApplyInput, kt as platformOAuthClientResourceSchema, l as PLATFORM_EAV_DATA_TYPES, lt as PlatformWebhookUpsertInput, m as PLATFORM_STAGE_COLORS, mt as platformBrandUpsertInputSchema, n as PlatformClient, nt as PlatformTaskPriority, o as PLATFORM_ADMIN_SCOPE, ot as PlatformWebhook, p as PLATFORM_OAUTH_GRANT_TYPES, pt as platformBrandResourceSchema, q as PlatformPublishedPostGetOptions, qt as platformTaskUpsertInputSchema, r as PlatformClientConfig, rt as PlatformTaskStage, s as PLATFORM_BRANDAPP_STATUSES, st as PlatformWebhookResource, t as DEFAULT_PLATFORM_SCOPES, tt as PlatformTaskOutcome, u as PLATFORM_MANAGED_BY_VALUES, ut as PlatformWorkTaskStageChangedEvent, v as PLATFORM_WEBHOOK_TRIGGERS, vt as platformEavBrandappResourcesSchema, w as PlatformCustomerUpsertInput, wt as platformExternalIdSchema, x as PlatformBrandUpsertInput, xt as platformEavSchemaApplyResultSchema, y as PlatformBrandImportInput, yt as platformEavEntityResourceSchema, z as PlatformOAuthClientResource, zt as platformPublishedPostSchema } from "./client-olMIaJZH.js";
8
- export { CONNECT_OPERATIONS, CONNECT_OPERATION_NAMES, CONNECT_SCOPES, type ConnectAccessToken, type ConnectAnswerValue, type ConnectBrand, type ConnectClient, type ConnectClientConfig, type ConnectCustomer, type ConnectCustomerCreateInput, type ConnectCustomerEvent, type ConnectCustomerField, type ConnectCustomerListQuery, type ConnectCustomerNote, type ConnectCustomerRecord, type ConnectCustomerSummary, type ConnectCustomerTag, type ConnectCustomerUpdateInput, type ConnectEavEntity, type ConnectEavRecord, type ConnectFile, type ConnectFileListQuery, type ConnectFileSortField, type ConnectFileUsage, type ConnectFileVisibility, type ConnectFolder, type ConnectFolderKind, type ConnectForm, type ConnectFormStatus, type ConnectFormType, type ConnectInquiry, type ConnectInquiryDetail, type ConnectInquiryListQuery, type ConnectInquiryMoveResult, type ConnectInquirySummary, type ConnectMe, type ConnectMember, type ConnectMemberRole, type ConnectNotification, type ConnectNotificationKind, type ConnectOperation, type ConnectOperationRule, type ConnectPipeline, type ConnectPost, type ConnectPostAuthor, type ConnectPostCreateInput, type ConnectPostGroup, type ConnectPostGroupKind, type ConnectPostListQuery, type ConnectPostMetaInput, type ConnectPostSortField, type ConnectPostSpec, type ConnectPostStatus, type ConnectPostSummary, type ConnectPostTag, type ConnectPostUpdateInput, type ConnectRequestOptions, type ConnectScope, type ConnectSignedUrl, type ConnectSignedUrlOptions, type ConnectStageColor, type ConnectStageOutcome, type ConnectTask, type ConnectTaskActivity, type ConnectTaskComment, type ConnectTaskCreateInput, type ConnectTaskFeedItem, type ConnectTaskFeedMember, type ConnectTaskListQuery, type ConnectTaskMoveInput, type ConnectTaskPriority, type ConnectTaskSortField, type ConnectTaskUpdateInput, type ConnectWorkspaceTier, type CountedPage, DEFAULT_PLATFORM_SCOPES, type MentionSegment, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, PLATFORM_EAV_DATA_TYPES, PLATFORM_ERROR_CODES, PLATFORM_MANAGED_BY_VALUES, PLATFORM_OAUTH_APPLICATION_TYPES, PLATFORM_OAUTH_CLIENT_PURPOSES, PLATFORM_OAUTH_GRANT_TYPES, PLATFORM_STAGE_COLORS, PLATFORM_TASK_OUTCOMES, PLATFORM_TASK_PRIORITIES, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, PLATFORM_WEBHOOK_TRIGGERS, type Page, type PageQuery, PlatformApiError, type PlatformBrandImportInput, type PlatformBrandResource, type PlatformBrandUpsertInput, type PlatformBrandappResource, type PlatformBrandappUpsertInput, type PlatformClient, type PlatformClientConfig, type PlatformCustomerUpsertInput, type PlatformDomainStatus, type PlatformEavBrandappResources, type PlatformEavDataType, type PlatformEavEntityResource, type PlatformEavSchemaApplyInput, type PlatformEavSchemaApplyResult, type PlatformEavSchemaOperation, type PlatformErrorBody, type PlatformErrorCode, type PlatformFieldError, type PlatformLockAcquired, type PlatformLockReleased, type PlatformManagedBy, type PlatformMe, type PlatformOAuthClientImportInput, type PlatformOAuthClientPurpose, type PlatformOAuthClientResource, type PlatformOAuthClientUpsertInput, type PlatformPipeline, type PlatformPipelineImportInput, type PlatformPipelineResource, type PlatformPipelineStageInput, type PlatformPipelineUpsertInput, type PlatformPublishedPost, type PlatformPublishedPostGetOptions, type PlatformPublishedPostListOptions, type PlatformPublishedPostPage, type PlatformPublishedPostSummary, type PlatformResources, type PlatformResourcesV2, type PlatformSdkErrorCode, type PlatformServerErrorCode, type PlatformStageColor, type PlatformTask, type PlatformTaskOutcome, type PlatformTaskPriority, type PlatformTaskStage, type PlatformTaskStageInput, type PlatformTaskUpsertInput, type PlatformUrls, type PlatformWebhook, type PlatformWebhookResource, type PlatformWebhookTrigger, type PlatformWebhookUpsertInput, type PlatformWorkTaskStageChangedEvent, type PlatformWriteMeta, type PlatformWriteResult, REOPT_PLATFORM_ID_URLS, REOPT_PLATFORM_URLS, SDK_ERROR_CODES, type SortOf, WORKSPACE_PERMISSION_KEYS, type WorkspacePermissionKey, can, canAll, canAny, canCall, connectBrandSchema, type connectCustomerNoteSchema, type connectCustomerSchema, type connectCustomerSummarySchema, connectEavEntitySchema, connectEavRecordSchema, connectFileSchema, connectFileUsageSchema, connectFolderSchema, connectFormSchema, connectInquiryDetailSchema, type connectInquiryMoveResultSchema, connectInquirySchema, type connectInquirySummarySchema, connectMeSchema, connectMemberSchema, type connectNotificationSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectPostTagSchema, type connectTaskCommentSchema, type connectTaskFeedItemSchema, connectTaskSchema, createConnectClient, createPlatformClient, isNotImplemented, isPermissionDenied, isPlatformApiError, isPlatformError, isSignInRequired, iterate, listAll, mentionToken, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformPublishedPostDetailQuerySchema, platformPublishedPostListQuerySchema, platformPublishedPostPageSchema, platformPublishedPostSchema, platformPublishedPostSummarySchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls, splitMentions };
7
+ import { $ as PlatformResources, $t as platformWebhookUpsertInputSchema, A as PlatformEavSchemaApplyInput, At as platformOAuthClientImportInputSchema, B as PlatformOAuthClientResource, Bt as platformPublishedPostListQuerySchema, C as PlatformBrandappResource, Ct as platformEavSchemaApplyResultSchema, D as PlatformEavBrandappResources, Dt as platformLockAcquiredSchema, E as PlatformDomainStatus, Et as platformExternalIdSchema, F as PlatformLockReleased, Ft as platformPipelineSchema, G as PlatformPipelineStageInput, Gt as platformResourcesSchema, H as PlatformPipeline, Ht as platformPublishedPostSchema, I as PlatformManagedBy, It as platformPipelineStageInputSchema, J as PlatformPublishedPost, Jt as platformTaskStageInputSchema, K as PlatformPipelineUpsertInput, Kt as platformResourcesV2Schema, L as PlatformMe, Lt as platformPipelineUpsertInputSchema, M as PlatformEavSchemaOperation, Mt as platformOAuthClientUpsertInputSchema, N as PlatformErrorBody, Nt as platformPipelineImportInputSchema, O as PlatformEavDataType, Ot as platformLockReleasedSchema, P as PlatformLockAcquired, Pt as platformPipelineResourceSchema, Q as PlatformPublishedPostSummary, Qt as platformWebhookSchema, R as PlatformOAuthClientImportInput, Rt as platformPostsChangedEventSchema, S as PlatformBrandUpsertInput, St as platformEavSchemaApplyInputSchema, T as PlatformCustomerUpsertInput, Tt as platformErrorSchema, U as PlatformPipelineImportInput, Ut as platformPublishedPostSummarySchema, V as PlatformOAuthClientUpsertInput, Vt as platformPublishedPostPageSchema, W as PlatformPipelineResource, Wt as platformResourceKeySchema, X as PlatformPublishedPostListOptions, Xt as platformTaskUpsertInputSchema, Y as PlatformPublishedPostGetOptions, Yt as platformTaskStageSchema, Z as PlatformPublishedPostPage, Zt as platformWebhookResourceSchema, _ as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, _t as platformBrandappResourceSchema, a as createPlatformClient, at as PlatformTaskStage, b as PlatformBrandImportInput, bt as platformEavBrandappResourcesSchema, c as PLATFORM_DOMAIN_STATUSES, ct as PlatformWebhook, d as PLATFORM_OAUTH_APPLICATION_TYPES, dt as PlatformWebhookUpsertInput, en as platformWorkTaskStageChangedEventSchema, et as PlatformResourcesV2, f as PLATFORM_OAUTH_CLIENT_PURPOSES, ft as PlatformWorkTaskStageChangedEvent, g as PLATFORM_TASK_PRIORITIES, gt as platformBrandUpsertInputSchema, h as PLATFORM_TASK_OUTCOMES, ht as platformBrandResourceSchema, i as PlatformWriteResult, it as PlatformTaskPriority, j as PlatformEavSchemaApplyResult, jt as platformOAuthClientResourceSchema, k as PlatformEavEntityResource, kt as platformMeSchema, l as PLATFORM_EAV_DATA_TYPES, lt as PlatformWebhookResource, m as PLATFORM_STAGE_COLORS, mt as platformBrandImportInputSchema, n as PlatformClient, nt as PlatformTask, o as PLATFORM_ADMIN_SCOPE, ot as PlatformTaskStageInput, p as PLATFORM_OAUTH_GRANT_TYPES, pt as PlatformWriteMeta, q as PlatformPostsChangedEvent, qt as platformTaskSchema, r as PlatformClientConfig, rt as PlatformTaskOutcome, s as PLATFORM_BRANDAPP_STATUSES, st as PlatformTaskUpsertInput, t as DEFAULT_PLATFORM_SCOPES, tn as platformWriteMetaSchema, tt as PlatformStageColor, u as PLATFORM_MANAGED_BY_VALUES, ut as PlatformWebhookTrigger, v as PLATFORM_WEBHOOK_TRIGGERS, vt as platformBrandappUpsertInputSchema, w as PlatformBrandappUpsertInput, wt as platformEavSchemaOperationSchema, x as PlatformBrandResource, xt as platformEavEntityResourceSchema, y as PLATFORM_WEBHOOK_TRIGGER_SCOPES, yt as platformCustomerUpsertInputSchema, z as PlatformOAuthClientPurpose, zt as platformPublishedPostDetailQuerySchema } from "./client-C-J5e2Zo.js";
8
+ export { CONNECT_OPERATIONS, CONNECT_OPERATION_NAMES, CONNECT_SCOPES, type ConnectAccessToken, type ConnectAnswerValue, type ConnectBrand, type ConnectClient, type ConnectClientConfig, type ConnectCustomer, type ConnectCustomerCreateInput, type ConnectCustomerEvent, type ConnectCustomerField, type ConnectCustomerListQuery, type ConnectCustomerNote, type ConnectCustomerRecord, type ConnectCustomerSummary, type ConnectCustomerTag, type ConnectCustomerUpdateInput, type ConnectEavEntity, type ConnectEavRecord, type ConnectFile, type ConnectFileListQuery, type ConnectFileSortField, type ConnectFileUsage, type ConnectFileVisibility, type ConnectFolder, type ConnectFolderKind, type ConnectForm, type ConnectFormStatus, type ConnectFormType, type ConnectInquiry, type ConnectInquiryDetail, type ConnectInquiryListQuery, type ConnectInquiryMoveResult, type ConnectInquirySummary, type ConnectMe, type ConnectMember, type ConnectMemberRole, type ConnectNotification, type ConnectNotificationKind, type ConnectOperation, type ConnectOperationRule, type ConnectPipeline, type ConnectPost, type ConnectPostAuthor, type ConnectPostCreateInput, type ConnectPostGroup, type ConnectPostGroupKind, type ConnectPostListQuery, type ConnectPostMetaInput, type ConnectPostSortField, type ConnectPostSpec, type ConnectPostStatus, type ConnectPostSummary, type ConnectPostTag, type ConnectPostUpdateInput, type ConnectRequestOptions, type ConnectScope, type ConnectSignedUrl, type ConnectSignedUrlOptions, type ConnectStageColor, type ConnectStageOutcome, type ConnectTask, type ConnectTaskActivity, type ConnectTaskComment, type ConnectTaskCreateInput, type ConnectTaskFeedItem, type ConnectTaskFeedMember, type ConnectTaskListQuery, type ConnectTaskMoveInput, type ConnectTaskPriority, type ConnectTaskSortField, type ConnectTaskUpdateInput, type ConnectWorkspaceTier, type CountedPage, DEFAULT_PLATFORM_SCOPES, type MentionSegment, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, PLATFORM_EAV_DATA_TYPES, PLATFORM_ERROR_CODES, PLATFORM_MANAGED_BY_VALUES, PLATFORM_OAUTH_APPLICATION_TYPES, PLATFORM_OAUTH_CLIENT_PURPOSES, PLATFORM_OAUTH_GRANT_TYPES, PLATFORM_STAGE_COLORS, PLATFORM_TASK_OUTCOMES, PLATFORM_TASK_PRIORITIES, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, PLATFORM_WEBHOOK_TRIGGERS, PLATFORM_WEBHOOK_TRIGGER_SCOPES, type Page, type PageQuery, PlatformApiError, type PlatformBrandImportInput, type PlatformBrandResource, type PlatformBrandUpsertInput, type PlatformBrandappResource, type PlatformBrandappUpsertInput, type PlatformClient, type PlatformClientConfig, type PlatformCustomerUpsertInput, type PlatformDomainStatus, type PlatformEavBrandappResources, type PlatformEavDataType, type PlatformEavEntityResource, type PlatformEavSchemaApplyInput, type PlatformEavSchemaApplyResult, type PlatformEavSchemaOperation, type PlatformErrorBody, type PlatformErrorCode, type PlatformFieldError, type PlatformLockAcquired, type PlatformLockReleased, type PlatformManagedBy, type PlatformMe, type PlatformOAuthClientImportInput, type PlatformOAuthClientPurpose, type PlatformOAuthClientResource, type PlatformOAuthClientUpsertInput, type PlatformPipeline, type PlatformPipelineImportInput, type PlatformPipelineResource, type PlatformPipelineStageInput, type PlatformPipelineUpsertInput, type PlatformPostsChangedEvent, type PlatformPublishedPost, type PlatformPublishedPostGetOptions, type PlatformPublishedPostListOptions, type PlatformPublishedPostPage, type PlatformPublishedPostSummary, type PlatformResources, type PlatformResourcesV2, type PlatformSdkErrorCode, type PlatformServerErrorCode, type PlatformStageColor, type PlatformTask, type PlatformTaskOutcome, type PlatformTaskPriority, type PlatformTaskStage, type PlatformTaskStageInput, type PlatformTaskUpsertInput, type PlatformUrls, type PlatformWebhook, type PlatformWebhookResource, type PlatformWebhookTrigger, type PlatformWebhookUpsertInput, type PlatformWorkTaskStageChangedEvent, type PlatformWriteMeta, type PlatformWriteResult, REOPT_PLATFORM_ID_URLS, REOPT_PLATFORM_URLS, SDK_ERROR_CODES, type SortOf, WORKSPACE_PERMISSION_KEYS, type WorkspacePermissionKey, can, canAll, canAny, canCall, connectBrandSchema, type connectCustomerNoteSchema, type connectCustomerSchema, type connectCustomerSummarySchema, connectEavEntitySchema, connectEavRecordSchema, connectFileSchema, connectFileUsageSchema, connectFolderSchema, connectFormSchema, connectInquiryDetailSchema, type connectInquiryMoveResultSchema, connectInquirySchema, type connectInquirySummarySchema, connectMeSchema, connectMemberSchema, type connectNotificationSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectPostTagSchema, type connectTaskCommentSchema, type connectTaskFeedItemSchema, connectTaskSchema, createConnectClient, createPlatformClient, isNotImplemented, isPermissionDenied, isPlatformApiError, isPlatformError, isSignInRequired, iterate, listAll, mentionToken, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformPostsChangedEventSchema, platformPublishedPostDetailQuerySchema, platformPublishedPostListQuerySchema, platformPublishedPostPageSchema, platformPublishedPostSchema, platformPublishedPostSummarySchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls, splitMentions };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { a as isPermissionDenied, c as isSignInRequired, i as isNotImplemented, n as PlatformApiError, o as isPlatformApiError, r as SDK_ERROR_CODES, s as isPlatformError, t as PLATFORM_ERROR_CODES } from "./errors-COUem1Rg.js";
1
+ import { a as isPermissionDenied, c as isSignInRequired, i as isNotImplemented, n as PlatformApiError, o as isPlatformApiError, r as SDK_ERROR_CODES, s as isPlatformError, t as PLATFORM_ERROR_CODES } from "./errors-Cnh-XDtf.js";
2
2
  import { REOPT_PLATFORM_ID_URLS, REOPT_PLATFORM_URLS, resolvePlatformUrls } from "./urls.js";
3
- import { $ as platformWorkTaskStageChangedEventSchema, A as platformOAuthClientImportInputSchema, B as platformPublishedPostPageSchema, C as platformEavSchemaApplyResultSchema, D as platformLockAcquiredSchema, E as platformExternalIdSchema, F as platformPipelineSchema, G as platformResourcesV2Schema, H as platformPublishedPostSummarySchema, I as platformPipelineStageInputSchema, J as platformTaskStageSchema, K as platformTaskSchema, L as platformPipelineUpsertInputSchema, M as platformOAuthClientUpsertInputSchema, N as platformPipelineImportInputSchema, O as platformLockReleasedSchema, P as platformPipelineResourceSchema, Q as platformWebhookUpsertInputSchema, R as platformPublishedPostDetailQuerySchema, S as platformEavSchemaApplyInputSchema, T as platformErrorSchema, U as platformResourceKeySchema, V as platformPublishedPostSchema, W as platformResourcesSchema, X as platformWebhookResourceSchema, Y as platformTaskUpsertInputSchema, Z as platformWebhookSchema, _ as platformBrandappResourceSchema, a as PLATFORM_MANAGED_BY_VALUES, b as platformEavBrandappResourcesSchema, c as PLATFORM_OAUTH_GRANT_TYPES, d as PLATFORM_TASK_PRIORITIES, et as platformWriteMetaSchema, f as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, g as platformBrandUpsertInputSchema, h as platformBrandResourceSchema, i as PLATFORM_EAV_DATA_TYPES, j as platformOAuthClientResourceSchema, k as platformMeSchema, l as PLATFORM_STAGE_COLORS, m as platformBrandImportInputSchema, n as PLATFORM_BRANDAPP_STATUSES, o as PLATFORM_OAUTH_APPLICATION_TYPES, p as PLATFORM_WEBHOOK_TRIGGERS, q as platformTaskStageInputSchema, r as PLATFORM_DOMAIN_STATUSES, s as PLATFORM_OAUTH_CLIENT_PURPOSES, t as PLATFORM_ADMIN_SCOPE, u as PLATFORM_TASK_OUTCOMES, v as platformBrandappUpsertInputSchema, w as platformEavSchemaOperationSchema, x as platformEavEntityResourceSchema, y as platformCustomerUpsertInputSchema, z as platformPublishedPostListQuerySchema } from "./schemas-eWh_FUfh.js";
4
- import { n as createPlatformClient, t as DEFAULT_PLATFORM_SCOPES } from "./client-BkRONcRm.js";
3
+ import { $ as platformWebhookSchema, A as platformMeSchema, B as platformPublishedPostDetailQuerySchema, C as platformEavSchemaApplyInputSchema, D as platformExternalIdSchema, E as platformErrorSchema, F as platformPipelineResourceSchema, G as platformResourceKeySchema, H as platformPublishedPostPageSchema, I as platformPipelineSchema, J as platformTaskSchema, K as platformResourcesSchema, L as platformPipelineStageInputSchema, M as platformOAuthClientResourceSchema, N as platformOAuthClientUpsertInputSchema, O as platformLockAcquiredSchema, P as platformPipelineImportInputSchema, Q as platformWebhookResourceSchema, R as platformPipelineUpsertInputSchema, S as platformEavEntityResourceSchema, T as platformEavSchemaOperationSchema, U as platformPublishedPostSchema, V as platformPublishedPostListQuerySchema, W as platformPublishedPostSummarySchema, X as platformTaskStageSchema, Y as platformTaskStageInputSchema, Z as platformTaskUpsertInputSchema, _ as platformBrandUpsertInputSchema, a as PLATFORM_MANAGED_BY_VALUES, b as platformCustomerUpsertInputSchema, c as PLATFORM_OAUTH_GRANT_TYPES, d as PLATFORM_TASK_PRIORITIES, et as platformWebhookUpsertInputSchema, f as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, g as platformBrandResourceSchema, h as platformBrandImportInputSchema, i as PLATFORM_EAV_DATA_TYPES, j as platformOAuthClientImportInputSchema, k as platformLockReleasedSchema, l as PLATFORM_STAGE_COLORS, m as PLATFORM_WEBHOOK_TRIGGER_SCOPES, n as PLATFORM_BRANDAPP_STATUSES, nt as platformWriteMetaSchema, o as PLATFORM_OAUTH_APPLICATION_TYPES, p as PLATFORM_WEBHOOK_TRIGGERS, q as platformResourcesV2Schema, r as PLATFORM_DOMAIN_STATUSES, s as PLATFORM_OAUTH_CLIENT_PURPOSES, t as PLATFORM_ADMIN_SCOPE, tt as platformWorkTaskStageChangedEventSchema, u as PLATFORM_TASK_OUTCOMES, v as platformBrandappResourceSchema, w as platformEavSchemaApplyResultSchema, x as platformEavBrandappResourcesSchema, y as platformBrandappUpsertInputSchema, z as platformPostsChangedEventSchema } from "./schemas-BBUKRn_G.js";
4
+ import { n as createPlatformClient, t as DEFAULT_PLATFORM_SCOPES } from "./client-BqdU2uJM.js";
5
5
  import { CONNECT_OPERATIONS, CONNECT_OPERATION_NAMES, CONNECT_SCOPES, WORKSPACE_PERMISSION_KEYS, can, canAll, canAny, canCall } from "./permissions.js";
6
6
  import { mentionToken, splitMentions } from "./mentions.js";
7
- import { _ as connectPostSummarySchema, a as connectEavRecordSchema, b as createConnectClient, c as connectFolderSchema, d as connectInquirySchema, f as connectMeSchema, g as connectPostSchema, h as connectPostGroupSchema, i as connectEavEntitySchema, l as connectFormSchema, m as connectPipelineSchema, n as listAll, o as connectFileSchema, p as connectMemberSchema, r as connectBrandSchema, s as connectFileUsageSchema, t as iterate, u as connectInquiryDetailSchema, v as connectPostTagSchema, y as connectTaskSchema } from "./page-CJObTXTG.js";
7
+ import { _ as connectPostSummarySchema, a as connectEavRecordSchema, b as createConnectClient, c as connectFolderSchema, d as connectInquirySchema, f as connectMeSchema, g as connectPostSchema, h as connectPostGroupSchema, i as connectEavEntitySchema, l as connectFormSchema, m as connectPipelineSchema, n as listAll, o as connectFileSchema, p as connectMemberSchema, r as connectBrandSchema, s as connectFileUsageSchema, t as iterate, u as connectInquiryDetailSchema, v as connectPostTagSchema, y as connectTaskSchema } from "./page-Ck2IVCQF.js";
8
8
 
9
- export { CONNECT_OPERATIONS, CONNECT_OPERATION_NAMES, CONNECT_SCOPES, DEFAULT_PLATFORM_SCOPES, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, PLATFORM_EAV_DATA_TYPES, PLATFORM_ERROR_CODES, PLATFORM_MANAGED_BY_VALUES, PLATFORM_OAUTH_APPLICATION_TYPES, PLATFORM_OAUTH_CLIENT_PURPOSES, PLATFORM_OAUTH_GRANT_TYPES, PLATFORM_STAGE_COLORS, PLATFORM_TASK_OUTCOMES, PLATFORM_TASK_PRIORITIES, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, PLATFORM_WEBHOOK_TRIGGERS, PlatformApiError, REOPT_PLATFORM_ID_URLS, REOPT_PLATFORM_URLS, SDK_ERROR_CODES, WORKSPACE_PERMISSION_KEYS, can, canAll, canAny, canCall, connectBrandSchema, connectEavEntitySchema, connectEavRecordSchema, connectFileSchema, connectFileUsageSchema, connectFolderSchema, connectFormSchema, connectInquiryDetailSchema, connectInquirySchema, connectMeSchema, connectMemberSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectPostTagSchema, connectTaskSchema, createConnectClient, createPlatformClient, isNotImplemented, isPermissionDenied, isPlatformApiError, isPlatformError, isSignInRequired, iterate, listAll, mentionToken, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformPublishedPostDetailQuerySchema, platformPublishedPostListQuerySchema, platformPublishedPostPageSchema, platformPublishedPostSchema, platformPublishedPostSummarySchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls, splitMentions };
9
+ export { CONNECT_OPERATIONS, CONNECT_OPERATION_NAMES, CONNECT_SCOPES, DEFAULT_PLATFORM_SCOPES, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, PLATFORM_EAV_DATA_TYPES, PLATFORM_ERROR_CODES, PLATFORM_MANAGED_BY_VALUES, PLATFORM_OAUTH_APPLICATION_TYPES, PLATFORM_OAUTH_CLIENT_PURPOSES, PLATFORM_OAUTH_GRANT_TYPES, PLATFORM_STAGE_COLORS, PLATFORM_TASK_OUTCOMES, PLATFORM_TASK_PRIORITIES, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, PLATFORM_WEBHOOK_TRIGGERS, PLATFORM_WEBHOOK_TRIGGER_SCOPES, PlatformApiError, REOPT_PLATFORM_ID_URLS, REOPT_PLATFORM_URLS, SDK_ERROR_CODES, WORKSPACE_PERMISSION_KEYS, can, canAll, canAny, canCall, connectBrandSchema, connectEavEntitySchema, connectEavRecordSchema, connectFileSchema, connectFileUsageSchema, connectFolderSchema, connectFormSchema, connectInquiryDetailSchema, connectInquirySchema, connectMeSchema, connectMemberSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectPostTagSchema, connectTaskSchema, createConnectClient, createPlatformClient, isNotImplemented, isPermissionDenied, isPlatformApiError, isPlatformError, isSignInRequired, iterate, listAll, mentionToken, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformPostsChangedEventSchema, platformPublishedPostDetailQuerySchema, platformPublishedPostListQuerySchema, platformPublishedPostPageSchema, platformPublishedPostSchema, platformPublishedPostSummarySchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls, splitMentions };
@@ -1,6 +1,6 @@
1
1
  import { i as ClientPrivateJwk, r as ClientKeyRing } from "../keys-BXkGh0VM.js";
2
2
  import { n as PlatformUrls } from "../urls-DiYp_PHg.js";
3
- import { Ft as platformPipelineUpsertInputSchema, f as PLATFORM_OAUTH_CLIENT_PURPOSES, gt as platformBrandappUpsertInputSchema, mt as platformBrandUpsertInputSchema, v as PLATFORM_WEBHOOK_TRIGGERS } from "../client-olMIaJZH.js";
3
+ import { Lt as platformPipelineUpsertInputSchema, f as PLATFORM_OAUTH_CLIENT_PURPOSES, gt as platformBrandUpsertInputSchema, v as PLATFORM_WEBHOOK_TRIGGERS, vt as platformBrandappUpsertInputSchema } from "../client-C-J5e2Zo.js";
4
4
  import { t as MachineClient } from "../client-DVozA5Ep.js";
5
5
  import * as jose from "jose";
6
6
  import { z } from "zod";
@@ -1,8 +1,8 @@
1
- import { l as SDK_VERSION, n as PlatformApiError } from "../errors-COUem1Rg.js";
1
+ import { l as SDK_VERSION, n as PlatformApiError } from "../errors-Cnh-XDtf.js";
2
2
  import { resolvePlatformUrls } from "../urls.js";
3
3
  import { o as readClientKeyRing } from "../keys--ef_VwZ-.js";
4
4
  import { r as createMachineClient } from "../client-BLaFMBbS.js";
5
- import { L as platformPipelineUpsertInputSchema, T as platformErrorSchema, U as platformResourceKeySchema, g as platformBrandUpsertInputSchema, p as PLATFORM_WEBHOOK_TRIGGERS, s as PLATFORM_OAUTH_CLIENT_PURPOSES, v as platformBrandappUpsertInputSchema } from "../schemas-eWh_FUfh.js";
5
+ import { E as platformErrorSchema, G as platformResourceKeySchema, R as platformPipelineUpsertInputSchema, _ as platformBrandUpsertInputSchema, m as PLATFORM_WEBHOOK_TRIGGER_SCOPES, p as PLATFORM_WEBHOOK_TRIGGERS, s as PLATFORM_OAUTH_CLIENT_PURPOSES, y as platformBrandappUpsertInputSchema } from "../schemas-BBUKRn_G.js";
6
6
  import * as jose from "jose";
7
7
  import { z } from "zod";
8
8
 
@@ -119,6 +119,21 @@ const installationManifestSchema = z.object({
119
119
  path: ["workspace", "brandapps"],
120
120
  message: "workspace apps do not declare brandapps"
121
121
  });
122
+ const requested = new Set(value.clients.flatMap((client) => client.scopes));
123
+ for (const [key, webhook] of Object.entries(value.workspace.webhooks ?? {})) for (const trigger of webhook.triggers) {
124
+ if (trigger === "workTaskStageChanged") continue;
125
+ const scope = PLATFORM_WEBHOOK_TRIGGER_SCOPES[trigger];
126
+ if (!requested.has(scope) && !requested.has("workspace:admin")) ctx.addIssue({
127
+ code: "custom",
128
+ path: [
129
+ "workspace",
130
+ "webhooks",
131
+ key,
132
+ "triggers"
133
+ ],
134
+ message: `${trigger} needs a client that requests ${scope}`
135
+ });
136
+ }
122
137
  if (value.exp <= value.iat) ctx.addIssue({
123
138
  code: "custom",
124
139
  path: ["exp"],
@@ -1,5 +1,5 @@
1
- import { n as PlatformApiError } from "./errors-COUem1Rg.js";
2
- import { t as createTransport } from "./transport-DIZFMpfn.js";
1
+ import { n as PlatformApiError } from "./errors-Cnh-XDtf.js";
2
+ import { t as createTransport } from "./transport-C8zLAgkC.js";
3
3
  import { resolvePlatformUrls } from "./urls.js";
4
4
  import { z } from "zod";
5
5
 
@@ -693,4 +693,4 @@ async function listAll(fetchPage, query, options = {}) {
693
693
 
694
694
  //#endregion
695
695
  export { connectPostSummarySchema as _, connectEavRecordSchema as a, createConnectClient as b, connectFolderSchema as c, connectInquirySchema as d, connectMeSchema as f, connectPostSchema as g, connectPostGroupSchema as h, connectEavEntitySchema as i, connectFormSchema as l, connectPipelineSchema as m, listAll as n, connectFileSchema as o, connectMemberSchema as p, connectBrandSchema as r, connectFileUsageSchema as s, iterate as t, connectInquiryDetailSchema as u, connectPostTagSchema as v, connectTaskSchema as y };
696
- //# sourceMappingURL=page-CJObTXTG.js.map
696
+ //# sourceMappingURL=page-Ck2IVCQF.js.map
@@ -19,7 +19,16 @@ const PLATFORM_TASK_PRIORITIES = [
19
19
  "urgent"
20
20
  ];
21
21
  const PLATFORM_TASK_OUTCOMES = ["completed", "canceled"];
22
- const PLATFORM_WEBHOOK_TRIGGERS = ["workTaskStageChanged"];
22
+ const PLATFORM_WEBHOOK_TRIGGERS = ["workTaskStageChanged", "postsChanged"];
23
+ /**
24
+ * 트리거를 구독하는 데 필요한 기계 scope — **그 사건의 자료를 다루는 scope**다(`workspace:admin`은 전부).
25
+ * 웹훅의 `data`는 그 자료의 일부라, 표가 없으면 업무 쓰기 열쇠가 글 변경을 구독해 scope 밖의 것을 받는다.
26
+ * 서버(`/v1/webhooks`)·설치 선언 검증·개발 에뮬레이터가 이 표 하나를 읽는다.
27
+ */
28
+ const PLATFORM_WEBHOOK_TRIGGER_SCOPES = {
29
+ workTaskStageChanged: "works:write",
30
+ postsChanged: "posts:read"
31
+ };
23
32
  /** 소스 쪽 식별자 — 경로 세그먼트라 슬래시·공백 금지, ≤255 */
24
33
  const platformExternalIdSchema = z.string().trim().min(1).max(255).regex(/^[^/\s]+$/, "externalId must not contain slashes or whitespace");
25
34
  const versionSchema = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
@@ -161,6 +170,17 @@ const platformErrorSchema = z.object({ error: z.object({
161
170
  message: z.string()
162
171
  })).optional()
163
172
  }) });
173
+ const platformPostsChangedEventSchema = z.object({
174
+ postIds: z.array(z.string()),
175
+ groupIds: z.array(z.string()),
176
+ published: z.array(z.object({
177
+ id: z.string(),
178
+ groupId: z.string(),
179
+ slug: z.string()
180
+ })),
181
+ truncated: z.boolean(),
182
+ version: z.number()
183
+ });
164
184
  const platformWorkTaskStageChangedEventSchema = z.object({
165
185
  id: z.string(),
166
186
  title: z.string(),
@@ -522,5 +542,5 @@ const platformResourcesV2Schema = z.object({
522
542
  });
523
543
 
524
544
  //#endregion
525
- export { platformWorkTaskStageChangedEventSchema as $, platformOAuthClientImportInputSchema as A, platformPublishedPostPageSchema as B, platformEavSchemaApplyResultSchema as C, platformLockAcquiredSchema as D, platformExternalIdSchema as E, platformPipelineSchema as F, platformResourcesV2Schema as G, platformPublishedPostSummarySchema as H, platformPipelineStageInputSchema as I, platformTaskStageSchema as J, platformTaskSchema as K, platformPipelineUpsertInputSchema as L, platformOAuthClientUpsertInputSchema as M, platformPipelineImportInputSchema as N, platformLockReleasedSchema as O, platformPipelineResourceSchema as P, platformWebhookUpsertInputSchema as Q, platformPublishedPostDetailQuerySchema as R, platformEavSchemaApplyInputSchema as S, platformErrorSchema as T, platformResourceKeySchema as U, platformPublishedPostSchema as V, platformResourcesSchema as W, platformWebhookResourceSchema as X, platformTaskUpsertInputSchema as Y, platformWebhookSchema as Z, platformBrandappResourceSchema as _, PLATFORM_MANAGED_BY_VALUES as a, platformEavBrandappResourcesSchema as b, PLATFORM_OAUTH_GRANT_TYPES as c, PLATFORM_TASK_PRIORITIES as d, platformWriteMetaSchema as et, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS as f, platformBrandUpsertInputSchema as g, platformBrandResourceSchema as h, PLATFORM_EAV_DATA_TYPES as i, platformOAuthClientResourceSchema as j, platformMeSchema as k, PLATFORM_STAGE_COLORS as l, platformBrandImportInputSchema as m, PLATFORM_BRANDAPP_STATUSES as n, PLATFORM_OAUTH_APPLICATION_TYPES as o, PLATFORM_WEBHOOK_TRIGGERS as p, platformTaskStageInputSchema as q, PLATFORM_DOMAIN_STATUSES as r, PLATFORM_OAUTH_CLIENT_PURPOSES as s, PLATFORM_ADMIN_SCOPE as t, PLATFORM_TASK_OUTCOMES as u, platformBrandappUpsertInputSchema as v, platformEavSchemaOperationSchema as w, platformEavEntityResourceSchema as x, platformCustomerUpsertInputSchema as y, platformPublishedPostListQuerySchema as z };
526
- //# sourceMappingURL=schemas-eWh_FUfh.js.map
545
+ export { platformWebhookSchema as $, platformMeSchema as A, platformPublishedPostDetailQuerySchema as B, platformEavSchemaApplyInputSchema as C, platformExternalIdSchema as D, platformErrorSchema as E, platformPipelineResourceSchema as F, platformResourceKeySchema as G, platformPublishedPostPageSchema as H, platformPipelineSchema as I, platformTaskSchema as J, platformResourcesSchema as K, platformPipelineStageInputSchema as L, platformOAuthClientResourceSchema as M, platformOAuthClientUpsertInputSchema as N, platformLockAcquiredSchema as O, platformPipelineImportInputSchema as P, platformWebhookResourceSchema as Q, platformPipelineUpsertInputSchema as R, platformEavEntityResourceSchema as S, platformEavSchemaOperationSchema as T, platformPublishedPostSchema as U, platformPublishedPostListQuerySchema as V, platformPublishedPostSummarySchema as W, platformTaskStageSchema as X, platformTaskStageInputSchema as Y, platformTaskUpsertInputSchema as Z, platformBrandUpsertInputSchema as _, PLATFORM_MANAGED_BY_VALUES as a, platformCustomerUpsertInputSchema as b, PLATFORM_OAUTH_GRANT_TYPES as c, PLATFORM_TASK_PRIORITIES as d, platformWebhookUpsertInputSchema as et, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS as f, platformBrandResourceSchema as g, platformBrandImportInputSchema as h, PLATFORM_EAV_DATA_TYPES as i, platformOAuthClientImportInputSchema as j, platformLockReleasedSchema as k, PLATFORM_STAGE_COLORS as l, PLATFORM_WEBHOOK_TRIGGER_SCOPES as m, PLATFORM_BRANDAPP_STATUSES as n, platformWriteMetaSchema as nt, PLATFORM_OAUTH_APPLICATION_TYPES as o, PLATFORM_WEBHOOK_TRIGGERS as p, platformResourcesV2Schema as q, PLATFORM_DOMAIN_STATUSES as r, PLATFORM_OAUTH_CLIENT_PURPOSES as s, PLATFORM_ADMIN_SCOPE as t, platformWorkTaskStageChangedEventSchema as tt, PLATFORM_TASK_OUTCOMES as u, platformBrandappResourceSchema as v, platformEavSchemaApplyResultSchema as w, platformEavBrandappResourcesSchema as x, platformBrandappUpsertInputSchema as y, platformPostsChangedEventSchema as z };
546
+ //# sourceMappingURL=schemas-BBUKRn_G.js.map
@@ -1,6 +1,6 @@
1
1
  import { n as PlatformApiError } from "../errors-CLUuzCNG.js";
2
2
  import { a as REOPT_PLATFORM_URLS, c as resolvePlatformUrls, i as REOPT_PLATFORM_ID_URLS, n as PlatformUrls } from "../urls-DiYp_PHg.js";
3
- import { r as PlatformClientConfig } from "../client-olMIaJZH.js";
3
+ import { r as PlatformClientConfig } from "../client-C-J5e2Zo.js";
4
4
  import { z } from "zod";
5
5
  //#region src/social/schemas.d.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { n as PlatformApiError } from "../errors-COUem1Rg.js";
1
+ import { n as PlatformApiError } from "../errors-Cnh-XDtf.js";
2
2
  import { REOPT_PLATFORM_ID_URLS, REOPT_PLATFORM_URLS, resolvePlatformUrls } from "../urls.js";
3
- import { r as createPlatformRequester } from "../client-BkRONcRm.js";
3
+ import { r as createPlatformRequester } from "../client-BqdU2uJM.js";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/social/schemas.ts
@@ -191,9 +191,18 @@ type DevPlatformOptions = {
191
191
  * 예: `http://localhost:3000/api/dev-reopt`. 생략하면 `platformUrl`.
192
192
  */
193
193
  browserBaseUrl?: string;
194
- /** 기계 표면(`/v1/me`)이 답하는 클라이언트 이름 */
194
+ /** 기계 표면 — `/v1/me`가 답하는 클라이언트 이름과 scope(기본 `["posts:read"]`). scope는 웹훅 등록을 가른다 */
195
195
  machine?: {
196
196
  clientName?: string;
197
+ scopes?: string[];
198
+ };
199
+ /**
200
+ * 웹훅 — 앱이 `platform.webhooks.upsert`로 등록한 주소에 `postsChanged`를 **실제로 보낸다**(운영과 같은 서명).
201
+ * 운영에서는 앱이 위임 표면으로 글을 바꿔도 이 신호가 오므로, 여기서도 `posts.*` 쓰기가 끝나면 보낸다.
202
+ * `fetch`를 주면 그것으로 보낸다(테스트에서 수신 핸들러에 바로 물린다). 생략하면 전역 `fetch`.
203
+ */
204
+ webhooks?: {
205
+ fetch?: typeof fetch;
197
206
  };
198
207
  /** 모든 응답 앞의 지연(ms) — 로딩 상태를 보려고 */
199
208
  latencyMs?: number;
@@ -223,9 +232,27 @@ type DevPlatform = {
223
232
  reset: () => void;
224
233
  /** 받은 요청 기록(최근 1,000건) — `"GET /files?folderId=all"` */
225
234
  requests: string[];
235
+ /** 보낸 웹훅 기록(최근 1,000건) — `status`가 null이면 보내지 못했다(`error`) */
236
+ webhookDeliveries: DevWebhookDelivery[];
237
+ /** 보내는 중인 웹훅이 끝날 때까지 기다린다 — 테스트가 수신 결과를 보기 전에 부른다 */
238
+ settled: () => Promise<void>;
239
+ /**
240
+ * 스튜디오에서 일어난 변경을 흉내 낸다 — 등록된 주소로 `postsChanged`를 보낸다(상태는 바꾸지 않는다).
241
+ * 앱 밖에서 글이 바뀌었을 때 사이트가 다시 굽는지 시험한다.
242
+ */
243
+ emitPostsChanged: (input?: {
244
+ postIds?: string[];
245
+ groupIds?: string[];
246
+ }) => Promise<void>;
247
+ };
248
+ type DevWebhookDelivery = {
249
+ url: string;
250
+ type: string;
251
+ status: number | null;
252
+ error?: string;
226
253
  };
227
254
  type DevIdKind = "member" | "brand" | "pipeline" | "stage" | "task" | "postGroup" | "post" | "folder" | "file" | "form" | "submission" | "customer" | "notification" | "table";
228
255
  declare function createDevPlatform(options?: DevPlatformOptions): DevPlatform;
229
256
  //#endregion
230
- export { DevFormField, DevIdKind, DevPlatform, DevPlatformOptions, DevPlatformSeed, createDevPlatform };
257
+ export { DevFormField, DevIdKind, DevPlatform, DevPlatformOptions, DevPlatformSeed, DevWebhookDelivery, createDevPlatform };
231
258
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,6 @@
1
+ import { m as PLATFORM_WEBHOOK_TRIGGER_SCOPES, p as PLATFORM_WEBHOOK_TRIGGERS } from "../schemas-BBUKRn_G.js";
1
2
  import { CONNECT_OPERATIONS, WORKSPACE_PERMISSION_KEYS } from "../permissions.js";
3
+ import { signWebhookRequest } from "../webhooks.js";
2
4
 
3
5
  //#region src/testing/index.ts
4
6
  /**
@@ -18,7 +20,8 @@ import { CONNECT_OPERATIONS, WORKSPACE_PERMISSION_KEYS } from "../permissions.js
18
20
  * });
19
21
  * ```
20
22
  *
21
- * 흉내 내는 것: 위임 표면(`/v1/connect/*`) 전부와 기계 표면의 토큰·`/v1/me`·`/v1/posts`, 그리고 브라우저가 직접 여는 두 곳
23
+ * 흉내 내는 것: 위임 표면(`/v1/connect/*`) 전부와 기계 표면의 토큰·`/v1/me`·`/v1/posts`·`/v1/webhooks`(등록한 주소로 `postsChanged`를
24
+ * 실제로 보낸다 — 아래 "웹훅"), 그리고 브라우저가 직접 여는 두 곳
22
25
  * (서명 주소·공개 파일의 바이트, 공개 폼 제출 — `handler`). 계약 규칙도 따라 한다: 목록의 창·정렬, 쓰기의 전체 객체,
23
26
  * `VERSION_CONFLICT`·`SLUG_TAKEN`·`VALIDATION_ERROR`(`fields`)·413/415·`QUOTA_EXCEEDED`, 시스템 폴더 변경 거절,
24
27
  * 비어 있지 않은 폴더 삭제 409, 그리고 `me.permissions`·`me.scopes`를 주면 `CONNECT_OPERATIONS`대로 403.
@@ -28,6 +31,7 @@ import { CONNECT_OPERATIONS, WORKSPACE_PERMISSION_KEYS } from "../permissions.js
28
31
  *
29
32
  * 🔴 프로덕션 번들에 넣지 않는다 — 인증이 없다. `NODE_ENV === "production"`에서 만들면 던진다(`allowInProduction`으로만 푼다).
30
33
  */
34
+ const WEBHOOK_TRIGGER_SCOPE = PLATFORM_WEBHOOK_TRIGGER_SCOPES;
31
35
  var Refusal = class extends Error {
32
36
  status;
33
37
  code;
@@ -127,6 +131,53 @@ function build(options) {
127
131
  ];
128
132
  const requests = [];
129
133
  let state = seedState(options);
134
+ const machineScopes = options.machine?.scopes ?? ["posts:read"];
135
+ const webhookDeliveries = [];
136
+ let webhookQueue = Promise.resolve();
137
+ const sendWebhook = (type, data) => {
138
+ const targets = state.webhooks.filter((hook) => hook.triggers.includes(type));
139
+ if (targets.length === 0) return;
140
+ const send = options.webhooks?.fetch ?? globalThis.fetch;
141
+ const workspaceId = state.workspace.id;
142
+ webhookQueue = webhookQueue.then(async () => {
143
+ const id = `dev-evt-${state.counter += 1}`;
144
+ for (const hook of targets) {
145
+ const delivery = {
146
+ url: hook.url,
147
+ type,
148
+ status: null
149
+ };
150
+ try {
151
+ const request = await signWebhookRequest({
152
+ url: hook.url,
153
+ secret: hook.secret,
154
+ type,
155
+ data,
156
+ id,
157
+ entityType: "workspace",
158
+ entityId: workspaceId
159
+ });
160
+ delivery.status = (await send(request)).status;
161
+ } catch (error) {
162
+ delivery.error = error instanceof Error ? error.message : String(error);
163
+ }
164
+ webhookDeliveries.push(delivery);
165
+ if (webhookDeliveries.length > REQUEST_LOG_MAX) webhookDeliveries.splice(0, webhookDeliveries.length - REQUEST_LOG_MAX);
166
+ }
167
+ });
168
+ };
169
+ /** `postsChanged`의 `data` — 운영의 전달 층과 같은 모양(지금 게시 중인 글만 주소와 함께). */
170
+ const postsChangedData = (postIds, groupIds) => ({
171
+ postIds,
172
+ groupIds,
173
+ published: state.posts.filter((post) => postIds.includes(post.id) && post.status === "published").map((post) => ({
174
+ id: post.id,
175
+ groupId: post.groupId,
176
+ slug: post.slug
177
+ })),
178
+ truncated: false,
179
+ version: state.clock += 1
180
+ });
130
181
  const stamp = () => new Date(state.clock += 1).toISOString();
131
182
  const newId = () => {
132
183
  state.counter += 1;
@@ -1843,8 +1894,103 @@ function build(options) {
1843
1894
  } : null
1844
1895
  };
1845
1896
  };
1846
- const machine = (method, url) => {
1897
+ const webhookDto = (row) => ({
1898
+ id: row.id,
1899
+ url: row.url,
1900
+ triggers: row.triggers,
1901
+ hasSecret: row.secret.length > 0,
1902
+ managedBy: row.managedBy
1903
+ });
1904
+ const canManageWebhook = (triggers) => machineScopes.includes("workspace:admin") || triggers.every((trigger) => {
1905
+ const scope = WEBHOOK_TRIGGER_SCOPE[trigger];
1906
+ return scope !== void 0 && machineScopes.includes(scope);
1907
+ });
1908
+ const requireWebhookScope = () => {
1909
+ const any = [...Object.values(WEBHOOK_TRIGGER_SCOPE), "workspace:admin"];
1910
+ if (!any.some((scope) => machineScopes.includes(scope))) refuse(403, "INSUFFICIENT_SCOPE", `Required scope: ${[...new Set(any)].join(" | ")}`);
1911
+ };
1912
+ const machineWebhooks = (method, path, body) => {
1913
+ if (path === "/v1/webhooks" && method === "GET") {
1914
+ requireWebhookScope();
1915
+ return ok(state.webhooks.filter((row) => canManageWebhook(row.triggers)).map(webhookDto));
1916
+ }
1917
+ if (path === "/v1/webhooks" && method === "PUT") {
1918
+ requireWebhookScope();
1919
+ const input = assertBody(body);
1920
+ const url = str(input, "url", {
1921
+ required: true,
1922
+ max: 2e3
1923
+ });
1924
+ try {
1925
+ new URL(url);
1926
+ } catch {
1927
+ invalid("url", "Expected a URL");
1928
+ }
1929
+ const triggers = Array.isArray(input.triggers) ? input.triggers.map(String) : [];
1930
+ const known = PLATFORM_WEBHOOK_TRIGGERS;
1931
+ if (triggers.length === 0 || triggers.some((trigger) => !known.includes(trigger))) invalid("triggers", `Expected one or more of ${known.join(", ")}`);
1932
+ for (const trigger of triggers) {
1933
+ const scope = WEBHOOK_TRIGGER_SCOPE[trigger];
1934
+ if (!machineScopes.includes("workspace:admin") && !(scope && machineScopes.includes(scope))) refuse(403, "INSUFFICIENT_SCOPE", `Required scope: ${scope} | workspace:admin`);
1935
+ }
1936
+ const secret = str(input, "secret", { max: 1024 });
1937
+ if (secret !== void 0 && secret !== null && secret.length < 16) invalid("secret", "required (16–1024 chars)");
1938
+ if (input.managedBy !== void 0 && !machineScopes.includes("workspace:admin")) refuse(403, "INSUFFICIENT_SCOPE", "managedBy requires scope: workspace:admin");
1939
+ const managedBy = input.managedBy === "code" ? "code" : null;
1940
+ const existing = state.webhooks.find((row) => row.url === url);
1941
+ if (existing) {
1942
+ if (!canManageWebhook(existing.triggers)) refuse(403, "INSUFFICIENT_SCOPE", "A webhook at this URL subscribes to triggers outside this credential");
1943
+ existing.triggers = triggers;
1944
+ if (secret) existing.secret = secret;
1945
+ if (input.managedBy !== void 0) existing.managedBy = managedBy;
1946
+ return {
1947
+ status: 200,
1948
+ body: {
1949
+ data: webhookDto(existing),
1950
+ meta: {
1951
+ created: false,
1952
+ applied: true
1953
+ }
1954
+ }
1955
+ };
1956
+ }
1957
+ if (!secret) return invalid("secret", "required (16–1024 chars)");
1958
+ const row = {
1959
+ id: newId(),
1960
+ url,
1961
+ triggers,
1962
+ secret,
1963
+ managedBy
1964
+ };
1965
+ state.webhooks.push(row);
1966
+ return {
1967
+ status: 201,
1968
+ body: {
1969
+ data: webhookDto(row),
1970
+ meta: {
1971
+ created: true,
1972
+ applied: true
1973
+ }
1974
+ }
1975
+ };
1976
+ }
1977
+ const single = /^\/v1\/webhooks\/([^/]+)$/.exec(path);
1978
+ if (single && method === "DELETE") {
1979
+ requireWebhookScope();
1980
+ const id = decodeURIComponent(single[1]);
1981
+ const row = state.webhooks.find((candidate) => candidate.id === id && canManageWebhook(candidate.triggers));
1982
+ if (!row) return notFound("Webhook");
1983
+ state.webhooks = state.webhooks.filter((candidate) => candidate !== row);
1984
+ return ok({
1985
+ id,
1986
+ deleted: true
1987
+ });
1988
+ }
1989
+ return null;
1990
+ };
1991
+ const machine = (method, url, body) => {
1847
1992
  const path = url.pathname;
1993
+ if (path.startsWith("/v1/webhooks")) return machineWebhooks(method, path, body);
1848
1994
  if (method === "POST" && path.endsWith("/oauth2/token")) return {
1849
1995
  status: 200,
1850
1996
  body: {
@@ -1860,7 +2006,7 @@ function build(options) {
1860
2006
  workspaceId: state.workspace.id,
1861
2007
  brandappId: null,
1862
2008
  defaultBrandId: null,
1863
- scopes: ["posts:read"]
2009
+ scopes: machineScopes
1864
2010
  });
1865
2011
  if (method === "GET" && path === "/v1/posts") {
1866
2012
  const q = url.searchParams;
@@ -1924,11 +2070,18 @@ function build(options) {
1924
2070
  const match = pattern.exec(path);
1925
2071
  if (!match) continue;
1926
2072
  authorize(operation);
2073
+ const params = match.slice(1);
1927
2074
  reply = run({
1928
2075
  url,
1929
2076
  body: await readBody(request),
1930
- params: match.slice(1)
2077
+ params
1931
2078
  });
2079
+ if (operation.startsWith("posts.") && method !== "GET") {
2080
+ const created = !(reply instanceof Response) && operation === "posts.create" ? reply.body.data : void 0;
2081
+ const postId = created?.id ?? params[0];
2082
+ const groupId = created?.groupId ?? state.posts.find((post) => post.id === postId)?.groupId;
2083
+ sendWebhook("postsChanged", postsChangedData(postId ? [postId] : [], groupId ? [groupId] : []));
2084
+ }
1932
2085
  break;
1933
2086
  }
1934
2087
  if (reply && !(reply instanceof Response) && reply.status === 0) {
@@ -1945,7 +2098,7 @@ function build(options) {
1945
2098
  state.files.push(row);
1946
2099
  reply = ok(fileDto(row), 201);
1947
2100
  }
1948
- } else reply = machine(method, url);
2101
+ } else reply = machine(method, url, url.pathname.startsWith("/v1/webhooks") ? await readBody(request) : void 0);
1949
2102
  if (!reply) refuse(501, "NOT_IMPLEMENTED", `Dev platform does not answer ${method} ${url.pathname}`);
1950
2103
  return reply instanceof Response ? reply : Response.json(reply.body, { status: reply.status });
1951
2104
  } catch (error) {
@@ -2184,7 +2337,20 @@ function build(options) {
2184
2337
  if (!id) throw new Error(`[dev-platform] no ${kind} with key "${key}" in the seed`);
2185
2338
  return id;
2186
2339
  },
2340
+ webhookDeliveries,
2341
+ settled: async () => {
2342
+ let seen = null;
2343
+ while (seen !== webhookQueue) {
2344
+ seen = webhookQueue;
2345
+ await seen;
2346
+ }
2347
+ },
2348
+ emitPostsChanged: async (input = {}) => {
2349
+ sendWebhook("postsChanged", postsChangedData(input.postIds ?? [], input.groupIds ?? []));
2350
+ await webhookQueue;
2351
+ },
2187
2352
  reset: () => {
2353
+ webhookDeliveries.length = 0;
2188
2354
  state = seedState(options);
2189
2355
  plantSubmissions();
2190
2356
  requests.length = 0;
@@ -2216,6 +2382,7 @@ function seedState(options) {
2216
2382
  customerFields: [],
2217
2383
  notifications: [],
2218
2384
  tables: [],
2385
+ webhooks: [],
2219
2386
  ids: /* @__PURE__ */ new Map(),
2220
2387
  counter: 0,
2221
2388
  clock: start
@@ -1,4 +1,4 @@
1
- import { l as SDK_VERSION, n as PlatformApiError } from "./errors-COUem1Rg.js";
1
+ import { l as SDK_VERSION, n as PlatformApiError } from "./errors-Cnh-XDtf.js";
2
2
 
3
3
  //#region src/workspace/transport.ts
4
4
  function parseRetryAfter(value) {
@@ -189,4 +189,4 @@ function createTransport(config) {
189
189
 
190
190
  //#endregion
191
191
  export { readPlatformFailure as n, createTransport as t };
192
- //# sourceMappingURL=transport-DIZFMpfn.js.map
192
+ //# sourceMappingURL=transport-C8zLAgkC.js.map
@@ -16,6 +16,10 @@
16
16
  * if (event.data.origin === "my-app") return; // 내가 일으킨 변경
17
17
  * await syncStage(event.data);
18
18
  * },
19
+ * postsChanged: ({ data }) => {
20
+ * revalidatePath("/news"); // 글이 바뀌었다 — 캐시를 다시 굽는다
21
+ * for (const post of data.published) revalidatePath(`/news/${post.slug}`);
22
+ * },
19
23
  * },
20
24
  * });
21
25
  * ```
@@ -49,9 +53,38 @@ type WorkTaskStageChangedData = {
49
53
  label: string | null;
50
54
  }>;
51
55
  };
56
+ /**
57
+ * `postsChanged` — 이 워크스페이스의 글이 바뀌었다(발행·게시 중 수정·내림·삭제·순서·태그·그룹).
58
+ *
59
+ * 무엇이 어떻게 바뀌었는지가 아니라 **"다시 읽어라"**는 신호다. 받는 쪽은 글 목록 캐시를 버리고, `published`의
60
+ * 주소로 글 페이지를 다시 굽는다. 초안만 바뀐 경우에도 올 수 있고, 한 요청의 변경은 한 번으로 묶여 온다.
61
+ *
62
+ * ```ts
63
+ * postsChanged: ({ data }) => {
64
+ * revalidatePath("/news", "layout"); // 목록과 그 아래 전부 — 내렸거나 지운 글의 옛 주소는 사건에 없다
65
+ * },
66
+ * ```
67
+ */
68
+ type PostsChangedData = {
69
+ /** 바뀐 글의 id(100개까지). 지워진 글·초안도 여기에는 있다. 그룹이나 브랜드를 통째로 지우면 글 id 없이 `groupIds`만 온다 */
70
+ postIds: string[];
71
+ /** 바뀐 글 그룹의 id(100개까지) */
72
+ groupIds: string[];
73
+ /** `postIds` 가운데 **지금 게시 중인** 글 — 여기 없는 것은 내렸거나 지웠거나 초안이다 */
74
+ published: Array<{
75
+ id: string;
76
+ groupId: string;
77
+ slug: string;
78
+ }>;
79
+ /** id가 100개를 넘어 잘렸다 — 주소별이 아니라 통째로 다시 굽는다 */
80
+ truncated: boolean;
81
+ /** 보낸 시각(ms). 순서를 보는 값이다 — 이 값이 작다고 사건을 버리지 않는다(늦게 온 재전송도 자기 id를 싣고 있다) */
82
+ version: number;
83
+ };
52
84
  /** 사건 종류 → `data` 모양. 여기 없는 종류는 `data: unknown`으로 온다(새 종류가 생겨도 받는 쪽이 깨지지 않는다). */
53
85
  type WebhookEventDataMap = {
54
86
  workTaskStageChanged: WorkTaskStageChangedData;
87
+ postsChanged: PostsChangedData;
55
88
  };
56
89
  type WebhookEventType = keyof WebhookEventDataMap;
57
90
  type WebhookEvent<Type extends string = string, Data = Type extends WebhookEventType ? WebhookEventDataMap[Type] : unknown> = {
@@ -85,6 +118,33 @@ declare function verifyWebhookSignature(input: {
85
118
  signature: string;
86
119
  body: string;
87
120
  }): Promise<boolean>;
121
+ /**
122
+ * 리옵트와 **같은 형식으로 서명한 요청**을 만든다 — 수신 핸들러를 따로 시험할 때 쓴다(틀린 서명·오래된 시각·
123
+ * 중복 전달). 개발 에뮬레이터(`/testing`)도 등록한 주소로 보낼 때 이 함수를 쓴다.
124
+ *
125
+ * ```ts
126
+ * const request = await signWebhookRequest({
127
+ * url: "http://localhost:3000/api/webhooks/reopt",
128
+ * secret: process.env.REOPT_WEBHOOK_SECRET!,
129
+ * type: "postsChanged",
130
+ * data: { postIds: [], groupIds: [], published: [], truncated: false, version: Date.now() },
131
+ * });
132
+ * await fetch(request); // 띄워 둔 앱에 보내거나
133
+ * await POST(request); // 핸들러를 직접 부른다
134
+ * ```
135
+ */
136
+ declare function signWebhookRequest<Type extends string>(input: {
137
+ url: string;
138
+ secret: string;
139
+ type: Type;
140
+ data: Type extends WebhookEventType ? WebhookEventDataMap[Type] : unknown;
141
+ /** 사건 id — 중복 전달을 시험할 때 같은 값을 준다. 기본은 새 UUID */
142
+ id?: string;
143
+ entityType?: string;
144
+ entityId?: string;
145
+ /** 서명에 들어가는 시각(ms). 기본은 지금 — 오래된 요청의 거절을 시험할 때 옛 값을 준다 */
146
+ timestamp?: number;
147
+ }): Promise<Request>;
88
148
  /**
89
149
  * 요청 하나를 읽어 검증한다 — 서명 → 시각 → 본문 순. 통과하면 사건을, 아니면 거절 이유와 응답 상태를 돌려준다.
90
150
  * 프레임워크에 맞춰 직접 응답을 만들 때 쓴다(그대로 쓰려면 `createWebhookHandler`).
@@ -141,5 +201,5 @@ type WebhookHandlerOptions = {
141
201
  */
142
202
  declare function createWebhookHandler(options: WebhookHandlerOptions): (request: Request) => Promise<Response>;
143
203
  //#endregion
144
- export { DEFAULT_WEBHOOK_TOLERANCE_MS, ReadWebhookResult, WebhookEvent, WebhookEventDataMap, WebhookEventType, WebhookHandlerOptions, WebhookRejection, WebhookSeenStore, WorkTaskStageChangedData, createMemoryWebhookSeenStore, createWebhookHandler, readWebhook, verifyWebhookSignature };
204
+ export { DEFAULT_WEBHOOK_TOLERANCE_MS, PostsChangedData, ReadWebhookResult, WebhookEvent, WebhookEventDataMap, WebhookEventType, WebhookHandlerOptions, WebhookRejection, WebhookSeenStore, WorkTaskStageChangedData, createMemoryWebhookSeenStore, createWebhookHandler, readWebhook, signWebhookRequest, verifyWebhookSignature };
145
205
  //# sourceMappingURL=webhooks.d.ts.map
package/dist/webhooks.js CHANGED
@@ -16,6 +16,10 @@
16
16
  * if (event.data.origin === "my-app") return; // 내가 일으킨 변경
17
17
  * await syncStage(event.data);
18
18
  * },
19
+ * postsChanged: ({ data }) => {
20
+ * revalidatePath("/news"); // 글이 바뀌었다 — 캐시를 다시 굽는다
21
+ * for (const post of data.published) revalidatePath(`/news/${post.slug}`);
22
+ * },
19
23
  * },
20
24
  * });
21
25
  * ```
@@ -57,6 +61,48 @@ async function verifyWebhookSignature(input) {
57
61
  return false;
58
62
  }
59
63
  }
64
+ /**
65
+ * 리옵트와 **같은 형식으로 서명한 요청**을 만든다 — 수신 핸들러를 따로 시험할 때 쓴다(틀린 서명·오래된 시각·
66
+ * 중복 전달). 개발 에뮬레이터(`/testing`)도 등록한 주소로 보낼 때 이 함수를 쓴다.
67
+ *
68
+ * ```ts
69
+ * const request = await signWebhookRequest({
70
+ * url: "http://localhost:3000/api/webhooks/reopt",
71
+ * secret: process.env.REOPT_WEBHOOK_SECRET!,
72
+ * type: "postsChanged",
73
+ * data: { postIds: [], groupIds: [], published: [], truncated: false, version: Date.now() },
74
+ * });
75
+ * await fetch(request); // 띄워 둔 앱에 보내거나
76
+ * await POST(request); // 핸들러를 직접 부른다
77
+ * ```
78
+ */
79
+ async function signWebhookRequest(input) {
80
+ const timestamp = String(input.timestamp ?? Date.now());
81
+ const body = JSON.stringify({
82
+ id: input.id ?? crypto.randomUUID(),
83
+ type: input.type,
84
+ entityType: input.entityType ?? "workspace",
85
+ entityId: input.entityId ?? "",
86
+ createdAt: new Date(Number(timestamp)).toISOString(),
87
+ data: input.data
88
+ });
89
+ const key = await crypto.subtle.importKey("raw", encoder.encode(input.secret), {
90
+ name: "HMAC",
91
+ hash: "SHA-256"
92
+ }, false, ["sign"]);
93
+ const signature = toHex(await crypto.subtle.sign("HMAC", key, encoder.encode(`${timestamp}.${body}`)));
94
+ return new Request(input.url, {
95
+ method: "POST",
96
+ headers: {
97
+ "content-type": "application/json",
98
+ "user-agent": "reopt-webhooks/1.0",
99
+ "x-reopt-event": input.type,
100
+ "x-reopt-timestamp": timestamp,
101
+ "x-reopt-signature": `sha256=${signature}`
102
+ },
103
+ body
104
+ });
105
+ }
60
106
  function isEvent(value) {
61
107
  if (!value || typeof value !== "object") return false;
62
108
  const event = value;
@@ -195,5 +241,5 @@ function createWebhookHandler(options) {
195
241
  }
196
242
 
197
243
  //#endregion
198
- export { DEFAULT_WEBHOOK_TOLERANCE_MS, createMemoryWebhookSeenStore, createWebhookHandler, readWebhook, verifyWebhookSignature };
244
+ export { DEFAULT_WEBHOOK_TOLERANCE_MS, createMemoryWebhookSeenStore, createWebhookHandler, readWebhook, signWebhookRequest, verifyWebhookSignature };
199
245
  //# sourceMappingURL=webhooks.js.map
package/docs/testing.md CHANGED
@@ -46,6 +46,7 @@ export const OPTIONS = GET;
46
46
  | ---------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------ |
47
47
  | `/v1/connect/*` — every `ConnectClient` method | `fetch` | Tasks, posts, folders, files, forms, inquiries, customers, notifications, brands, members, app tables |
48
48
  | Machine: token, `/v1/me`, `/v1/posts` | `fetch` | Published posts only. The client assertion is not checked |
49
+ | Machine: `/v1/webhooks` | `fetch` | Register, list, delete — and `postsChanged` is **delivered** to what you register (see "Webhooks") |
49
50
  | Signed file addresses, public file bytes | `handler` | `…/v1/signed/files/:token`, `…/api/blob/:id` |
50
51
  | Public form: definition and submit | `handler` | `…/api/brandfront/forms/:id` and `/submit` (CORS, 422 `fieldErrors`) — use `createPublicFormClient({ studioUrl })` |
51
52
 
@@ -61,7 +62,8 @@ Notifications come from the seed only (`seed.notifications: [{ kind, content, ta
61
62
  kinds show follows the same rule as the server (`me.permissions` and `me.scopes`).
62
63
 
63
64
  **It does not imitate** authentication (tokens are not checked), per-folder access, rate limits,
64
- webhook delivery or workflows. It refuses to start when `NODE_ENV` is `production`.
65
+ `workTaskStageChanged` deliveries, delivery retries or workflows. It refuses to start when
66
+ `NODE_ENV` is `production`.
65
67
 
66
68
  The same scenario code runs against this emulator and against Reopt's real routes with a real
67
69
  database, so the shapes above cannot drift apart silently.
@@ -145,6 +147,48 @@ stage (where new tasks and submissions land — the first stage otherwise), sele
145
147
  A seed that points at a key that does not exist, or repeats a post slug, throws when the platform
146
148
  is created.
147
149
 
150
+ ## Webhooks
151
+
152
+ Register an address with the machine client, exactly as against Reopt, and the emulator sends
153
+ `postsChanged` to it — signed the way Reopt signs, so your real handler verifies it:
154
+
155
+ ```ts
156
+ await platform.webhooks.upsert({
157
+ url: "http://localhost:3000/api/webhooks/reopt",
158
+ triggers: ["postsChanged"],
159
+ secret: process.env.REOPT_WEBHOOK_SECRET!,
160
+ });
161
+
162
+ await reopt.posts.publish(postId); // → POST http://localhost:3000/api/webhooks/reopt
163
+ ```
164
+
165
+ As on the real platform, the event follows every post write that goes through the delegated
166
+ surface (create, update, publish, unpublish, delete) — including the ones your own admin screens
167
+ make. Reads and refused writes send nothing.
168
+
169
+ | Member | What it does |
170
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------- |
171
+ | `devPlatform.emitPostsChanged()` | Sends the event without changing anything — "someone published in Studio". Takes `{ postIds, groupIds }` |
172
+ | `devPlatform.settled()` | Resolves when the deliveries in flight are done — await it in a test before looking at the result |
173
+ | `devPlatform.webhookDeliveries` | What was sent: `{ url, type, status }`, or `status: null` with `error` when the receiver was unreachable |
174
+ | `options.webhooks.fetch` | Send through this instead of the global `fetch` — in a test, point it straight at your handler |
175
+
176
+ ```ts
177
+ // A test with no server: deliveries go straight to the route handler
178
+ import { POST } from "@/app/api/webhooks/reopt/route";
179
+
180
+ const devPlatform = createDevPlatform({
181
+ seed,
182
+ webhooks: { fetch: async (input, init) => POST(new Request(input, init)) },
183
+ });
184
+ ```
185
+
186
+ Registration follows the server's rules: a new address needs a secret (16+ characters), and each
187
+ trigger needs the scope of the data behind it — `postsChanged` needs `posts:read`,
188
+ `workTaskStageChanged` needs `works:write` (`machine.scopes`, default `["posts:read"]`). A
189
+ receiver that is down does not fail the write; the failure is in `webhookDeliveries`. There are no
190
+ retries here.
191
+
148
192
  ## Options
149
193
 
150
194
  | Option | What it does |
@@ -153,12 +197,14 @@ is created.
153
197
  | `me` | `{ permissions, scopes }` — narrow them and calls are refused with 403 `FORBIDDEN` / `INSUFFICIENT_SCOPE` by the same table as `canCall` |
154
198
  | `browserBaseUrl` | Where signed addresses, public file addresses and form submits point — your `handler` route |
155
199
  | `now` | Fixed clock. Ids are always deterministic; with `now`, timestamps are too (stable snapshots) |
156
- | `machine` | `{ clientName }` — what `/v1/me` answers on the machine surface |
200
+ | `machine` | `{ clientName, scopes }` — what `/v1/me` answers on the machine surface; `scopes` decide which webhook triggers can be registered |
201
+ | `webhooks` | `{ fetch }` — how webhook deliveries are sent (default: the global `fetch`) |
157
202
  | `latencyMs` | Delay every answer — to see loading states |
158
203
  | `fail` | `{ "GET /files": 500 }` — force a status on a route (connect paths without `/v1/connect`) |
159
204
  | `limits` | `{ storageBytes, uploadBytes }` — to exercise `QUOTA_EXCEEDED` and 413 |
160
205
 
161
- `devPlatform.reset()` returns to the seed (between tests — no dev-server restart).
206
+ `devPlatform.reset()` returns to the seed (between tests — no dev-server restart); registered
207
+ webhooks are not part of the seed, so it clears them too.
162
208
  `devPlatform.requests` lists what was called — the most recent 1,000 — (`"GET /files?folderId=all&limit=100"`), for
163
209
  asserting on request counts.
164
210
 
package/docs/workspace.md CHANGED
@@ -158,6 +158,77 @@ public `coverImage.url`. `contentRich` is opt-editor's canonical spec — render
158
158
 
159
159
  `me()` answers `brandappId: null` and `defaultBrandId: null` for a workspace app.
160
160
 
161
+ ### Hearing about changes — `postsChanged`
162
+
163
+ A public site caches what it reads, so a post published in Studio shows up only when the cache
164
+ expires. Subscribe to `postsChanged` and revalidate instead (the credential needs `posts:read`):
165
+
166
+ ```ts
167
+ await platform.webhooks.upsert({
168
+ url: "https://your-app.example/api/webhooks/reopt",
169
+ triggers: ["postsChanged"],
170
+ secret: process.env.REOPT_WEBHOOK_SECRET!,
171
+ });
172
+ ```
173
+
174
+ ```ts
175
+ // app/api/webhooks/reopt/route.ts
176
+ import { revalidatePath } from "next/cache";
177
+ import { createWebhookHandler } from "@reopt-ai/workspace-sdk/webhooks";
178
+
179
+ export const POST = createWebhookHandler({
180
+ secret: process.env.REOPT_WEBHOOK_SECRET!,
181
+ handlers: {
182
+ postsChanged: () => {
183
+ revalidatePath("/news", "layout"); // the list and every post page under it
184
+ },
185
+ },
186
+ });
187
+ ```
188
+
189
+ The event means **"read again"**, not "this is what changed". One event covers everything a
190
+ request changed — publish, an edit to a published post, unpublish, delete, reorder, tags, group
191
+ settings — and it can also arrive for a change that touched only drafts.
192
+
193
+ | `data` field | What it holds |
194
+ | ------------ | -------------------------------------------------------------------------------------------------------------------- |
195
+ | `postIds` | Ids of the posts that changed (up to 100). Deleted posts and drafts are listed too — ids only |
196
+ | `groupIds` | Ids of the post groups that changed (up to 100). Deleting a whole group or brand sends these without post ids |
197
+ | `published` | Those of `postIds` that are published **now**, as `{ id, groupId, slug }` |
198
+ | `truncated` | `true` when more than 100 ids changed — revalidate everything, not address by address |
199
+ | `version` | When it was sent (ms). For ordering only: do not drop an event because its `version` is older (dedupe on `event.id`) |
200
+
201
+ A post that was unpublished or deleted is in `postIds` but not in `published`, and its old address
202
+ is not in the event — so revalidate the list together with what is under it
203
+ (`revalidatePath("/news", "layout")`) rather than relying on per-post paths. Keep a cache lifetime
204
+ as the backstop: the event is sent after the change is saved rather than with it, deliveries are
205
+ retried for about 17 hours, and a receiver that was down longer than that misses the event.
206
+
207
+ Only the credential that registered a webhook (or one of the same installation) can list, change
208
+ or delete it; `workspace:admin` sees all of the workspace's platform webhooks. An address
209
+ registered by someone else answers 403 instead of being overwritten.
210
+
211
+ To exercise the handler on its own — a unit test, a
212
+ rejected signature, a replay — sign a request yourself:
213
+
214
+ ```ts
215
+ import { signWebhookRequest } from "@reopt-ai/workspace-sdk/webhooks";
216
+
217
+ const request = await signWebhookRequest({
218
+ url: "http://localhost:3000/api/webhooks/reopt",
219
+ secret: process.env.REOPT_WEBHOOK_SECRET!,
220
+ type: "postsChanged",
221
+ data: {
222
+ postIds: [],
223
+ groupIds: [],
224
+ published: [],
225
+ truncated: false,
226
+ version: Date.now(),
227
+ },
228
+ });
229
+ await fetch(request); // or: await POST(request)
230
+ ```
231
+
161
232
  ## Delegated access — a workspace app's staff (RFC-0043)
162
233
 
163
234
  The machine client above acts as the app. When a **person** works in a workspace app (an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reopt-ai/workspace-sdk",
3
- "version": "0.1.0-rc.14",
3
+ "version": "0.1.0-rc.15",
4
4
  "description": "Reopt workspace SDK — platform API, delegated (connect) access, machine credentials and installations for workspace apps",
5
5
  "author": "Reopt",
6
6
  "license": "MIT",