@reopt-ai/workspace-sdk 0.1.0-rc.0 → 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +4 -2
- package/dist/{client-BUatgjlv.js → client-Bm8YrIx2.js} +50 -5
- package/dist/{client-C5qUNFSq.d.ts → client-CwInApBf.d.ts} +8 -2
- package/dist/index.d.ts +52 -2
- package/dist/index.js +38 -2
- package/dist/installation/index.d.ts +31 -5
- package/dist/installation/index.js +41 -14
- package/dist/social/index.d.ts +1 -1
- package/dist/social/index.js +1 -1
- package/docs/installation.md +20 -9
- package/docs/workspace.md +30 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,30 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.0-rc.1] — 2026-11-20
|
|
11
|
+
|
|
12
|
+
Pre-release (`npm i @reopt-ai/workspace-sdk@next`).
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **워크스페이스 앱 소유 테이블**(RFC-0043 5단계) — `connect.eav.{listEntities,listRecords,createRecord,updateRecord,deleteRecord}`.
|
|
17
|
+
값은 속성 이름 키, 수정은 `ifVersion` CAS. 테이블 선언은 앱의 기계 자격 `platform.eav.applySchema({ operations })` —
|
|
18
|
+
워크스페이스 앱 자격은 본문에 `brandapp`을 적지 않으면 자기 설치 네임스페이스에 적용된다. `connectEav{Entity,Record}Schema`.
|
|
19
|
+
- **공개키 등록 요청**(RFC-0043 §8 Q6) — `connection.registerKeys()`, 연결 상태 `primaryAction: "register-keys"`·문구
|
|
20
|
+
"공개키 등록 n/m". `client.refreshJwks(id, { auth })`의 기본 인증이 **설치 단언**이 됐고(등록 전 앱은 기계 토큰을 받을 수
|
|
21
|
+
없다) 응답에 `registered`가 실린다. 게시한 JWKS가 거절되면 `PlatformApiError` code `JWKS_REJECTED`(422).
|
|
22
|
+
- `PLATFORM_EAV_DATA_TYPES`·`PlatformEavDataType` — EAV 속성 값 타입 목록(리옵트 DB enum과 같은 집합).
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- EAV 속성 연산(`addAttribute.def`·`updateAttribute.changes`)이 `dataType`을 목록으로, `label`을 빈 값 아님으로 검사한다 —
|
|
27
|
+
`addAttribute`는 둘 다 필수. 예전엔 서버까지 가서 500(없는 타입)으로 죽었다. 서버도 이제 400 `VALIDATION_ERROR`로 답한다.
|
|
28
|
+
- 키 회전 마법사 문구 — 각 배포 뒤 `registerKeys()`를 부르면 리옵트 캐시를 기다리지 않는다.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- README가 `.`에 필요한 optional peer `@better-auth/core`를 빠뜨렸다(`/machine`·`/resource`만 적혀 있었다).
|
|
33
|
+
|
|
10
34
|
## [0.1.0-rc.0] — 2026-11-20
|
|
11
35
|
|
|
12
36
|
Pre-release (`npm i @reopt-ai/workspace-sdk@next`). First release — split out of `@reopt-ai/brandapp-sdk`
|
package/README.md
CHANGED
|
@@ -11,10 +11,12 @@ a company site, a service that files work into Studio) rather than being one bra
|
|
|
11
11
|
- **Installations** (`/installation`) — declare, sign and request your app's connection.
|
|
12
12
|
- **Resource verifier** (`/resource`), **social operations** (`/social`), **id host resolution** (`/urls`).
|
|
13
13
|
|
|
14
|
-
Server-only (it holds private keys and tokens).
|
|
14
|
+
Server-only (it holds private keys and tokens). Optional peers: `zod` for `.`, `/social` and
|
|
15
|
+
`/installation`; `@better-auth/core` for `.`, `/machine` and `/resource` (the platform client signs
|
|
16
|
+
DPoP proofs with it). `/urls` needs neither.
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
npm i @reopt-ai/workspace-sdk zod
|
|
19
|
+
npm i @reopt-ai/workspace-sdk zod @better-auth/core
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
```ts
|
|
@@ -4,7 +4,7 @@ import { z } from "zod";
|
|
|
4
4
|
|
|
5
5
|
//#region src/version.ts
|
|
6
6
|
/** 이 패키지(`@reopt-ai/workspace-sdk`)의 버전 — 빌드가 package.json에서 주입한다(미번들 실행은 `0.0.0-dev`). */
|
|
7
|
-
const SDK_VERSION = "0.1.0-rc.
|
|
7
|
+
const SDK_VERSION = "0.1.0-rc.1";
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/workspace/schemas.ts
|
|
@@ -415,6 +415,51 @@ const platformEavBrandappResourcesSchema = z.object({
|
|
|
415
415
|
entities: z.array(platformEavEntityResourceSchema)
|
|
416
416
|
});
|
|
417
417
|
const eavName = z.string().trim().min(1).max(100);
|
|
418
|
+
/**
|
|
419
|
+
* EAV 속성의 값 타입 — 리옵트 DB enum(`EavDataType`)과 같은 집합이다(`platform-sdk-parity.test.ts`가 대조).
|
|
420
|
+
* 서버도 같은 판정을 하지만 SDK가 먼저 막으면 호출이 나가지 않는다.
|
|
421
|
+
*/
|
|
422
|
+
const PLATFORM_EAV_DATA_TYPES = [
|
|
423
|
+
"string",
|
|
424
|
+
"textarea",
|
|
425
|
+
"number",
|
|
426
|
+
"boolean",
|
|
427
|
+
"date",
|
|
428
|
+
"email",
|
|
429
|
+
"url",
|
|
430
|
+
"select",
|
|
431
|
+
"multiselect",
|
|
432
|
+
"file"
|
|
433
|
+
];
|
|
434
|
+
const eavDataTypeSet = new Set(PLATFORM_EAV_DATA_TYPES);
|
|
435
|
+
/** 속성 정의(def·changes)는 열린 객체지만 `dataType`·`label`은 모양을 본다 — 틀리면 서버까지 가지 않는다. */
|
|
436
|
+
function eavAttributeFields(options) {
|
|
437
|
+
return z.record(z.string(), z.unknown()).superRefine((value, ctx) => {
|
|
438
|
+
const { dataType, label } = value;
|
|
439
|
+
if (dataType !== void 0 && (typeof dataType !== "string" || !eavDataTypeSet.has(dataType))) ctx.addIssue({
|
|
440
|
+
code: "custom",
|
|
441
|
+
path: ["dataType"],
|
|
442
|
+
message: `dataType must be one of: ${PLATFORM_EAV_DATA_TYPES.join(", ")}`
|
|
443
|
+
});
|
|
444
|
+
if (label !== void 0 && (typeof label !== "string" || label.trim() === "")) ctx.addIssue({
|
|
445
|
+
code: "custom",
|
|
446
|
+
path: ["label"],
|
|
447
|
+
message: "label must be a non-empty string"
|
|
448
|
+
});
|
|
449
|
+
if (options.requireLabelAndType) {
|
|
450
|
+
if (dataType === void 0) ctx.addIssue({
|
|
451
|
+
code: "custom",
|
|
452
|
+
path: ["dataType"],
|
|
453
|
+
message: "dataType is required"
|
|
454
|
+
});
|
|
455
|
+
if (label === void 0) ctx.addIssue({
|
|
456
|
+
code: "custom",
|
|
457
|
+
path: ["label"],
|
|
458
|
+
message: "label is required"
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
418
463
|
const platformEavSchemaOperationSchema = z.discriminatedUnion("kind", [
|
|
419
464
|
z.object({
|
|
420
465
|
kind: z.literal("addEntity"),
|
|
@@ -441,13 +486,13 @@ const platformEavSchemaOperationSchema = z.discriminatedUnion("kind", [
|
|
|
441
486
|
kind: z.literal("addAttribute"),
|
|
442
487
|
entity: eavName,
|
|
443
488
|
name: eavName,
|
|
444
|
-
def:
|
|
489
|
+
def: eavAttributeFields({ requireLabelAndType: true })
|
|
445
490
|
}).strict(),
|
|
446
491
|
z.object({
|
|
447
492
|
kind: z.literal("updateAttribute"),
|
|
448
493
|
entity: eavName,
|
|
449
494
|
name: eavName,
|
|
450
|
-
changes:
|
|
495
|
+
changes: eavAttributeFields({ requireLabelAndType: false })
|
|
451
496
|
}).strict(),
|
|
452
497
|
z.object({
|
|
453
498
|
kind: z.literal("removeAttribute"),
|
|
@@ -786,5 +831,5 @@ function createPlatformClient(config) {
|
|
|
786
831
|
}
|
|
787
832
|
|
|
788
833
|
//#endregion
|
|
789
|
-
export {
|
|
790
|
-
//# sourceMappingURL=client-
|
|
834
|
+
export { platformTaskStageInputSchema as $, platformEavSchemaApplyResultSchema as A, platformPipelineImportInputSchema as B, platformBrandUpsertInputSchema as C, platformEavBrandappResourcesSchema as D, platformCustomerUpsertInputSchema as E, platformLockReleasedSchema as F, platformPublishedPostListQuerySchema as G, platformPipelineSchema as H, platformMeSchema as I, platformPublishedPostSummarySchema as J, platformPublishedPostPageSchema as K, platformOAuthClientImportInputSchema as L, platformErrorSchema as M, platformExternalIdSchema as N, platformEavEntityResourceSchema as O, platformLockAcquiredSchema as P, platformTaskSchema as Q, platformOAuthClientResourceSchema as R, platformBrandResourceSchema as S, platformBrandappUpsertInputSchema as T, platformPipelineStageInputSchema as U, platformPipelineResourceSchema as V, platformPipelineUpsertInputSchema as W, platformResourcesSchema as X, platformResourceKeySchema as Y, platformResourcesV2Schema as Z, PLATFORM_TASK_OUTCOMES as _, createPlatformClient as a, platformWorkTaskStageChangedEventSchema as at, PLATFORM_WEBHOOK_TRIGGERS as b, PLATFORM_ADMIN_SCOPE as c, PLATFORM_EAV_DATA_TYPES as d, platformTaskStageSchema as et, PLATFORM_MANAGED_BY_VALUES as f, PLATFORM_STAGE_COLORS as g, PLATFORM_OAUTH_GRANT_TYPES as h, REOPT_PLATFORM_URLS as i, platformWebhookUpsertInputSchema as it, platformEavSchemaOperationSchema as j, platformEavSchemaApplyInputSchema as k, PLATFORM_BRANDAPP_STATUSES as l, PLATFORM_OAUTH_CLIENT_PURPOSES as m, PlatformApiError as n, platformWebhookResourceSchema as nt, createPlatformRequester as o, platformWriteMetaSchema as ot, PLATFORM_OAUTH_APPLICATION_TYPES as p, platformPublishedPostSchema as q, REOPT_PLATFORM_ID_URLS as r, platformWebhookSchema as rt, resolvePlatformUrls as s, SDK_VERSION as st, DEFAULT_PLATFORM_SCOPES as t, platformTaskUpsertInputSchema as tt, PLATFORM_DOMAIN_STATUSES as u, PLATFORM_TASK_PRIORITIES as v, platformBrandappResourceSchema as w, platformBrandImportInputSchema as x, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS as y, platformOAuthClientUpsertInputSchema as z };
|
|
835
|
+
//# sourceMappingURL=client-Bm8YrIx2.js.map
|
|
@@ -534,6 +534,12 @@ declare const platformOAuthClientImportInputSchema: z.ZodType<PlatformOAuthClien
|
|
|
534
534
|
declare const platformOAuthClientResourceSchema: z.ZodType<PlatformOAuthClientResource>;
|
|
535
535
|
declare const platformEavEntityResourceSchema: z.ZodType<PlatformEavEntityResource>;
|
|
536
536
|
declare const platformEavBrandappResourcesSchema: z.ZodType<PlatformEavBrandappResources>;
|
|
537
|
+
/**
|
|
538
|
+
* EAV 속성의 값 타입 — 리옵트 DB enum(`EavDataType`)과 같은 집합이다(`platform-sdk-parity.test.ts`가 대조).
|
|
539
|
+
* 서버도 같은 판정을 하지만 SDK가 먼저 막으면 호출이 나가지 않는다.
|
|
540
|
+
*/
|
|
541
|
+
declare const PLATFORM_EAV_DATA_TYPES: readonly ["string", "textarea", "number", "boolean", "date", "email", "url", "select", "multiselect", "file"];
|
|
542
|
+
type PlatformEavDataType = (typeof PLATFORM_EAV_DATA_TYPES)[number];
|
|
537
543
|
declare const platformEavSchemaOperationSchema: z.ZodType<PlatformEavSchemaOperation>;
|
|
538
544
|
declare const platformEavSchemaApplyInputSchema: z.ZodType<PlatformEavSchemaApplyInput>;
|
|
539
545
|
declare const platformEavSchemaApplyResultSchema: z.ZodType<PlatformEavSchemaApplyResult>;
|
|
@@ -704,5 +710,5 @@ type PlatformClient = {
|
|
|
704
710
|
};
|
|
705
711
|
declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
|
|
706
712
|
//#endregion
|
|
707
|
-
export {
|
|
708
|
-
//# sourceMappingURL=client-
|
|
713
|
+
export { PlatformPublishedPostPage as $, platformWebhookUpsertInputSchema as $t, PlatformDomainStatus as A, platformLockReleasedSchema as At, PlatformManagedBy as B, platformPublishedPostListQuerySchema as Bt, PLATFORM_WEBHOOK_TRIGGERS as C, platformEavEntityResourceSchema as Ct, PlatformBrandappResource as D, platformErrorSchema as Dt, PlatformBrandUpsertInput as E, platformEavSchemaOperationSchema as Et, PlatformEavSchemaApplyResult as F, platformPipelineImportInputSchema as Ft, PlatformOAuthClientUpsertInput as G, platformResourcesSchema as Gt, PlatformOAuthClientImportInput as H, platformPublishedPostSchema as Ht, PlatformEavSchemaOperation as I, platformPipelineResourceSchema as It, PlatformPipelineResource as J, platformTaskStageInputSchema as Jt, PlatformPipeline as K, platformResourcesV2Schema as Kt, PlatformErrorBody as L, platformPipelineSchema as Lt, PlatformEavDataType as M, platformOAuthClientImportInputSchema as Mt, PlatformEavEntityResource as N, platformOAuthClientResourceSchema as Nt, PlatformBrandappUpsertInput as O, platformExternalIdSchema as Ot, PlatformEavSchemaApplyInput as P, platformOAuthClientUpsertInputSchema as Pt, PlatformPublishedPostListOptions as Q, platformWebhookSchema as Qt, PlatformLockAcquired as R, platformPipelineStageInputSchema as Rt, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS as S, platformEavBrandappResourcesSchema as St, PlatformBrandResource as T, platformEavSchemaApplyResultSchema as Tt, PlatformOAuthClientPurpose as U, platformPublishedPostSummarySchema as Ut, PlatformMe as V, platformPublishedPostPageSchema as Vt, PlatformOAuthClientResource as W, platformResourceKeySchema as Wt, PlatformPipelineUpsertInput as X, platformTaskUpsertInputSchema as Xt, PlatformPipelineStageInput as Y, platformTaskStageSchema as Yt, PlatformPublishedPost as Z, platformWebhookResourceSchema as Zt, PLATFORM_OAUTH_CLIENT_PURPOSES as _, platformBrandResourceSchema as _t, PlatformUrls as a, PlatformTaskOutcome as at, PLATFORM_TASK_OUTCOMES as b, platformBrandappUpsertInputSchema as bt, REOPT_PLATFORM_URLS as c, PlatformTaskStageInput as ct, PLATFORM_ADMIN_SCOPE as d, PlatformWebhookResource as dt, platformWorkTaskStageChangedEventSchema as en, PlatformPublishedPostSummary as et, PLATFORM_BRANDAPP_STATUSES as f, PlatformWebhookTrigger as ft, PLATFORM_OAUTH_APPLICATION_TYPES as g, platformBrandImportInputSchema as gt, PLATFORM_MANAGED_BY_VALUES as h, PlatformWriteMeta as ht, PlatformClientConfig as i, PlatformTask as it, PlatformEavBrandappResources as j, platformMeSchema as jt, PlatformCustomerUpsertInput as k, platformLockAcquiredSchema as kt, createPlatformClient as l, PlatformTaskUpsertInput as lt, PLATFORM_EAV_DATA_TYPES as m, PlatformWorkTaskStageChangedEvent as mt, PlatformApiError as n, PlatformResourcesV2 as nt, PlatformWriteResult as o, PlatformTaskPriority as ot, PLATFORM_DOMAIN_STATUSES as p, PlatformWebhookUpsertInput as pt, PlatformPipelineImportInput as q, platformTaskSchema as qt, PlatformClient as r, PlatformStageColor as rt, REOPT_PLATFORM_ID_URLS as s, PlatformTaskStage as st, DEFAULT_PLATFORM_SCOPES as t, platformWriteMetaSchema as tn, PlatformResources as tt, resolvePlatformUrls as u, PlatformWebhook as ut, PLATFORM_OAUTH_GRANT_TYPES as v, platformBrandUpsertInputSchema as vt, PlatformBrandImportInput as w, platformEavSchemaApplyInputSchema as wt, PLATFORM_TASK_PRIORITIES as x, platformCustomerUpsertInputSchema as xt, PLATFORM_STAGE_COLORS as y, platformBrandappResourceSchema as yt, PlatformLockReleased as z, platformPipelineUpsertInputSchema as zt };
|
|
714
|
+
//# sourceMappingURL=client-CwInApBf.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as PlatformPublishedPostPage, $t as platformWebhookUpsertInputSchema, A as PlatformDomainStatus, At as platformLockReleasedSchema, B as PlatformManagedBy, Bt as platformPublishedPostListQuerySchema, C as PLATFORM_WEBHOOK_TRIGGERS, Ct as platformEavEntityResourceSchema, D as PlatformBrandappResource, Dt as platformErrorSchema, E as PlatformBrandUpsertInput, Et as platformEavSchemaOperationSchema, F as PlatformEavSchemaApplyResult, Ft as platformPipelineImportInputSchema, G as PlatformOAuthClientUpsertInput, Gt as platformResourcesSchema, H as PlatformOAuthClientImportInput, Ht as platformPublishedPostSchema, I as PlatformEavSchemaOperation, It as platformPipelineResourceSchema, J as PlatformPipelineResource, Jt as platformTaskStageInputSchema, K as PlatformPipeline, Kt as platformResourcesV2Schema, L as PlatformErrorBody, Lt as platformPipelineSchema, M as PlatformEavDataType, Mt as platformOAuthClientImportInputSchema, N as PlatformEavEntityResource, Nt as platformOAuthClientResourceSchema, O as PlatformBrandappUpsertInput, Ot as platformExternalIdSchema, P as PlatformEavSchemaApplyInput, Pt as platformOAuthClientUpsertInputSchema, Q as PlatformPublishedPostListOptions, Qt as platformWebhookSchema, R as PlatformLockAcquired, Rt as platformPipelineStageInputSchema, S as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, St as platformEavBrandappResourcesSchema, T as PlatformBrandResource, Tt as platformEavSchemaApplyResultSchema, U as PlatformOAuthClientPurpose, Ut as platformPublishedPostSummarySchema, V as PlatformMe, Vt as platformPublishedPostPageSchema, W as PlatformOAuthClientResource, Wt as platformResourceKeySchema, X as PlatformPipelineUpsertInput, Xt as platformTaskUpsertInputSchema, Y as PlatformPipelineStageInput, Yt as platformTaskStageSchema, Z as PlatformPublishedPost, Zt as platformWebhookResourceSchema, _ as PLATFORM_OAUTH_CLIENT_PURPOSES, _t as platformBrandResourceSchema, a as PlatformUrls, at as PlatformTaskOutcome, b as PLATFORM_TASK_OUTCOMES, bt as platformBrandappUpsertInputSchema, c as REOPT_PLATFORM_URLS, ct as PlatformTaskStageInput, d as PLATFORM_ADMIN_SCOPE, dt as PlatformWebhookResource, en as platformWorkTaskStageChangedEventSchema, et as PlatformPublishedPostSummary, f as PLATFORM_BRANDAPP_STATUSES, ft as PlatformWebhookTrigger, g as PLATFORM_OAUTH_APPLICATION_TYPES, gt as platformBrandImportInputSchema, h as PLATFORM_MANAGED_BY_VALUES, ht as PlatformWriteMeta, i as PlatformClientConfig, it as PlatformTask, j as PlatformEavBrandappResources, jt as platformMeSchema, k as PlatformCustomerUpsertInput, kt as platformLockAcquiredSchema, l as createPlatformClient, lt as PlatformTaskUpsertInput, m as PLATFORM_EAV_DATA_TYPES, mt as PlatformWorkTaskStageChangedEvent, n as PlatformApiError, nt as PlatformResourcesV2, o as PlatformWriteResult, ot as PlatformTaskPriority, p as PLATFORM_DOMAIN_STATUSES, pt as PlatformWebhookUpsertInput, q as PlatformPipelineImportInput, qt as platformTaskSchema, r as PlatformClient, rt as PlatformStageColor, s as REOPT_PLATFORM_ID_URLS, st as PlatformTaskStage, t as DEFAULT_PLATFORM_SCOPES, tn as platformWriteMetaSchema, tt as PlatformResources, u as resolvePlatformUrls, ut as PlatformWebhook, v as PLATFORM_OAUTH_GRANT_TYPES, vt as platformBrandUpsertInputSchema, w as PlatformBrandImportInput, wt as platformEavSchemaApplyInputSchema, x as PLATFORM_TASK_PRIORITIES, xt as platformCustomerUpsertInputSchema, y as PLATFORM_STAGE_COLORS, yt as platformBrandappResourceSchema, z as PlatformLockReleased, zt as platformPipelineUpsertInputSchema } from "./client-CwInApBf.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/workspace/connect.d.ts
|
|
4
4
|
/**
|
|
@@ -185,6 +185,31 @@ type ConnectInquiry = {
|
|
|
185
185
|
multiline: boolean;
|
|
186
186
|
}>;
|
|
187
187
|
};
|
|
188
|
+
/** 워크스페이스 앱이 소유한 테이블(RFC-0043 5단계) — 선언은 앱의 기계 자격이 `platform.eav.applySchema`로 한다 */
|
|
189
|
+
type ConnectEavEntity = {
|
|
190
|
+
id: string;
|
|
191
|
+
name: string;
|
|
192
|
+
description: string | null;
|
|
193
|
+
icon: string | null;
|
|
194
|
+
linkedTo: string;
|
|
195
|
+
attributes: Array<{
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
label: string;
|
|
199
|
+
dataType: string;
|
|
200
|
+
isRequired: boolean;
|
|
201
|
+
isUnique: boolean;
|
|
202
|
+
}>;
|
|
203
|
+
recordCount: number;
|
|
204
|
+
};
|
|
205
|
+
/** 레코드 — 값은 **속성 이름** 키다. `version`은 수정 때 `ifVersion`으로 돌려준다 */
|
|
206
|
+
type ConnectEavRecord = {
|
|
207
|
+
id: string;
|
|
208
|
+
values: Record<string, unknown>;
|
|
209
|
+
version: number;
|
|
210
|
+
createdAt: string;
|
|
211
|
+
updatedAt: string;
|
|
212
|
+
};
|
|
188
213
|
type ConnectTaskListQuery = {
|
|
189
214
|
pipelineId?: string;
|
|
190
215
|
stageId?: string;
|
|
@@ -246,6 +271,8 @@ declare const connectFolderSchema: z.ZodType<ConnectFolder>;
|
|
|
246
271
|
declare const connectFileSchema: z.ZodType<ConnectFile>;
|
|
247
272
|
declare const connectFormSchema: z.ZodType<ConnectForm>;
|
|
248
273
|
declare const connectInquirySchema: z.ZodType<ConnectInquiry>;
|
|
274
|
+
declare const connectEavEntitySchema: z.ZodType<ConnectEavEntity>;
|
|
275
|
+
declare const connectEavRecordSchema: z.ZodType<ConnectEavRecord>;
|
|
249
276
|
type ConnectClient = {
|
|
250
277
|
me: () => Promise<ConnectMe>;
|
|
251
278
|
members: () => Promise<ConnectMember[]>;
|
|
@@ -342,9 +369,32 @@ type ConnectClient = {
|
|
|
342
369
|
toStageLabel: string;
|
|
343
370
|
}>;
|
|
344
371
|
};
|
|
372
|
+
/**
|
|
373
|
+
* 워크스페이스 앱이 소유한 테이블(RFC-0043 5단계). 이 연결 클라이언트의 설치가 소유한 테이블만 보인다 — 다른 앱·브랜드앱의
|
|
374
|
+
* 테이블 경로는 404. 쓰기 거절: 값 검증 400(`fields`는 속성 이름), 고유값·`ifVersion` 불일치·개수 상한 409.
|
|
375
|
+
*/
|
|
376
|
+
eav: {
|
|
377
|
+
listEntities: () => Promise<ConnectEavEntity[]>;
|
|
378
|
+
listRecords: (entityId: string, page?: {
|
|
379
|
+
limit?: number;
|
|
380
|
+
offset?: number;
|
|
381
|
+
}) => Promise<{
|
|
382
|
+
records: ConnectEavRecord[];
|
|
383
|
+
nextOffset: number | null;
|
|
384
|
+
}>;
|
|
385
|
+
createRecord: (entityId: string, values: Record<string, unknown>) => Promise<ConnectEavRecord>;
|
|
386
|
+
updateRecord: (entityId: string, recordId: string, input: {
|
|
387
|
+
values: Record<string, unknown>;
|
|
388
|
+
ifVersion?: number;
|
|
389
|
+
}) => Promise<ConnectEavRecord>;
|
|
390
|
+
deleteRecord: (entityId: string, recordId: string) => Promise<{
|
|
391
|
+
id: string;
|
|
392
|
+
deleted: boolean;
|
|
393
|
+
}>;
|
|
394
|
+
};
|
|
345
395
|
platformUrl: string;
|
|
346
396
|
};
|
|
347
397
|
declare function createConnectClient(config: ConnectClientConfig): ConnectClient;
|
|
348
398
|
//#endregion
|
|
349
|
-
export { type ConnectAccessToken, type ConnectClient, type ConnectClientConfig, type ConnectFile, type ConnectFolder, type ConnectForm, type ConnectInquiry, type ConnectMe, type ConnectMember, type ConnectPipeline, type ConnectPost, type ConnectPostCreateInput, type ConnectPostGroup, type ConnectPostSpec, type ConnectPostStatus, type ConnectPostSummary, type ConnectPostUpdateInput, type ConnectStageOutcome, type ConnectTask, type ConnectTaskCreateInput, type ConnectTaskListQuery, type ConnectTaskMoveInput, type ConnectTaskPriority, type ConnectTaskUpdateInput, DEFAULT_PLATFORM_SCOPES, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, 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, type PlatformBrandImportInput, type PlatformBrandResource, type PlatformBrandUpsertInput, type PlatformBrandappResource, type PlatformBrandappUpsertInput, type PlatformClient, type PlatformClientConfig, type PlatformCustomerUpsertInput, type PlatformDomainStatus, type PlatformEavBrandappResources, type PlatformEavEntityResource, type PlatformEavSchemaApplyInput, type PlatformEavSchemaApplyResult, type PlatformEavSchemaOperation, type PlatformErrorBody, 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 PlatformPublishedPostListOptions, type PlatformPublishedPostPage, type PlatformPublishedPostSummary, type PlatformResources, type PlatformResourcesV2, 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, connectFileSchema, connectFolderSchema, connectFormSchema, connectInquirySchema, connectMeSchema, connectMemberSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectTaskSchema, createConnectClient, createPlatformClient, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformPublishedPostListQuerySchema, platformPublishedPostPageSchema, platformPublishedPostSchema, platformPublishedPostSummarySchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls };
|
|
399
|
+
export { type ConnectAccessToken, type ConnectClient, type ConnectClientConfig, type ConnectEavEntity, type ConnectEavRecord, type ConnectFile, type ConnectFolder, type ConnectForm, type ConnectInquiry, type ConnectMe, type ConnectMember, type ConnectPipeline, type ConnectPost, type ConnectPostCreateInput, type ConnectPostGroup, type ConnectPostSpec, type ConnectPostStatus, type ConnectPostSummary, type ConnectPostUpdateInput, type ConnectStageOutcome, type ConnectTask, type ConnectTaskCreateInput, type ConnectTaskListQuery, type ConnectTaskMoveInput, type ConnectTaskPriority, type ConnectTaskUpdateInput, DEFAULT_PLATFORM_SCOPES, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, PLATFORM_EAV_DATA_TYPES, 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, 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 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 PlatformPublishedPostListOptions, type PlatformPublishedPostPage, type PlatformPublishedPostSummary, type PlatformResources, type PlatformResourcesV2, 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, connectEavEntitySchema, connectEavRecordSchema, connectFileSchema, connectFolderSchema, connectFormSchema, connectInquirySchema, connectMeSchema, connectMemberSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectTaskSchema, createConnectClient, createPlatformClient, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformPublishedPostListQuerySchema, platformPublishedPostPageSchema, platformPublishedPostSchema, platformPublishedPostSummarySchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls };
|
|
350
400
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as platformTaskStageInputSchema, A as platformEavSchemaApplyResultSchema, B as platformPipelineImportInputSchema, C as platformBrandUpsertInputSchema, D as platformEavBrandappResourcesSchema, E as platformCustomerUpsertInputSchema, F as platformLockReleasedSchema, G as platformPublishedPostListQuerySchema, H as platformPipelineSchema, I as platformMeSchema, J as platformPublishedPostSummarySchema, K as platformPublishedPostPageSchema, L as platformOAuthClientImportInputSchema, M as platformErrorSchema, N as platformExternalIdSchema, O as platformEavEntityResourceSchema, P as platformLockAcquiredSchema, Q as platformTaskSchema, R as platformOAuthClientResourceSchema, S as platformBrandResourceSchema, T as platformBrandappUpsertInputSchema, U as platformPipelineStageInputSchema, V as platformPipelineResourceSchema, W as platformPipelineUpsertInputSchema, X as platformResourcesSchema, Y as platformResourceKeySchema, Z as platformResourcesV2Schema, _ as PLATFORM_TASK_OUTCOMES, a as createPlatformClient, at as platformWorkTaskStageChangedEventSchema, b as PLATFORM_WEBHOOK_TRIGGERS, c as PLATFORM_ADMIN_SCOPE, d as PLATFORM_EAV_DATA_TYPES, et as platformTaskStageSchema, f as PLATFORM_MANAGED_BY_VALUES, g as PLATFORM_STAGE_COLORS, h as PLATFORM_OAUTH_GRANT_TYPES, i as REOPT_PLATFORM_URLS, it as platformWebhookUpsertInputSchema, j as platformEavSchemaOperationSchema, k as platformEavSchemaApplyInputSchema, l as PLATFORM_BRANDAPP_STATUSES, m as PLATFORM_OAUTH_CLIENT_PURPOSES, n as PlatformApiError, nt as platformWebhookResourceSchema, ot as platformWriteMetaSchema, p as PLATFORM_OAUTH_APPLICATION_TYPES, q as platformPublishedPostSchema, r as REOPT_PLATFORM_ID_URLS, rt as platformWebhookSchema, s as resolvePlatformUrls, st as SDK_VERSION, t as DEFAULT_PLATFORM_SCOPES, tt as platformTaskUpsertInputSchema, u as PLATFORM_DOMAIN_STATUSES, v as PLATFORM_TASK_PRIORITIES, w as platformBrandappResourceSchema, x as platformBrandImportInputSchema, y as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, z as platformOAuthClientUpsertInputSchema } from "./client-Bm8YrIx2.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/workspace/connect.ts
|
|
@@ -173,6 +173,29 @@ const connectInquirySchema = z.looseObject({
|
|
|
173
173
|
multiline: z.boolean()
|
|
174
174
|
}))
|
|
175
175
|
});
|
|
176
|
+
const connectEavEntitySchema = z.looseObject({
|
|
177
|
+
id: z.string(),
|
|
178
|
+
name: z.string(),
|
|
179
|
+
description: z.string().nullable(),
|
|
180
|
+
icon: z.string().nullable(),
|
|
181
|
+
linkedTo: z.string(),
|
|
182
|
+
attributes: z.array(z.looseObject({
|
|
183
|
+
id: z.string(),
|
|
184
|
+
name: z.string(),
|
|
185
|
+
label: z.string(),
|
|
186
|
+
dataType: z.string(),
|
|
187
|
+
isRequired: z.boolean(),
|
|
188
|
+
isUnique: z.boolean()
|
|
189
|
+
})),
|
|
190
|
+
recordCount: z.number()
|
|
191
|
+
});
|
|
192
|
+
const connectEavRecordSchema = z.looseObject({
|
|
193
|
+
id: z.string(),
|
|
194
|
+
values: z.record(z.string(), z.unknown()),
|
|
195
|
+
version: z.number(),
|
|
196
|
+
createdAt: iso,
|
|
197
|
+
updatedAt: iso
|
|
198
|
+
});
|
|
176
199
|
const idResult = z.looseObject({ id: z.string() });
|
|
177
200
|
function queryString(params) {
|
|
178
201
|
const search = new URLSearchParams();
|
|
@@ -286,6 +309,19 @@ function createConnectClient(config) {
|
|
|
286
309
|
content: (id) => send("GET", `/files/${enc(id)}/content`)
|
|
287
310
|
},
|
|
288
311
|
forms: { list: () => data("GET", "/forms", list(connectFormSchema)) },
|
|
312
|
+
eav: {
|
|
313
|
+
listEntities: () => data("GET", "/eav/entities", list(connectEavEntitySchema)),
|
|
314
|
+
listRecords: (entityId, page = {}) => data("GET", `/eav/entities/${enc(entityId)}/records${queryString(page)}`, z.object({
|
|
315
|
+
records: z.array(connectEavRecordSchema),
|
|
316
|
+
nextOffset: z.number().nullable()
|
|
317
|
+
})),
|
|
318
|
+
createRecord: (entityId, values) => data("POST", `/eav/entities/${enc(entityId)}/records`, connectEavRecordSchema, { values }),
|
|
319
|
+
updateRecord: (entityId, recordId, input) => data("PATCH", `/eav/entities/${enc(entityId)}/records/${enc(recordId)}`, connectEavRecordSchema, input),
|
|
320
|
+
deleteRecord: (entityId, recordId) => data("DELETE", `/eav/entities/${enc(entityId)}/records/${enc(recordId)}`, z.looseObject({
|
|
321
|
+
id: z.string(),
|
|
322
|
+
deleted: z.boolean()
|
|
323
|
+
}))
|
|
324
|
+
},
|
|
289
325
|
inquiries: {
|
|
290
326
|
list: ({ formIds, limit }) => data("GET", `/inquiries${queryString({
|
|
291
327
|
formId: formIds,
|
|
@@ -302,5 +338,5 @@ function createConnectClient(config) {
|
|
|
302
338
|
}
|
|
303
339
|
|
|
304
340
|
//#endregion
|
|
305
|
-
export { DEFAULT_PLATFORM_SCOPES, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, 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, connectFileSchema, connectFolderSchema, connectFormSchema, connectInquirySchema, connectMeSchema, connectMemberSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectTaskSchema, createConnectClient, createPlatformClient, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformPublishedPostListQuerySchema, platformPublishedPostPageSchema, platformPublishedPostSchema, platformPublishedPostSummarySchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls };
|
|
341
|
+
export { DEFAULT_PLATFORM_SCOPES, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, PLATFORM_EAV_DATA_TYPES, 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, connectEavEntitySchema, connectEavRecordSchema, connectFileSchema, connectFolderSchema, connectFormSchema, connectInquirySchema, connectMeSchema, connectMemberSchema, connectPipelineSchema, connectPostGroupSchema, connectPostSchema, connectPostSummarySchema, connectTaskSchema, createConnectClient, createPlatformClient, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformPublishedPostListQuerySchema, platformPublishedPostPageSchema, platformPublishedPostSchema, platformPublishedPostSummarySchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls };
|
|
306
342
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as ClientPrivateJwk, r as ClientKeyRing } from "../keys-B2pA8EkU.js";
|
|
2
|
-
import {
|
|
2
|
+
import { C as PLATFORM_WEBHOOK_TRIGGERS, _ as PLATFORM_OAUTH_CLIENT_PURPOSES, a as PlatformUrls, bt as platformBrandappUpsertInputSchema, vt as platformBrandUpsertInputSchema, zt as platformPipelineUpsertInputSchema } from "../client-CwInApBf.js";
|
|
3
3
|
import { t as MachineClient } from "../client-DlgVNj3w.js";
|
|
4
4
|
import * as jose from "jose";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -203,6 +203,14 @@ type InstallationHealthView = {
|
|
|
203
203
|
ok: boolean | null;
|
|
204
204
|
};
|
|
205
205
|
webhookFailures7d: number;
|
|
206
|
+
/**
|
|
207
|
+
* 리옵트가 이 설치의 클라이언트에 등록한 공개키(RFC-0043) — `registered < clients`이면 등록되지 않은 클라이언트가 있다.
|
|
208
|
+
* 리옵트는 승인 때와 JWKS 재조회 때 `jwksUri`에서 읽어 등록한다. 옛 서버는 보내지 않는다.
|
|
209
|
+
*/
|
|
210
|
+
keys?: {
|
|
211
|
+
clients: number;
|
|
212
|
+
registered: number;
|
|
213
|
+
};
|
|
206
214
|
};
|
|
207
215
|
type InstallationRequested = {
|
|
208
216
|
id: string;
|
|
@@ -230,6 +238,11 @@ type InstallationJwksRefresh = {
|
|
|
230
238
|
fetchedAt: string;
|
|
231
239
|
status: number;
|
|
232
240
|
kids: string[];
|
|
241
|
+
/**
|
|
242
|
+
* 이번 요청으로 리옵트가 공개키 등록을 바꿨는가(RFC-0043) — 이미 같은 키가 등록돼 있으면 false. 등록을 거절하면
|
|
243
|
+
* `PlatformApiError` code `JWKS_REJECTED`(422, 개인키 성분·kid 누락 등)로 던진다.
|
|
244
|
+
*/
|
|
245
|
+
registered?: boolean;
|
|
233
246
|
};
|
|
234
247
|
type InstallationClientConfig = {
|
|
235
248
|
/** 플랫폼 API origin. 생략 시 `REOPT_PLATFORM_URL` env → 환경 기본값. */
|
|
@@ -272,7 +285,13 @@ type InstallationClient = {
|
|
|
272
285
|
id: string;
|
|
273
286
|
status: "revoked";
|
|
274
287
|
}>;
|
|
275
|
-
|
|
288
|
+
/**
|
|
289
|
+
* 리옵트에 JWKS를 다시 읽고 공개키 등록을 맞춰 달라고 한다(RFC-0043). 배포 직후·키 회전 직후에 부른다 — 리옵트의
|
|
290
|
+
* 매일 점검을 기다리지 않는다. 기본 인증은 설치 단언(등록 전에도 된다).
|
|
291
|
+
*/
|
|
292
|
+
refreshJwks(id: string, options?: {
|
|
293
|
+
auth?: "assertion" | "machine";
|
|
294
|
+
}): Promise<InstallationJwksRefresh>;
|
|
276
295
|
health(id: string): Promise<InstallationHealthView>;
|
|
277
296
|
};
|
|
278
297
|
declare function createInstallationClient(config?: InstallationClientConfig): InstallationClient;
|
|
@@ -325,7 +344,7 @@ declare function createInstallationBackchannelHandler(options: InstallationBackc
|
|
|
325
344
|
//#endregion
|
|
326
345
|
//#region src/installation/connection.d.ts
|
|
327
346
|
type ConnectionStatus = "unconnected" | "pending" | "connected" | "suspended" | "revoked" | "rejected";
|
|
328
|
-
type ConnectionPrimaryAction = "request" | "cancel" | "rotate-key" | "reconnect" | null;
|
|
347
|
+
type ConnectionPrimaryAction = "request" | "cancel" | "rotate-key" | "register-keys" | "reconnect" | null;
|
|
329
348
|
type ConnectionRecord = {
|
|
330
349
|
installationId: string;
|
|
331
350
|
status: InstallationStatus;
|
|
@@ -381,6 +400,12 @@ type ReoptConnection = {
|
|
|
381
400
|
/** back-channel 통지를 기록에 반영한다(정본은 refresh). */
|
|
382
401
|
applyBackchannelEvent(event: InstallationEvent): Promise<ConnectionState>;
|
|
383
402
|
health(): Promise<InstallationHealthView | null>;
|
|
403
|
+
/**
|
|
404
|
+
* 리옵트에 JWKS를 다시 읽어 공개키를 등록해 달라고 한다(RFC-0043) — 배포 직후·키 회전의 각 단계 뒤에 부른다. 설치 단언으로
|
|
405
|
+
* 인증하므로 공개키가 아직 등록되지 않았어도 된다. 성공하면 건강(등록 수 포함)을 새로 읽어 기록에 반영한다.
|
|
406
|
+
* 등록 거절(개인키 게시 등)은 `PlatformApiError` code `JWKS_REJECTED`.
|
|
407
|
+
*/
|
|
408
|
+
registerKeys(): Promise<InstallationJwksRefresh>;
|
|
384
409
|
};
|
|
385
410
|
declare function createReoptConnection(options: ReoptConnectionOptions): ReoptConnection;
|
|
386
411
|
type JwksSelfCheck = {
|
|
@@ -422,8 +447,9 @@ type ConfirmKeyRecognizedResult = {
|
|
|
422
447
|
lastError: string;
|
|
423
448
|
};
|
|
424
449
|
/**
|
|
425
|
-
* 새 키로 토큰 발급을 반복
|
|
426
|
-
*
|
|
450
|
+
* 새 키로 토큰 발급을 반복 시도한다. 리옵트는 등록된 공개키로 검증하므로 `registerKeys()` 뒤에는 첫 시도에 성공하고, 등록
|
|
451
|
+
* 전이면 리옵트가 모르는 kid를 만나 JWKS를 한 번 더 읽어 확인한다. `machineClientFactory`는 **새 키로만** 서명하는 클라이언트를
|
|
452
|
+
* 만들어야 한다.
|
|
427
453
|
*/
|
|
428
454
|
declare function confirmKeyRecognized(input: {
|
|
429
455
|
machineClientFactory: (key: ClientPrivateJwk) => MachineClient;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as platformBrandUpsertInputSchema, M as platformErrorSchema, T as platformBrandappUpsertInputSchema, W as platformPipelineUpsertInputSchema, Y as platformResourceKeySchema, b as PLATFORM_WEBHOOK_TRIGGERS, m as PLATFORM_OAUTH_CLIENT_PURPOSES, n as PlatformApiError, s as resolvePlatformUrls, st as SDK_VERSION } from "../client-Bm8YrIx2.js";
|
|
2
2
|
import { o as readClientKeyRing } from "../keys-6gwtNd0g.js";
|
|
3
3
|
import { r as createMachineClient } from "../client-XAvKlbbn.js";
|
|
4
4
|
import * as jose from "jose";
|
|
@@ -510,9 +510,9 @@ function createInstallationClient(config = {}) {
|
|
|
510
510
|
const url = `${base}/${encodeURIComponent(id)}`;
|
|
511
511
|
return send("DELETE", url, { auth: await machineAuth("DELETE", url) });
|
|
512
512
|
},
|
|
513
|
-
async refreshJwks(id) {
|
|
513
|
+
async refreshJwks(id, options = {}) {
|
|
514
514
|
const url = `${base}/${encodeURIComponent(id)}/jwks-refresh`;
|
|
515
|
-
return send("POST", url, { auth: await machineAuth("POST", url) });
|
|
515
|
+
return send("POST", url, { auth: (options.auth ?? "assertion") === "machine" ? await machineAuth("POST", url) : await assertionAuth(id) });
|
|
516
516
|
},
|
|
517
517
|
async health(id) {
|
|
518
518
|
const url = `${base}/${encodeURIComponent(id)}/health`;
|
|
@@ -638,6 +638,11 @@ function primaryActionFor(status) {
|
|
|
638
638
|
default: return null;
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
+
/** 연결됐는데 리옵트가 공개키를 등록하지 않은 클라이언트가 있는가(RFC-0043). 모르면(옛 서버) false. */
|
|
642
|
+
function keysMissing(record) {
|
|
643
|
+
const keys = record?.health?.keys;
|
|
644
|
+
return Boolean(keys && keys.clients > 0 && keys.registered < keys.clients);
|
|
645
|
+
}
|
|
641
646
|
/** §7.6 표의 문구 한 벌 — 앱마다 같은 말을 쓰게. */
|
|
642
647
|
function describeConnection(state) {
|
|
643
648
|
const r = state.record;
|
|
@@ -656,11 +661,19 @@ function describeConnection(state) {
|
|
|
656
661
|
].filter(Boolean),
|
|
657
662
|
primaryLabel: "요청 취소"
|
|
658
663
|
};
|
|
659
|
-
case "connected":
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
+
case "connected": {
|
|
665
|
+
const keys = r?.health?.keys;
|
|
666
|
+
const missing = keysMissing(r);
|
|
667
|
+
return {
|
|
668
|
+
title: missing ? "리옵트에 연결됨 — 공개키 등록이 필요합니다" : "리옵트에 연결됨",
|
|
669
|
+
lines: [
|
|
670
|
+
...(r?.clients ?? []).map((c) => `${c.purpose}: ${c.clientId}`),
|
|
671
|
+
keys ? `공개키 등록 ${keys.registered}/${keys.clients}${missing ? " — JWKS를 게시한 뒤 등록을 요청하면 토큰을 받을 수 있습니다." : ""}` : "",
|
|
672
|
+
r?.health ? `건강 — 토큰 ${r.health.lastTokenAt ? "●" : "○"} · JWKS ${r.health.jwks.ok === null ? "—" : r.health.jwks.ok ? "●" : "✕"} · 웹훅 실패(7일) ${r.health.webhookFailures7d}` : "건강 정보는 새로 고침 뒤에 표시됩니다."
|
|
673
|
+
].filter(Boolean),
|
|
674
|
+
primaryLabel: missing ? "공개키 등록 요청" : "키 회전"
|
|
675
|
+
};
|
|
676
|
+
}
|
|
664
677
|
case "suspended": return {
|
|
665
678
|
title: "리옵트 운영자가 일시정지했습니다",
|
|
666
679
|
lines: [r?.lastEvent?.reason ?? "사유는 콘솔 상세에 있습니다."],
|
|
@@ -686,7 +699,7 @@ function createReoptConnection(options) {
|
|
|
686
699
|
return {
|
|
687
700
|
status,
|
|
688
701
|
record,
|
|
689
|
-
primaryAction: primaryActionFor(status),
|
|
702
|
+
primaryAction: status === "connected" && keysMissing(record) ? "register-keys" : primaryActionFor(status),
|
|
690
703
|
machineClientId
|
|
691
704
|
};
|
|
692
705
|
}
|
|
@@ -758,6 +771,19 @@ function createReoptConnection(options) {
|
|
|
758
771
|
health
|
|
759
772
|
});
|
|
760
773
|
return health;
|
|
774
|
+
},
|
|
775
|
+
async registerKeys() {
|
|
776
|
+
const current = await options.store.load();
|
|
777
|
+
if (!current || toConnectionStatus(current.status) !== "connected") throw new Error("registerKeys(): only a connected installation can register keys");
|
|
778
|
+
const result = await options.client.refreshJwks(current.installationId);
|
|
779
|
+
try {
|
|
780
|
+
const health = await options.client.health(current.installationId);
|
|
781
|
+
await options.store.save({
|
|
782
|
+
...current,
|
|
783
|
+
health
|
|
784
|
+
});
|
|
785
|
+
} catch {}
|
|
786
|
+
return result;
|
|
761
787
|
}
|
|
762
788
|
};
|
|
763
789
|
}
|
|
@@ -818,23 +844,24 @@ function planKeyRotation(input) {
|
|
|
818
844
|
{
|
|
819
845
|
id: "publish-next",
|
|
820
846
|
done: input.keyRing.published.length > 1,
|
|
821
|
-
description: "새 키를 만들어 REOPT_CLIENT_PRIVATE_KEY_JWK_NEXT에 두고
|
|
847
|
+
description: "새 키를 만들어 REOPT_CLIENT_PRIVATE_KEY_JWK_NEXT에 두고 배포한 뒤 registerKeys()로 리옵트에 두 키를 함께 등록한다."
|
|
822
848
|
},
|
|
823
849
|
{
|
|
824
850
|
id: "confirm-recognized",
|
|
825
851
|
done: false,
|
|
826
|
-
description: "새 kid로 토큰 발급이
|
|
852
|
+
description: "새 kid로 토큰 발급이 성공하는지 확인한다(등록 뒤에는 바로 된다)."
|
|
827
853
|
},
|
|
828
854
|
{
|
|
829
855
|
id: "retire-old",
|
|
830
856
|
done: false,
|
|
831
|
-
description: "옛 키를 env에서 지우고 NEXT를 REOPT_CLIENT_PRIVATE_KEY_JWK로
|
|
857
|
+
description: "옛 키를 env에서 지우고 NEXT를 REOPT_CLIENT_PRIVATE_KEY_JWK로 올려 배포한 뒤 registerKeys()로 옛 키 등록을 내린다."
|
|
832
858
|
}
|
|
833
859
|
];
|
|
834
860
|
}
|
|
835
861
|
/**
|
|
836
|
-
* 새 키로 토큰 발급을 반복
|
|
837
|
-
*
|
|
862
|
+
* 새 키로 토큰 발급을 반복 시도한다. 리옵트는 등록된 공개키로 검증하므로 `registerKeys()` 뒤에는 첫 시도에 성공하고, 등록
|
|
863
|
+
* 전이면 리옵트가 모르는 kid를 만나 JWKS를 한 번 더 읽어 확인한다. `machineClientFactory`는 **새 키로만** 서명하는 클라이언트를
|
|
864
|
+
* 만들어야 한다.
|
|
838
865
|
*/
|
|
839
866
|
async function confirmKeyRecognized(input) {
|
|
840
867
|
const timeoutMs = Math.min(input.timeoutMs ?? 3e5, 3e5);
|
package/dist/social/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PlatformUrls, c as REOPT_PLATFORM_URLS, i as PlatformClientConfig, n as PlatformApiError, s as REOPT_PLATFORM_ID_URLS, u as resolvePlatformUrls } from "../client-
|
|
1
|
+
import { a as PlatformUrls, c as REOPT_PLATFORM_URLS, i as PlatformClientConfig, n as PlatformApiError, s as REOPT_PLATFORM_ID_URLS, u as resolvePlatformUrls } from "../client-CwInApBf.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/social/schemas.d.ts
|
|
4
4
|
/**
|
package/dist/social/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as REOPT_PLATFORM_URLS, n as PlatformApiError, o as createPlatformRequester, r as REOPT_PLATFORM_ID_URLS, s as resolvePlatformUrls } from "../client-
|
|
1
|
+
import { i as REOPT_PLATFORM_URLS, n as PlatformApiError, o as createPlatformRequester, r as REOPT_PLATFORM_ID_URLS, s as resolvePlatformUrls } from "../client-Bm8YrIx2.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/social/schemas.ts
|
package/docs/installation.md
CHANGED
|
@@ -78,11 +78,12 @@ back-channel 통지는 캐시다.
|
|
|
78
78
|
|
|
79
79
|
## 인증 계약
|
|
80
80
|
|
|
81
|
-
| 호출
|
|
82
|
-
|
|
|
83
|
-
| `POST /v1/installations`
|
|
84
|
-
| `GET /v1/installations/{id}`
|
|
85
|
-
| `
|
|
81
|
+
| 호출 | 인증 |
|
|
82
|
+
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `POST /v1/installations` | 본문 자체가 JWS(`typ: reopt-installation+jwt`, 매니페스트 키). 헤더 `jku`는 무시 — 본문의 `jwksUri`에서 키를 받는다 |
|
|
84
|
+
| `GET /v1/installations/{id}` | `Authorization: Installation <jws>` — 같은 키, `typ: reopt-installation-assertion+jwt`, `{ sub: id, iat, exp ≤ iat+300, jti }` · 또는 설치의 machine 토큰(DPoP) |
|
|
85
|
+
| `jwks-refresh` | **단언(기본)** 또는 machine 토큰 — 공개키가 아직 등록되지 않은 앱은 토큰을 받을 수 없으므로 단언이 기본이다(RFC-0043 §8 Q6) |
|
|
86
|
+
| `reinstall` · `DELETE` · `health` | 설치의 **machine 클라이언트** 토큰(private_key_jwt + DPoP). `scopes`를 비우면 id가 그 클라이언트에 등록된 scope 전부를 발급한다 |
|
|
86
87
|
|
|
87
88
|
재설치 매니페스트는 **활성 설치와 같은 jwksUri 키**로만 서명된다(불변식 7). 호스트 이전은 재설치가 아니라 해제 → 새 설치다.
|
|
88
89
|
|
|
@@ -107,16 +108,26 @@ export const POST = createInstallationBackchannelHandler({
|
|
|
107
108
|
## "리옵트 연결" 카드 상태 (§7.6)
|
|
108
109
|
|
|
109
110
|
`connection.state()` → `status`(`unconnected | pending | connected | suspended | rejected | revoked`)·`primaryAction`
|
|
110
|
-
(`request | cancel | rotate-key | reconnect | null`)·`record`.
|
|
111
|
+
(`request | cancel | rotate-key | register-keys | reconnect | null`)·`record`. 연결됐는데 리옵트가 공개키를 등록하지 않았으면
|
|
112
|
+
(`health.keys.registered < clients`) 주 동작은 `register-keys`("공개키 등록 요청")이고 `connection.registerKeys()`가 그 일을 한다. `connection.describe()`가 제목·본문 줄·주 버튼 문구를 준다 —
|
|
111
113
|
렌더는 각 앱의 UI로. `cancel()`은 pending에서 **로컬 기록만** 지운다(리옵트 쪽 요청은 운영자가 거절·해제한다).
|
|
112
114
|
|
|
113
115
|
미연결 카드의 "JWKS 자가 점검"은 `selfCheckJwks({ publicUrl, kid })` — 공개 URL 200 + 현재 kid 포함.
|
|
114
116
|
|
|
115
117
|
## 키 회전 (2단계 마법사)
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
## 공개키 등록 (RFC-0043 §8 Q6)
|
|
120
|
+
|
|
121
|
+
리옵트는 앱이 게시한 JWKS를 읽어 **공개키를 클라이언트에 등록**하고, 토큰 요청의 서명을 그 등록된 키로 검증한다 —
|
|
122
|
+
그래서 앱이 고객 도메인에 있어도 된다. 등록은 설치 활성화 때·콘솔 "공개키 다시 읽기"·매일 점검, 그리고 앱이 직접
|
|
123
|
+
`connection.registerKeys()`(= `client.refreshJwks(id)`, 단언 인증)를 부를 때 맞춰진다. 배포 직후 한 번 부르면 기다리지 않는다.
|
|
124
|
+
개인키 성분(`d` 등)이 실린 JWKS는 등록하지 않고 `JWKS_REJECTED`(422)로 답한다 — 이미 등록된 키는 그대로 둔다.
|
|
125
|
+
|
|
126
|
+
## 키 회전 (2단계 마법사)
|
|
127
|
+
|
|
128
|
+
1. 새 키를 만들어 `REOPT_CLIENT_PRIVATE_KEY_JWK_NEXT`에 두고 배포 → JWKS에 두 키가 실린다 → `registerKeys()`(`planKeyRotation` ① done).
|
|
129
|
+
2. `confirmKeyRecognized({ machineClientFactory, key: next })` — 새 키로 토큰 발급이 되는지 확인한다(등록 뒤에는 첫 시도에 된다).
|
|
130
|
+
3. 옛 키를 지우고 NEXT를 `REOPT_CLIENT_PRIVATE_KEY_JWK`로 올려 배포 → `registerKeys()`로 옛 키 등록을 내린다. 중간에 떠나도 안전하다(두 키 공존).
|
|
120
131
|
|
|
121
132
|
## env
|
|
122
133
|
|
package/docs/workspace.md
CHANGED
|
@@ -136,6 +136,36 @@ const inquiries = await reopt.inquiries.list({ formIds: [formId] });
|
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
Refusals arrive as `PlatformApiError` (`INSUFFICIENT_SCOPE`, `FORBIDDEN`, `TIER_REQUIRED`, 403).
|
|
139
|
+
|
|
140
|
+
### The app's own tables
|
|
141
|
+
|
|
142
|
+
Data that has no Reopt domain (not a task, post, file or inquiry) can live in tables the
|
|
143
|
+
workspace app owns. The app's server declares them with its machine credential (scope
|
|
144
|
+
`workspace:admin`); with a workspace app credential and no `brandapp` in the body they land in
|
|
145
|
+
the app's own namespace. Staff then read and write rows through the connect client, keyed by
|
|
146
|
+
attribute **name**. Other apps' and brandapps' tables are invisible (404).
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
await platform.eav.applySchema({
|
|
150
|
+
operations: [
|
|
151
|
+
{ kind: "addEntity", name: "leads" },
|
|
152
|
+
{
|
|
153
|
+
kind: "addAttribute",
|
|
154
|
+
entity: "leads",
|
|
155
|
+
name: "company",
|
|
156
|
+
def: { label: "회사", dataType: "string", isRequired: true },
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const leads = (await reopt.eav.listEntities()).find((e) => e.name === "leads")!;
|
|
162
|
+
const row = await reopt.eav.createRecord(leads.id, { company: "Acme" });
|
|
163
|
+
await reopt.eav.updateRecord(leads.id, row.id, {
|
|
164
|
+
values: { company: "Acme Co" },
|
|
165
|
+
ifVersion: row.version,
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
139
169
|
Response schemas check the fields the SDK promises and let added fields through.
|
|
140
170
|
|
|
141
171
|
## Declarative resources (RFC-0030)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reopt-ai/workspace-sdk",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.1",
|
|
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",
|