@collective-intelligence/external-apps-client-sdk 0.1.36 → 0.1.38
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/README.md +106 -12
- package/dist/effect.d.ts +104 -5
- package/dist/effect.js +32 -2
- package/dist/index-D_Ctkuhr.d.ts +1029 -0
- package/dist/index.d.ts +3 -877
- package/dist/index.js +178 -626
- package/dist/resources-BhOgbxg5.js +113 -0
- package/dist/{resources-Czlu8xAB.d.ts → resources-CftkAwlJ.d.ts} +285 -7
- package/dist/resources.d.ts +2 -2
- package/dist/resources.js +2 -1
- package/dist/{resources-BFJrm_N2.js → service-D-18nBUU.js} +607 -280
- package/dist/service-DD58W3in.js +1439 -0
- package/package.json +7 -4
- package/dist/event-stream-Djqhj56G.d.ts +0 -63
- package/dist/federated-auth-lotz7RGT.d.ts +0 -94
- package/dist/rolldown-runtime-DC62tzP2.js +0 -31
- package/dist/service-4l3X16iR.js +0 -750
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@collective-intelligence/external-apps-client-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "Framework-neutral client for Collective Intelligence external applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"check:models": "tsprover",
|
|
36
36
|
"test": "bun tools/test-pack.ts",
|
|
37
37
|
"test:pack": "bun tools/test-pack.ts",
|
|
38
|
+
"test:properties": "vitest run --config vitest.config.ts",
|
|
38
39
|
"test:unit": "bun test src",
|
|
39
40
|
"format": "oxfmt --write .",
|
|
40
41
|
"format:check": "oxfmt --check .",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"lint": "node \"../../../.agents/scripts/managed-lint-runner.mjs\" --scope \"packages/public/external-apps-client-sdk\"",
|
|
43
44
|
"lint:staged": "oxlint --no-error-on-unmatched-pattern",
|
|
44
45
|
"prepack": "bun run build",
|
|
45
|
-
"type-check": "bun check"
|
|
46
|
+
"type-check": "bun check && bun check -p tsconfig.type-tests.json"
|
|
46
47
|
},
|
|
47
48
|
"publishConfig": {
|
|
48
49
|
"access": "public"
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
"effect": "^4.1.0"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
59
|
+
"@effect/vitest": "4.1.0",
|
|
58
60
|
"@oxlint/plugins": "1.90.0",
|
|
59
61
|
"@types/bun": "1.4.2",
|
|
60
62
|
"effect": "4.1.0",
|
|
@@ -63,7 +65,8 @@
|
|
|
63
65
|
"tsdown": "0.22.14",
|
|
64
66
|
"tsprover": "0.0.2",
|
|
65
67
|
"typescript": "5.9.3",
|
|
66
|
-
"ultracite": "7.10.7"
|
|
68
|
+
"ultracite": "7.10.7",
|
|
69
|
+
"vitest": "5.0.2"
|
|
67
70
|
},
|
|
68
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "089c82bce0e7fb8319514787d67489aef7a0ee01"
|
|
69
72
|
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { t as ClientFetch } from "./federated-auth-lotz7RGT.js";
|
|
2
|
-
import "effect/Context";
|
|
3
|
-
import "effect/Effect";
|
|
4
|
-
import "effect/Layer";
|
|
5
|
-
import "effect/Stream";
|
|
6
|
-
/** One equality filter on a dotted data path of a topic's records. */
|
|
7
|
-
type RealtimeTopicFilter = Readonly<{
|
|
8
|
-
field: string;
|
|
9
|
-
eq: string | number | boolean | null;
|
|
10
|
-
}>;
|
|
11
|
-
/** The records of one entity schema, named by FQN or id, optionally filtered. */
|
|
12
|
-
type RealtimeTopic = Readonly<{
|
|
13
|
-
schema: string;
|
|
14
|
-
filter?: RealtimeTopicFilter;
|
|
15
|
-
}>;
|
|
16
|
-
/** A record of a subscribed topic changed; refetch it, the event carries ids only. */
|
|
17
|
-
type RealtimeChange = Readonly<{
|
|
18
|
-
id: string;
|
|
19
|
-
op: "create" | "update" | "delete";
|
|
20
|
-
revision: string;
|
|
21
|
-
topic: RealtimeTopic;
|
|
22
|
-
}>;
|
|
23
|
-
/** One stable key per topic, whatever the key order of the object. */
|
|
24
|
-
declare const realtimeTopicKey: ({ filter, schema }: RealtimeTopic) => string;
|
|
25
|
-
type PageEvents = Readonly<{
|
|
26
|
-
addEventListener: (type: string, listener: () => void) => void;
|
|
27
|
-
removeEventListener: (type: string, listener: () => void) => void;
|
|
28
|
-
}>;
|
|
29
|
-
type RealtimeDocument = PageEvents & Readonly<{
|
|
30
|
-
visibilityState: DocumentVisibilityState;
|
|
31
|
-
}>;
|
|
32
|
-
type RealtimeWindow = PageEvents;
|
|
33
|
-
/** One dispatched Server-Sent Event. */
|
|
34
|
-
type RealtimeStreamEvent = Readonly<{
|
|
35
|
-
type: string;
|
|
36
|
-
data: string;
|
|
37
|
-
/** The `id:` of this event, when it carried one. */
|
|
38
|
-
id: string | undefined;
|
|
39
|
-
}>;
|
|
40
|
-
/**
|
|
41
|
-
* How a stream ended: `status` when the server refused it, and the
|
|
42
|
-
* reconnect delay the server asked for with `retry:` or `Retry-After`.
|
|
43
|
-
*/
|
|
44
|
-
type RealtimeStreamEnd = Readonly<{
|
|
45
|
-
status: number | undefined;
|
|
46
|
-
retryMilliseconds: number | undefined;
|
|
47
|
-
}>;
|
|
48
|
-
type RealtimeStreamHandlers = Readonly<{
|
|
49
|
-
onOpen: () => void;
|
|
50
|
-
onEvent: (event: RealtimeStreamEvent) => void;
|
|
51
|
-
/** A comment or an `id:`-only frame: the server is alive. */
|
|
52
|
-
onPing: (id?: string) => void;
|
|
53
|
-
/** Called once, unless the stream was closed by the client. */
|
|
54
|
-
onEnd: (end: RealtimeStreamEnd) => void;
|
|
55
|
-
}>;
|
|
56
|
-
type RealtimeEventSource = Readonly<{
|
|
57
|
-
close: () => void;
|
|
58
|
-
}>;
|
|
59
|
-
/** Opens one event stream; `close` stops it without calling `onEnd`. */
|
|
60
|
-
type RealtimeEventSourceFactory = (url: string, handlers: RealtimeStreamHandlers) => RealtimeEventSource;
|
|
61
|
-
/** Reads `text/event-stream` with `fetch`, so pings and refusals are visible. */
|
|
62
|
-
declare const createFetchEventSourceFactory: (fetch: ClientFetch) => RealtimeEventSourceFactory;
|
|
63
|
-
export { RealtimeStreamHandlers as a, RealtimeWindow as c, RealtimeTopicFilter as d, realtimeTopicKey as f, RealtimeStreamEvent as i, RealtimeChange as l, RealtimeEventSourceFactory as n, createFetchEventSourceFactory as o, RealtimeStreamEnd as r, RealtimeDocument as s, RealtimeEventSource as t, RealtimeTopic as u };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
|
-
/** Code of an Expected Error that CI returns for an operation. */
|
|
3
|
-
declare const CiErrorCode: Schema.Literals<readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"]>;
|
|
4
|
-
type CiErrorCode = typeof CiErrorCode.Type;
|
|
5
|
-
/** Code of an Expected Error of the federated sign-in flow. */
|
|
6
|
-
declare const FederatedAuthErrorCode: Schema.Literals<readonly ["configuration_error", "invalid_return_target", "invalid_callback", "invalid_state", "transaction_expired", "authorization_failed", "token_exchange_failed", "reauthorization_required"]>;
|
|
7
|
-
type FederatedAuthErrorCode = typeof FederatedAuthErrorCode.Type;
|
|
8
|
-
declare const CiError_base: Schema.Class<CiError, Schema.TaggedStruct<"CiError", {
|
|
9
|
-
readonly code: Schema.Literals<readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"]>;
|
|
10
|
-
readonly details: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
11
|
-
readonly message: Schema.String;
|
|
12
|
-
readonly retryable: Schema.Boolean;
|
|
13
|
-
}>, import("effect/Cause").YieldableError>;
|
|
14
|
-
/** An Expected Error that CI returns for an operation. */
|
|
15
|
-
declare class CiError extends CiError_base {}
|
|
16
|
-
type FederatedAuthErrorFields = Readonly<{
|
|
17
|
-
code: FederatedAuthErrorCode;
|
|
18
|
-
message: string;
|
|
19
|
-
}>;
|
|
20
|
-
declare const FederatedAuthError_base: Schema.Class<FederatedAuthError, Schema.TaggedStruct<"FederatedAuthError", {
|
|
21
|
-
readonly code: Schema.Literals<readonly ["configuration_error", "invalid_return_target", "invalid_callback", "invalid_state", "transaction_expired", "authorization_failed", "token_exchange_failed", "reauthorization_required"]>;
|
|
22
|
-
readonly message: Schema.String;
|
|
23
|
-
}>, import("effect/Cause").YieldableError>;
|
|
24
|
-
/** An Expected Error of the federated sign-in flow. */
|
|
25
|
-
declare class FederatedAuthError extends FederatedAuthError_base {
|
|
26
|
-
constructor(fields: FederatedAuthErrorFields, options?: Schema.MakeOptions);
|
|
27
|
-
/** The positional form that `.` callers used before the tagged class. */
|
|
28
|
-
constructor(code: FederatedAuthErrorCode, message: string);
|
|
29
|
-
}
|
|
30
|
-
declare const CiTransportError_base: Schema.Class<CiTransportError, Schema.TaggedStruct<"CiTransportError", {
|
|
31
|
-
readonly cause: Schema.Defect;
|
|
32
|
-
}>, import("effect/Cause").YieldableError>;
|
|
33
|
-
/** The request did not reach CI, or CI's response was not readable. */
|
|
34
|
-
declare class CiTransportError extends CiTransportError_base {}
|
|
35
|
-
/**
|
|
36
|
-
* The signed-in CI user as the application's BFF reports it: the fields of
|
|
37
|
-
* CI's `/oauth/identity`, read live by the server, plus email and name.
|
|
38
|
-
*/
|
|
39
|
-
type FederatedSessionIdentity = Readonly<{
|
|
40
|
-
appId: string;
|
|
41
|
-
/** The App Permissions of the user's effective roles. */
|
|
42
|
-
appPermissions: readonly string[];
|
|
43
|
-
email: string | null;
|
|
44
|
-
/** A person is a member or an External App User of one Organization, never both. */
|
|
45
|
-
kind: "member" | "external_app_user";
|
|
46
|
-
name: string | null;
|
|
47
|
-
organizationId: string;
|
|
48
|
-
/** The user's effective roles on the app. */
|
|
49
|
-
roles: readonly string[];
|
|
50
|
-
userId: string;
|
|
51
|
-
}>;
|
|
52
|
-
type FederatedAuthState = Readonly<{
|
|
53
|
-
status: "anonymous";
|
|
54
|
-
}> | Readonly<{
|
|
55
|
-
status: "redirecting";
|
|
56
|
-
}> | Readonly<{
|
|
57
|
-
expiresAt: number;
|
|
58
|
-
identity?: FederatedSessionIdentity;
|
|
59
|
-
status: "authenticated";
|
|
60
|
-
}> | Readonly<{
|
|
61
|
-
status: "expired";
|
|
62
|
-
}> | Readonly<{
|
|
63
|
-
error: FederatedAuthError;
|
|
64
|
-
status: "error";
|
|
65
|
-
}>;
|
|
66
|
-
type FederatedAuth = Readonly<{
|
|
67
|
-
beginLogin: (options: Readonly<{
|
|
68
|
-
returnTo: string;
|
|
69
|
-
}>) => Promise<string>;
|
|
70
|
-
completeLogin: (callbackUrl: string) => Promise<Readonly<{
|
|
71
|
-
returnTo: string;
|
|
72
|
-
}>>;
|
|
73
|
-
getAccessToken: () => Promise<string>;
|
|
74
|
-
getState: () => FederatedAuthState;
|
|
75
|
-
logout: () => Promise<void>;
|
|
76
|
-
reauthorize: (options?: Readonly<{
|
|
77
|
-
returnTo?: string;
|
|
78
|
-
}>) => Promise<string>;
|
|
79
|
-
subscribe: (listener: (state: FederatedAuthState) => void) => () => void;
|
|
80
|
-
}>;
|
|
81
|
-
type ClientFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
82
|
-
type FederatedAuthOptions = Readonly<{
|
|
83
|
-
clientId: string;
|
|
84
|
-
crypto?: Pick<Crypto, "getRandomValues" | "subtle">;
|
|
85
|
-
fetch?: ClientFetch;
|
|
86
|
-
navigate?: (url: string) => void;
|
|
87
|
-
now?: () => number;
|
|
88
|
-
redirectUri: string;
|
|
89
|
-
scopes: readonly string[];
|
|
90
|
-
sessionStorage?: Pick<Storage, "getItem" | "removeItem" | "setItem">;
|
|
91
|
-
tenantUrl: string;
|
|
92
|
-
}>;
|
|
93
|
-
declare const createFederatedAuth: (options: FederatedAuthOptions) => FederatedAuth;
|
|
94
|
-
export { FederatedSessionIdentity as a, CiErrorCode as c, FederatedAuthErrorCode as d, FederatedAuthState as i, CiTransportError as l, FederatedAuth as n, createFederatedAuth as o, FederatedAuthOptions as r, CiError as s, ClientFetch as t, FederatedAuthError as u };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
8
|
-
var __exportAll = (all, no_symbols) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) __defProp(target, name, {
|
|
11
|
-
get: all[name],
|
|
12
|
-
enumerable: true
|
|
13
|
-
});
|
|
14
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
-
return target;
|
|
16
|
-
};
|
|
17
|
-
var __copyProps = (to, from, except, desc) => {
|
|
18
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
|
-
key = keys[i];
|
|
20
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
-
get: ((k) => from[k]).bind(null, key),
|
|
22
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
30
|
-
}) : target, mod));
|
|
31
|
-
export { __exportAll as n, __toESM as r, __commonJSMin as t };
|