@somewhere-cloud/cli 0.38.160 → 0.38.162
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 +9 -0
- package/bin/deploy-check.cjs +35 -0
- package/dist/lib/bundle.js +241 -55
- package/dist/lib/bundle.js.map +3 -3
- package/dist/lib/declared-data.js +2 -11
- package/dist/types/lib/test-control.d.ts +3 -1
- package/dist/types/lib/test-files.d.ts +28 -0
- package/dist/types/lib/test-identities.d.ts +2 -0
- package/dist/types/lib/test-session.d.ts +12 -6
- package/dist/types/lib/testing-app.d.ts +7 -0
- package/dist/types/testing.d.ts +2 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/runtime/DECLARED-DATA-VENDOR.json +9 -9
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/declared-data.cjs +52 -11
- package/src/testing.ts +2 -1
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { loadEntry } from "./bundle.js";
|
|
2
2
|
const entry = loadEntry("lib/declared-data.js");
|
|
3
|
-
export const { DATA_DECLARATION_FILE, DATA_MODULE, DATA_VIRTUAL_ID, FILES_DECLARATION_FILE, GENERATED_DATA_HEADER, declaredDataPlugin, prepareDeclaredData } = entry;
|
|
4
|
-
const SW_ENDPOINT_GLOBAL = `declare const sw:
|
|
5
|
-
// docs({ topic: 'sw.endpoint' }). Throw an Error with .status and .code
|
|
6
|
-
// for a typed error response; anything else is 500 HANDLER_ERROR.
|
|
7
|
-
// Roles imply a signed-in caller: with roles and auth left out, the user is typed as signed in.
|
|
8
|
-
endpoint<const Schema extends SomewhereEndpointBodySchema | undefined = undefined, Auth extends SomewhereEndpointAuth = 'none',
|
|
9
|
-
const Roles extends readonly string[] | undefined = undefined>(
|
|
10
|
-
config: SomewhereEndpointConfig<[Roles] extends [readonly string[]] ? ([Auth] extends ['none'] ? 'required' : Auth) : Auth, Schema>
|
|
11
|
-
& { auth?: Auth; roles?: Roles },
|
|
12
|
-
): (req: Request, sw: SomewhereRuntimeContext) => Promise<Response>;
|
|
13
|
-
};
|
|
3
|
+
export const { DATA_DECLARATION_FILE, DATA_MODULE, DATA_VIRTUAL_ID, FILES_DECLARATION_FILE, GENERATED_DATA_HEADER, declaredDataPlugin, localFilesContract, prepareDeclaredData } = entry;
|
|
4
|
+
const SW_ENDPOINT_GLOBAL = `declare const sw: SomewhereEndpointGlobal;
|
|
14
5
|
`;
|
|
@@ -38,7 +38,9 @@ export interface TestControl {
|
|
|
38
38
|
createManagedUser?(): Promise<ManagedUser>;
|
|
39
39
|
deleteManagedUser?(id: string): Promise<string | null>;
|
|
40
40
|
}
|
|
41
|
-
export declare function productionControl(client: ApiClient, target: TestTarget
|
|
41
|
+
export declare function productionControl(client: ApiClient, target: TestTarget, options?: {
|
|
42
|
+
liveInboxOnly?: boolean;
|
|
43
|
+
}): TestControl;
|
|
42
44
|
/** The production control the runner and fixtures always used: your sign-in, the live release. */
|
|
43
45
|
export declare function openProductionControl(projectId: string, target?: TestTarget): Promise<TestControl>;
|
|
44
46
|
export declare const PREVIEW_CLOSED_MESSAGE = "The preview is closed, promoted or expired, or its credential was revoked. Open or continue one with `somewhere preview`, then run the tests again.";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type Scope = Record<string, string | number>;
|
|
2
|
+
export type FilesRequest = {
|
|
3
|
+
operation: 'upload';
|
|
4
|
+
file: Blob;
|
|
5
|
+
name?: string;
|
|
6
|
+
contentType?: string;
|
|
7
|
+
scope?: Scope;
|
|
8
|
+
} | {
|
|
9
|
+
operation: 'list';
|
|
10
|
+
limit?: number;
|
|
11
|
+
cursor?: string;
|
|
12
|
+
scope?: Scope;
|
|
13
|
+
} | {
|
|
14
|
+
operation: 'url' | 'delete';
|
|
15
|
+
id: string;
|
|
16
|
+
} | {
|
|
17
|
+
operation: 'shareLink';
|
|
18
|
+
id: string;
|
|
19
|
+
expiresIn?: number;
|
|
20
|
+
};
|
|
21
|
+
export interface UploadLink {
|
|
22
|
+
id: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
url: string;
|
|
25
|
+
multipart_url: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function transferTestFile(link: UploadLink, file: Blob, type: string, singleRequestMaxBytes: number): Promise<Response>;
|
|
28
|
+
export {};
|
|
@@ -125,6 +125,8 @@ export interface InboxMessage {
|
|
|
125
125
|
verification_code: string | null;
|
|
126
126
|
magic_link: string | null;
|
|
127
127
|
created_at: string;
|
|
128
|
+
text: string | null;
|
|
129
|
+
html: string | null;
|
|
128
130
|
}
|
|
129
131
|
/** Messages for exactly `address` created after `since`, newest first. The server's `since` only
|
|
130
132
|
* drives the long-poll; the list is filtered here so a stale code is never returned. */
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { type FilesRequest } from './test-files.js';
|
|
1
2
|
import { type TestTarget } from './test-target.js';
|
|
2
3
|
import { type PlaywrightStorageState } from './test-identities.js';
|
|
4
|
+
export declare function managedFileSession(session: UserSession, root: string, userId: string): void;
|
|
5
|
+
type RefusalControl = {
|
|
6
|
+
allowed?: UserSession | {
|
|
7
|
+
session: UserSession;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
3
10
|
export declare class UserSession {
|
|
4
11
|
readonly origin: string;
|
|
5
12
|
private cookies;
|
|
@@ -19,12 +26,10 @@ export declare class UserSession {
|
|
|
19
26
|
post(path: string, body: unknown): Promise<Response>;
|
|
20
27
|
/** Prove a refusal against a table or a METHOD /path endpoint. Use an allowed session
|
|
21
28
|
* as the positive control for hidden rows or a 404. */
|
|
22
|
-
expectRefused(table: string, request: DataRequest, options?:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
allowed?: UserSession;
|
|
27
|
-
}): Promise<void>;
|
|
29
|
+
expectRefused(table: string, request: DataRequest, options?: RefusalControl): Promise<void>;
|
|
30
|
+
expectRefused(endpoint: `${string} /${string}`, body?: unknown, options?: RefusalControl): Promise<void>;
|
|
31
|
+
/** Exercise the declared file door as a managed test user. */
|
|
32
|
+
files(collection: string, request: FilesRequest): Promise<Response>;
|
|
28
33
|
/** Use this session's cookies and the linked app's declared data contract. */
|
|
29
34
|
data(table: string, request: DataRequest): Promise<Response>;
|
|
30
35
|
data(table: string, contract: string, request: DataRequest): Promise<Response>;
|
|
@@ -49,3 +54,4 @@ export declare function expectStatus(response: Response, expected: number): Prom
|
|
|
49
54
|
export declare function expectRefusal(response: Response, status: 401 | 403, code: string): Promise<void>;
|
|
50
55
|
export declare function signIn(baseUrl: string, email: string, password: string): Promise<UserSession>;
|
|
51
56
|
export declare function createUser(baseUrl: string): Promise<UserSession>;
|
|
57
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type InboxMessage } from './test-identities.js';
|
|
1
2
|
import { type TestJob, type TestJobOptions, type TestJobTarget } from './testing-jobs.js';
|
|
2
3
|
import { UserSession } from './test-session.js';
|
|
3
4
|
export interface TestActor {
|
|
@@ -5,10 +6,16 @@ export interface TestActor {
|
|
|
5
6
|
email: string;
|
|
6
7
|
session: UserSession;
|
|
7
8
|
}
|
|
9
|
+
export interface TestInboxMessage extends InboxMessage {
|
|
10
|
+
links: string[];
|
|
11
|
+
}
|
|
8
12
|
export interface TestApp {
|
|
9
13
|
origin: string;
|
|
10
14
|
anonymous: UserSession;
|
|
11
15
|
users(count: number): Promise<TestActor[]>;
|
|
16
|
+
inboxAddress(name?: string): string;
|
|
17
|
+
testInbox(email: string): Promise<TestInboxMessage[]>;
|
|
18
|
+
signInWithLink(url: string): Promise<TestActor>;
|
|
12
19
|
create(user: TestActor, table: string, values: Record<string, unknown>, key?: string): Promise<string | number>;
|
|
13
20
|
plantMarker(user: TestActor, table: string, field: string, values?: Record<string, unknown>): Promise<string>;
|
|
14
21
|
onCleanup(label: string, action: () => Promise<void>): void;
|
package/dist/types/testing.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface BrowserPage {
|
|
|
10
10
|
}
|
|
11
11
|
export declare function waitForApp(page: BrowserPage, state?: 'ready' | 'signed-in' | 'signed-out'): Promise<void>;
|
|
12
12
|
export { test, expect, expectRefused, data, ready, type RefusalOptions, type TestUser, type NewUserOptions, type Person, type SignUpOptions, type SignInOptions, type FormSteps, type CodeSteps } from './lib/playwright-fixtures.js';
|
|
13
|
-
export { openTestApp, type TestApp, type TestActor } from './lib/testing-app.js';
|
|
13
|
+
export { openTestApp, type TestApp, type TestActor, type TestInboxMessage } from './lib/testing-app.js';
|
|
14
14
|
export { assertNoLeak, captureResponses } from './lib/test-response-capture.js';
|
|
15
15
|
export type { TestJob, TestJobOptions, TestJobTarget } from './lib/testing-jobs.js';
|
|
16
|
+
export type { FilesRequest } from './lib/test-files.js';
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@somewhere-cloud/cli",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.162",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@somewhere-cloud/cli",
|
|
9
|
-
"version": "0.38.
|
|
9
|
+
"version": "0.38.162",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"bin": {
|
|
12
12
|
"somewhere": "bin/somewhere.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@somewhere-cloud/cli",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.162",
|
|
4
4
|
"description": "CLI for somewhere.cloud — auth, projects, deploy, pull, promote, db, logs, env, MCP bridge.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"somewhere",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
},
|
|
68
68
|
"bundleDependencies": [],
|
|
69
69
|
"bundledDependencies": [],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "8be06a131526985ded5c3b0155a6c0126d8c086e"
|
|
71
71
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source_commit": "
|
|
2
|
+
"source_commit": "c28e5e9391b22cb870687d160eae0e64ff344ffe",
|
|
3
3
|
"esbuild": "0.24.0",
|
|
4
4
|
"source_files": {
|
|
5
5
|
"shared/app-model-catalog.ts": "c9a0119366beabb10157fcc9866f4d32b320b680f1c5717d837a5ca99875fa13",
|
|
6
6
|
"shared/cloud-dev-entitlement.ts": "1993a9e1c781d9daed29b3cfef0e8a370e150ce06d2acc7c408c2a24c50b4960",
|
|
7
7
|
"shared/d1-region.ts": "71cda96cfead241b4f4e35b8cd6b1d8e577f072257e91a8dbe0deaa1b142b378",
|
|
8
8
|
"shared/d1-session.ts": "2ae29b74bba68016c86d25fa2a58f8c2fce4aca8fe57fafc253d380c47a3c0ab",
|
|
9
|
-
"shared/transient-read.ts": "
|
|
9
|
+
"shared/transient-read.ts": "7c10de219ee4b910cb2e35d9aeb7a0974ae3eeaeea7c4b5983b89f3c403db1cb",
|
|
10
10
|
"shared/types/placeholder-identity.ts": "089a46e2474a21193d3611eddd9c94b6bbe62441b3039ed80fc8499bada447ca",
|
|
11
|
-
"worker/containers/compile/checker-contract.cjs": "
|
|
12
|
-
"worker/containers/compile/consumer-contract.cjs": "
|
|
11
|
+
"worker/containers/compile/checker-contract.cjs": "732cb5a886548f91499031fc1f0727ae05e824ab8d482693f2ad04de4868595b",
|
|
12
|
+
"worker/containers/compile/consumer-contract.cjs": "068b92efb226e74af8979557c7dc2b7f06787efb151f74c7593b0525995c8baa",
|
|
13
13
|
"worker/containers/compile/declared-data-contract.cjs": "ebdc7dbc12283a7218c28e0e912e736ac27a8e9d513b82c097ebff6df3c1dd91",
|
|
14
14
|
"worker/containers/compile/generated-declarations-render.cjs": "7ffdb34645cc9eccac6eba39dc86b646a41c4de8a1a038d2b5b46f42df9f1157",
|
|
15
15
|
"worker/containers/compile/generated-declarations.cjs": "6e9902e054c5c784fd9b3c3fafc1869e79954100a45014e1132247cd82833ec4",
|
|
16
|
-
"worker/containers/compile/groups-types.cjs": "
|
|
17
|
-
"worker/containers/compile/runtime-types.cjs": "
|
|
16
|
+
"worker/containers/compile/groups-types.cjs": "7681d2adf0c7761a4971d7ba8287b238e464fd2768c878477e32794538675b33",
|
|
17
|
+
"worker/containers/compile/runtime-types.cjs": "a952608ea438a616bd21b444c5f0681abf3c2e3308df287065c72464ca2e7e6f",
|
|
18
18
|
"worker/containers/compile/schema-types.cjs": "806147ad7224356734020c62441123db16b50ef6456db974c573b226d517e6cc",
|
|
19
19
|
"worker/containers/compile/typed-data.cjs": "1c8bec853fbee4ffd34c651076a4e1f4d8b18c0c2be5e99e31df7c9283207627",
|
|
20
20
|
"worker/containers/compile/typed-files.cjs": "f2568567a53994575ede91f9a0839965e64f94eb92ae11315650189b6de0f79c",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"worker/src/services/jobs/limits.ts": "2d0d73de8752ad4fb84d281bac6c3049bb34a7d0b08c7cda76634c19c303c529",
|
|
34
34
|
"worker/src/utils/alert-audit.ts": "318ce8cd45954f50a77bf0782efa4cc433016e923431e3a4042d2294f31610f8",
|
|
35
35
|
"worker/src/utils/alert-streak.ts": "cc15ff03920821cb4b2c6758fdd29508b24b29f258287e977c23a8ae28c14cbd",
|
|
36
|
-
"worker/src/utils/authority.ts": "
|
|
36
|
+
"worker/src/utils/authority.ts": "71b7605de8bdb32229f24a7cde42d6f253d4e2f7ae7e6d772f1179dfaf1c8c10",
|
|
37
37
|
"worker/src/utils/authority/client-contract-schema.ts": "c1b433d2b09d7c1e98adae70b5754fe704fabb2ecc8e20347518a633e31f99d0",
|
|
38
38
|
"worker/src/utils/authority/intake-bake.ts": "7216e288e40673819295d999b3bdbf5e4319e1e21608e3b81eda9d102ff8d636",
|
|
39
39
|
"worker/src/utils/authority/role-domain-map.ts": "dc1b6abba79278a970cc5a07c4eb7ea73acac262425b489670e90508b95a5ff1",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"worker/src/utils/platform-compile-failure.ts": "eb4cea8a54599e2ca852b67f576a4402fb0281da4c7f45a7ed735bc36a684883",
|
|
70
70
|
"worker/src/utils/project-custom-hosts.ts": "ef693b4ea70f93fd66f3b3cda88ce68664540366caa33fa0169bf7bcfce80b2a",
|
|
71
71
|
"worker/src/utils/public-urls.ts": "44e455118f85c111316f6d8346d61e736ffcd1971c4539ea146100084aa6f21e",
|
|
72
|
-
"worker/src/utils/reference-check-inputs.ts": "
|
|
72
|
+
"worker/src/utils/reference-check-inputs.ts": "5ce10ee8feb59a7f31878243a6a4899d41f4e60e7af0687399693aeab7914b9a",
|
|
73
73
|
"worker/src/utils/telegram-attempt-receipts.ts": "a9ba55ae71f63ada44a105f1ceae04b0491bda0d6e77e5762db2dbecdd2981dd",
|
|
74
74
|
"worker/src/utils/telegram.ts": "9aaaa2597c366da1eeee9e2252e9b73e611ea97ed9558f7e07e694d9b393f053",
|
|
75
75
|
"worker/src/utils/workers-ai-comparison.ts": "18b5d5ea96f817387a5ef49733ba611c99cbb14987143c28118b1c90f3b637d4"
|
|
76
76
|
},
|
|
77
|
-
"sha256": "
|
|
77
|
+
"sha256": "bb7edd3ef9072fe1592f11bf8072e6d1fba6b9b8fd860db8e026cdcb7b64cbe8"
|
|
78
78
|
}
|
|
@@ -886,6 +886,8 @@ var require_groups_types = __commonJS({
|
|
|
886
886
|
const appRoles = (roles.appRoles || []).length ? literal(roles.appRoles) : "never";
|
|
887
887
|
return `
|
|
888
888
|
type SomewhereGroupRole = ${groupRoles};
|
|
889
|
+
// These methods validate role strings at runtime. Keep the known names in completions.
|
|
890
|
+
type SomewhereGroupRoleInput = SomewhereGroupRole | (string & {});
|
|
889
891
|
type SomewhereAppRole = ${appRoles};
|
|
890
892
|
|
|
891
893
|
interface SomewhereGroup {
|
|
@@ -1005,7 +1007,7 @@ interface SomewhereGroups {
|
|
|
1005
1007
|
* that verified email (the link, or any sign-in). The answer is the same in
|
|
1006
1008
|
* every case; no app call is needed. Inviting an address that already has a
|
|
1007
1009
|
* pending invitation sends nothing. */
|
|
1008
|
-
invite(req: Request, groupId: string, input: { email: string; role:
|
|
1010
|
+
invite(req: Request, groupId: string, input: { email: string; role: SomewhereGroupRoleInput; redirect_uri: string; expires_in?: number }): Promise<SomewhereGroupsResult<SomewhereGroupInvitation>>;
|
|
1009
1011
|
/** Pending invitations of one group (oldest first) that the signed-in member could revoke:
|
|
1010
1012
|
* ones they sent, and ones whose role they may grant. A non-member gets GROUP_NOT_FOUND. */
|
|
1011
1013
|
invitations(req: Request, groupId: string, opts?: SomewhereGroupsPageOptions): Promise<SomewhereGroupsResult<SomewhereGroupsPage<SomewhereGroupPendingInvitation>>>;
|
|
@@ -1013,9 +1015,9 @@ interface SomewhereGroups {
|
|
|
1013
1015
|
revokeInvitation(req: Request, inviteId: string): Promise<SomewhereGroupsResult<{ revoked: true }>>;
|
|
1014
1016
|
leave(req: Request, groupId: string): Promise<SomewhereGroupsResult<{ left: true }>>;
|
|
1015
1017
|
delete(req: Request, groupId: string): Promise<SomewhereGroupsResult<{ deleted: true }>>;
|
|
1016
|
-
add(req: Request, groupId: string, userId: string, role:
|
|
1018
|
+
add(req: Request, groupId: string, userId: string, role: SomewhereGroupRoleInput): Promise<SomewhereGroupsResult<{ user_id: string; role: SomewhereGroupRole }>>;
|
|
1017
1019
|
remove(req: Request, groupId: string, userId: string): Promise<SomewhereGroupsResult<{ removed: true }>>;
|
|
1018
|
-
setRole(req: Request, groupId: string, userId: string, role:
|
|
1020
|
+
setRole(req: Request, groupId: string, userId: string, role: SomewhereGroupRoleInput): Promise<SomewhereGroupsResult<{ user_id: string; role: SomewhereGroupRole }>>;
|
|
1019
1021
|
appRoles: {
|
|
1020
1022
|
list(req: Request, userId?: string, opts?: SomewhereGroupsPageOptions): Promise<SomewhereGroupsResult<SomewhereGroupsPage<SomewhereAppRoleGrant>>>;
|
|
1021
1023
|
grant(req: Request, userId: string, role: SomewhereAppRole): Promise<SomewhereGroupsResult<SomewhereAppRoleGrant>>;
|
|
@@ -2780,6 +2782,7 @@ interface SomewhereAiChatOptions {
|
|
|
2780
2782
|
interface SomewhereAiChatResult {
|
|
2781
2783
|
content: SomewhereAiContentBlock[];
|
|
2782
2784
|
text: string;
|
|
2785
|
+
// 'refusal' for a model safety stop.
|
|
2783
2786
|
stop_reason: string | null;
|
|
2784
2787
|
model: string | null;
|
|
2785
2788
|
provider: string;
|
|
@@ -3140,6 +3143,7 @@ interface SomewhereAgentRunResult extends Omit<SomewhereAiChatResult, 'cost'> {
|
|
|
3140
3143
|
tool_calls_made: number;
|
|
3141
3144
|
total_input_tokens: number;
|
|
3142
3145
|
total_output_tokens: number;
|
|
3146
|
+
// Includes 'model_refused', alongside the run's other stop conditions.
|
|
3143
3147
|
completion_reason: string;
|
|
3144
3148
|
// Non-enumerable: readable directly, dropped by spread / JSON.stringify.
|
|
3145
3149
|
readonly steps: SomewhereAgentStep[];
|
|
@@ -3245,6 +3249,7 @@ interface SomewhereEmailSendResult {
|
|
|
3245
3249
|
// A new send is 'sent' | 'pending' | 'captured'; a duplicate replays the stored state.
|
|
3246
3250
|
status: SomewhereEmailStatus;
|
|
3247
3251
|
duplicate?: true;
|
|
3252
|
+
environment?: 'preview';
|
|
3248
3253
|
sender?: { from: string; mode: 'platform_managed'; note: string };
|
|
3249
3254
|
test_inbox?: { address: string; delivered: false };
|
|
3250
3255
|
}
|
|
@@ -4024,13 +4029,24 @@ interface SomewhereEndpointConfig<Auth extends SomewhereEndpointAuth, Schema ext
|
|
|
4024
4029
|
annotations?: { readOnlyHint?: boolean; destructiveHint?: boolean; idempotentHint?: boolean; openWorldHint?: boolean };
|
|
4025
4030
|
} : never;
|
|
4026
4031
|
body?: Schema;
|
|
4027
|
-
|
|
4032
|
+
/** Rate limit such as '30/minute'. The runtime accepts spaces and ignores case. */
|
|
4033
|
+
rateLimit?: string;
|
|
4028
4034
|
cors?: 'same-origin' | '*' | readonly string[];
|
|
4029
4035
|
handler(
|
|
4030
4036
|
input: SomewhereEndpointInput<Auth, Schema extends SomewhereEndpointBodySchema ? __SomewhereEndpointBody<Schema> : null>,
|
|
4031
4037
|
sw: SomewhereRuntimeContext,
|
|
4032
4038
|
): unknown;
|
|
4033
4039
|
}
|
|
4040
|
+
interface SomewhereEndpointGlobal {
|
|
4041
|
+
endpoint<const Schema extends SomewhereEndpointBodySchema | undefined = undefined, Auth extends SomewhereEndpointAuth = 'none',
|
|
4042
|
+
const Roles extends readonly string[] | undefined = undefined>(
|
|
4043
|
+
config: SomewhereEndpointConfig<undefined extends Roles ? Auth : ([Auth] extends ['none'] ? 'required' : Auth), Schema>
|
|
4044
|
+
& { auth?: Auth; roles?: Roles },
|
|
4045
|
+
): (req: Request, sw: SomewhereRuntimeContext) => Promise<Response>;
|
|
4046
|
+
}
|
|
4047
|
+
declare module 'somewhere:runtime-endpoint' {
|
|
4048
|
+
export const sw: SomewhereEndpointGlobal;
|
|
4049
|
+
}
|
|
4034
4050
|
`;
|
|
4035
4051
|
var DECLARED_COLUMN_TYPES = { integer: "number", bigint: "string", number: "number", text: "string", timestamp: "string", boolean: "boolean", json: "__SomewhereJson", blob: "number[]" };
|
|
4036
4052
|
function declaredOwnerColumn2(name, table, scopes) {
|
|
@@ -4090,7 +4106,7 @@ var require_typed_files = __commonJS({
|
|
|
4090
4106
|
var crypto2 = require("node:crypto");
|
|
4091
4107
|
var MODULE_NAME = "somewhere:files";
|
|
4092
4108
|
var CLIENT_FILE2 = "__somewhere_files.d.ts";
|
|
4093
|
-
var
|
|
4109
|
+
var SINGLE_REQUEST_MAX_BYTES2 = 90 * 1024 * 1024;
|
|
4094
4110
|
function parseDeclaration(canonical) {
|
|
4095
4111
|
const parsed = JSON.parse(canonical);
|
|
4096
4112
|
if (!parsed || parsed.v !== 1 || !Array.isArray(parsed.collections)) throw new Error("declared_files is not a file collection declaration");
|
|
@@ -4132,7 +4148,7 @@ var require_typed_files = __commonJS({
|
|
|
4132
4148
|
}
|
|
4133
4149
|
return `${JSON.stringify(collection.name)}: { ${ops.join("; ")} }`;
|
|
4134
4150
|
}
|
|
4135
|
-
function describeFilesClient2(canonical, singleRequestMaxBytes =
|
|
4151
|
+
function describeFilesClient2(canonical, singleRequestMaxBytes = SINGLE_REQUEST_MAX_BYTES2) {
|
|
4136
4152
|
const collections = parseDeclaration(canonical);
|
|
4137
4153
|
const contract = crypto2.createHash("sha256").update(canonical).digest("hex");
|
|
4138
4154
|
const declaration = `declare module ${JSON.stringify(MODULE_NAME)} {
|
|
@@ -4250,7 +4266,7 @@ export{files};
|
|
|
4250
4266
|
}
|
|
4251
4267
|
};
|
|
4252
4268
|
}
|
|
4253
|
-
module2.exports = { MODULE_NAME, CLIENT_FILE: CLIENT_FILE2, SINGLE_REQUEST_MAX_BYTES, describeFilesClient: describeFilesClient2, generateFilesClient, virtualFilesPlugin };
|
|
4269
|
+
module2.exports = { MODULE_NAME, CLIENT_FILE: CLIENT_FILE2, SINGLE_REQUEST_MAX_BYTES: SINGLE_REQUEST_MAX_BYTES2, describeFilesClient: describeFilesClient2, generateFilesClient, virtualFilesPlugin };
|
|
4254
4270
|
}
|
|
4255
4271
|
});
|
|
4256
4272
|
|
|
@@ -4362,7 +4378,7 @@ var require_checker_contract = __commonJS({
|
|
|
4362
4378
|
var REFERENCE_SOURCE = /\.(?:tsx?|jsx?|mjs|cjs)$/;
|
|
4363
4379
|
var IGNORED_CODES = Object.freeze([2307, 7016, 2792, 6053]);
|
|
4364
4380
|
var REFERENCE_CODES = Object.freeze([2304, 2552, 2448, 2454, 18004]);
|
|
4365
|
-
var TYPE_SHAPE_CODES = Object.freeze([2339, 2551, 2345, 2322, 2554]);
|
|
4381
|
+
var TYPE_SHAPE_CODES = Object.freeze([2339, 2551, 2345, 2322, 2554, 2353, 2561, 2741, 2769, 18047]);
|
|
4366
4382
|
var PROJECT_TYPE_ROOTS = Object.freeze(["./node_modules/@types"]);
|
|
4367
4383
|
var ignored = new Set(IGNORED_CODES);
|
|
4368
4384
|
var reference = new Set(REFERENCE_CODES);
|
|
@@ -4398,6 +4414,22 @@ var require_checker_contract = __commonJS({
|
|
|
4398
4414
|
function localCheckCompilerOptions(projectCompilerOptions) {
|
|
4399
4415
|
return referenceCheckCompilerOptions(projectTsconfigCompilerOptions(projectCompilerOptions));
|
|
4400
4416
|
}
|
|
4417
|
+
function withEndpointBinding(ts, source, options) {
|
|
4418
|
+
if (!source || !ts.isExternalModule(source) || !/\bsw\b/.test(source.text)) return source;
|
|
4419
|
+
function usesEndpoint(node) {
|
|
4420
|
+
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "sw" && node.name.text === "endpoint") return true;
|
|
4421
|
+
return ts.forEachChild(node, usesEndpoint);
|
|
4422
|
+
}
|
|
4423
|
+
if (!usesEndpoint(source)) return source;
|
|
4424
|
+
ts.bindSourceFile(source, options);
|
|
4425
|
+
if (source.locals?.has("sw")) return source;
|
|
4426
|
+
return ts.createSourceFile(
|
|
4427
|
+
source.fileName,
|
|
4428
|
+
source.text + "\nimport { sw } from 'somewhere:runtime-endpoint';\n",
|
|
4429
|
+
options.target ?? ts.ScriptTarget.ES2022,
|
|
4430
|
+
true
|
|
4431
|
+
);
|
|
4432
|
+
}
|
|
4401
4433
|
function diagnosticNumber(code) {
|
|
4402
4434
|
if (typeof code === "number") return code;
|
|
4403
4435
|
const parsed = Number(String(code).replace(/^TS/i, ""));
|
|
@@ -4435,6 +4467,7 @@ var require_checker_contract = __commonJS({
|
|
|
4435
4467
|
referenceCheckCompilerOptions,
|
|
4436
4468
|
projectTsconfigCompilerOptions,
|
|
4437
4469
|
localCheckCompilerOptions,
|
|
4470
|
+
withEndpointBinding,
|
|
4438
4471
|
isIgnoredDiagnostic,
|
|
4439
4472
|
classifyDiagnostic,
|
|
4440
4473
|
diagnosticMessage
|
|
@@ -4523,8 +4556,8 @@ var require_consumer_contract = __commonJS({
|
|
|
4523
4556
|
"worker/containers/compile/consumer-contract.cjs"(exports2, module2) {
|
|
4524
4557
|
"use strict";
|
|
4525
4558
|
var CONSUMER_CONTRACT2 = Object.freeze({
|
|
4526
|
-
version:
|
|
4527
|
-
digest: "
|
|
4559
|
+
version: 44,
|
|
4560
|
+
digest: "07384f39fd3d7d3b4a2f19ec55a6c309476402fc2af096ae0cd47b46780cbd46"
|
|
4528
4561
|
});
|
|
4529
4562
|
var MEMBERSHIPS = "memberships: table({ id: id(), team_id: text(), member_id: text() }, { scope: owner(), client: { read: true } }),";
|
|
4530
4563
|
var SHARES = "shares: table({ id: id(), grantee_id: text() }, { scope: owner(), client: { read: true, create: ['grantee_id'], delete: true }, unique: [['user_id', 'grantee_id']] }),";
|
|
@@ -4634,11 +4667,13 @@ __export(declared_data_vendor_entry_exports, {
|
|
|
4634
4667
|
FILES_DECLARATION_FILE: () => import_typed_files2.CLIENT_FILE,
|
|
4635
4668
|
RUNTIME_CONTEXT_DECLARATION: () => import_runtime_types3.RUNTIME_CONTEXT_DECLARATION,
|
|
4636
4669
|
SCHEMA_DECLARATION: () => import_schema_types.SCHEMA_DECLARATION,
|
|
4670
|
+
SINGLE_REQUEST_MAX_BYTES: () => import_typed_files2.SINGLE_REQUEST_MAX_BYTES,
|
|
4637
4671
|
checkerContract: () => checkerContract,
|
|
4638
4672
|
consumerContractComponents: () => import_consumer_contract.consumerContractComponents,
|
|
4639
4673
|
consumerContractFingerprint: () => import_consumer_contract.consumerContractFingerprint,
|
|
4640
4674
|
consumerContractVerdict: () => import_consumer_contract.consumerContractVerdict,
|
|
4641
4675
|
declaredTablesFromFiles: () => declaredTablesFromFiles,
|
|
4676
|
+
filesContractFromFiles: () => filesContractFromFiles,
|
|
4642
4677
|
filesDeclarationFromFiles: () => filesDeclarationFromFiles,
|
|
4643
4678
|
generateFromFiles: () => generateFromFiles,
|
|
4644
4679
|
isPlainPageScript: () => isPlainPageScript,
|
|
@@ -8669,7 +8704,7 @@ function referenceCheckDeclaredTables(graphFiles, schemaOptions = {}) {
|
|
|
8669
8704
|
}
|
|
8670
8705
|
function referenceCheckDeclarations(graphFiles) {
|
|
8671
8706
|
return (0, import_generated_declarations_render.renderGeneratedDeclarationFiles)({
|
|
8672
|
-
declaredRoles:
|
|
8707
|
+
declaredRoles: declaredRolesFromSource(graphFiles),
|
|
8673
8708
|
declaredTables: referenceCheckDeclaredTables(graphFiles),
|
|
8674
8709
|
hasSchema: graphFiles["db/schema.ts"] !== void 0
|
|
8675
8710
|
});
|
|
@@ -8705,6 +8740,10 @@ function runtimeDeclarationFromFiles(files) {
|
|
|
8705
8740
|
function declaredTablesFromFiles(files) {
|
|
8706
8741
|
return (0, import_runtime_types2.declaredTablesDeclaration)(schemaAuthorityFromSource(files));
|
|
8707
8742
|
}
|
|
8743
|
+
function filesContractFromFiles(files) {
|
|
8744
|
+
const canonical = declaredFilesFromSource(files);
|
|
8745
|
+
return canonical ? (0, import_typed_files.describeFilesClient)(canonical).contract_digest : void 0;
|
|
8746
|
+
}
|
|
8708
8747
|
function filesDeclarationFromFiles(files) {
|
|
8709
8748
|
const canonical = declaredFilesFromSource(files);
|
|
8710
8749
|
return canonical ? (0, import_typed_files.describeFilesClient)(canonical).declaration : void 0;
|
|
@@ -8716,11 +8755,13 @@ function filesDeclarationFromFiles(files) {
|
|
|
8716
8755
|
FILES_DECLARATION_FILE,
|
|
8717
8756
|
RUNTIME_CONTEXT_DECLARATION,
|
|
8718
8757
|
SCHEMA_DECLARATION,
|
|
8758
|
+
SINGLE_REQUEST_MAX_BYTES,
|
|
8719
8759
|
checkerContract,
|
|
8720
8760
|
consumerContractComponents,
|
|
8721
8761
|
consumerContractFingerprint,
|
|
8722
8762
|
consumerContractVerdict,
|
|
8723
8763
|
declaredTablesFromFiles,
|
|
8764
|
+
filesContractFromFiles,
|
|
8724
8765
|
filesDeclarationFromFiles,
|
|
8725
8766
|
generateFromFiles,
|
|
8726
8767
|
isPlainPageScript,
|
package/src/testing.ts
CHANGED
|
@@ -16,6 +16,7 @@ export function waitForApp(page: BrowserPage, state: 'ready' | 'signed-in' | 'si
|
|
|
16
16
|
// Lazy project-local Playwright resolution keeps UserSession dependency-free.
|
|
17
17
|
export { test, expect, expectRefused, data, ready, type RefusalOptions, type TestUser, type NewUserOptions, type Person, type SignUpOptions, type SignInOptions, type FormSteps, type CodeSteps } from './lib/playwright-fixtures.js';
|
|
18
18
|
|
|
19
|
-
export { openTestApp, type TestApp, type TestActor } from './lib/testing-app.js';
|
|
19
|
+
export { openTestApp, type TestApp, type TestActor, type TestInboxMessage } from './lib/testing-app.js';
|
|
20
20
|
export { assertNoLeak, captureResponses } from './lib/test-response-capture.js';
|
|
21
21
|
export type { TestJob, TestJobOptions, TestJobTarget } from './lib/testing-jobs.js';
|
|
22
|
+
export type { FilesRequest } from './lib/test-files.js';
|