@spacefast/common 0.0.13 → 0.0.17
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/dist/agents/client-registry.d.ts +22 -0
- package/dist/agents/client-registry.js +41 -0
- package/dist/agents/connect-targets.d.ts +51 -6
- package/dist/agents/connect-targets.js +93 -28
- package/dist/brand.d.ts +0 -11
- package/dist/brand.js +0 -20
- package/dist/config/domains.d.ts +15 -6
- package/dist/config/domains.js +24 -10
- package/dist/config/postgres-budget.d.ts +3 -0
- package/dist/config/postgres-budget.js +6 -1
- package/dist/config/postgres-budget.json +2 -1
- package/dist/contracts/abuse.js +1 -1
- package/dist/contracts/access.d.ts +149 -44
- package/dist/contracts/access.js +94 -8
- package/dist/contracts/activity.js +5 -1
- package/dist/contracts/api-keys.js +9 -9
- package/dist/contracts/archives.js +11 -11
- package/dist/contracts/beta.js +1 -1
- package/dist/contracts/builds.js +14 -14
- package/dist/contracts/channels.js +2 -2
- package/dist/contracts/comments.d.ts +86 -15
- package/dist/contracts/comments.js +116 -20
- package/dist/contracts/common.d.ts +12 -12
- package/dist/contracts/common.js +33 -30
- package/dist/contracts/continuation.js +5 -5
- package/dist/contracts/data-source-routes.js +1 -1
- package/dist/contracts/device-auth.d.ts +6 -6
- package/dist/contracts/device-auth.js +12 -12
- package/dist/contracts/docs.d.ts +10 -10
- package/dist/contracts/domains.js +39 -33
- package/dist/contracts/enums.d.ts +2 -10
- package/dist/contracts/enums.js +0 -2
- package/dist/contracts/error-code-meta.d.ts +116 -47
- package/dist/contracts/error-code-meta.js +37 -16
- package/dist/contracts/error-codes.d.ts +7 -4
- package/dist/contracts/error-codes.js +46 -21
- package/dist/contracts/events.d.ts +10 -3
- package/dist/contracts/events.js +33 -5
- package/dist/contracts/execution.d.ts +26 -0
- package/dist/contracts/execution.js +21 -0
- package/dist/contracts/feature-lifecycle.d.ts +21 -24
- package/dist/contracts/feature-lifecycle.js +28 -26
- package/dist/contracts/features.js +4 -4
- package/dist/contracts/functions.d.ts +8 -140
- package/dist/contracts/functions.js +9 -19
- package/dist/contracts/git.d.ts +1 -1
- package/dist/contracts/grants.d.ts +96 -79
- package/dist/contracts/grants.js +130 -43
- package/dist/contracts/ids.d.ts +2 -2
- package/dist/contracts/ids.js +2 -4
- package/dist/contracts/internal.js +2 -2
- package/dist/contracts/mcp.d.ts +17 -556
- package/dist/contracts/mcp.js +9 -103
- package/dist/contracts/me.js +3 -4
- package/dist/contracts/notifications.d.ts +108 -0
- package/dist/contracts/notifications.js +54 -0
- package/dist/contracts/oauth-resources.d.ts +18 -1
- package/dist/contracts/oauth-resources.js +22 -2
- package/dist/contracts/operations.d.ts +2 -50
- package/dist/contracts/operations.js +0 -19
- package/dist/contracts/pages.d.ts +8 -4
- package/dist/contracts/pages.js +16 -3
- package/dist/contracts/platform.js +10 -8
- package/dist/contracts/problem-document.d.ts +14 -0
- package/dist/contracts/problem-document.js +35 -0
- package/dist/contracts/push-new.d.ts +21 -6
- package/dist/contracts/push-new.js +3 -7
- package/dist/contracts/resources.d.ts +8 -7
- package/dist/contracts/resources.js +9 -6
- package/dist/contracts/runtime-api.d.ts +162 -92
- package/dist/contracts/runtime-api.js +99 -27
- package/dist/contracts/runtime-app.d.ts +41 -11
- package/dist/contracts/runtime-app.js +22 -1
- package/dist/contracts/runtime-db.d.ts +424 -0
- package/dist/contracts/runtime-db.js +108 -0
- package/dist/contracts/runtime-storage.d.ts +120 -0
- package/dist/contracts/runtime-storage.js +40 -0
- package/dist/contracts/sf-config-v1.d.ts +49 -1
- package/dist/contracts/sf-config-v1.js +2 -2
- package/dist/contracts/sites.d.ts +1 -0
- package/dist/contracts/sites.js +20 -12
- package/dist/contracts/space-config.d.ts +62 -22
- package/dist/contracts/space-config.js +173 -47
- package/dist/contracts/spaces.d.ts +79 -45
- package/dist/contracts/spaces.js +66 -50
- package/dist/contracts/superadmin-spaces.d.ts +13 -2
- package/dist/contracts/superadmin-spaces.js +15 -0
- package/dist/contracts/superadmin-tenants.js +4 -4
- package/dist/contracts/superadmin.d.ts +4 -0
- package/dist/contracts/superadmin.js +14 -1
- package/dist/contracts/tags.d.ts +17 -17
- package/dist/contracts/tags.js +1 -1
- package/dist/contracts/teams.js +25 -16
- package/dist/contracts/theme-json.js +1 -1
- package/dist/contracts/transfers.js +4 -4
- package/dist/contracts/variables.js +3 -3
- package/dist/contracts/zero.d.ts +204 -338
- package/dist/contracts/zero.js +94 -98
- package/dist/dashboard-paths/index.d.ts +16 -1
- package/dist/dashboard-paths/index.js +18 -0
- package/dist/docs/agent-handoff-document.d.ts +2 -2
- package/dist/docs/agent-handoff-document.js +8 -7
- package/dist/docs/agent-prose.d.ts +22 -3
- package/dist/docs/agent-prose.js +221 -51
- package/dist/docs/agent-setup.d.ts +13 -10
- package/dist/docs/agent-setup.js +279 -53
- package/dist/docs/agent-solutions.d.ts +6 -6
- package/dist/docs/agent-solutions.js +23 -21
- package/dist/docs/catalog.d.ts +29 -74
- package/dist/docs/catalog.js +65 -92
- package/dist/docs/error-docs.js +293 -221
- package/dist/docs/skill-distribution.d.ts +2 -0
- package/dist/docs/skill-distribution.js +7 -4
- package/dist/docs/skills.d.ts +546 -0
- package/dist/docs/skills.js +340 -0
- package/dist/utils/browser-credential.d.ts +19 -0
- package/dist/utils/browser-credential.js +62 -0
- package/dist/utils/comment-avatars.d.ts +7 -0
- package/dist/utils/comment-avatars.js +42 -0
- package/dist/utils/content-type.d.ts +3 -3
- package/dist/utils/content-type.js +38 -61
- package/dist/utils/domain-diagnostics.d.ts +5 -5
- package/dist/utils/domain-diagnostics.js +21 -10
- package/dist/utils/local-space-state.d.ts +78 -4
- package/dist/utils/local-space-state.js +383 -82
- package/dist/utils/one-shot-replay.d.ts +14 -0
- package/dist/utils/one-shot-replay.js +21 -0
- package/dist/utils/page-preview.d.ts +7 -0
- package/dist/utils/page-preview.js +9 -0
- package/dist/utils/pages.d.ts +2 -11
- package/dist/utils/pages.js +58 -14
- package/dist/utils/publish-form-data.d.ts +22 -0
- package/dist/utils/publish-form-data.js +26 -0
- package/dist/utils/publish-policy.js +20 -4
- package/dist/utils/query-keys.d.ts +7 -4
- package/dist/utils/query-keys.js +13 -4
- package/dist/utils/runtime-paths.d.ts +3 -0
- package/dist/utils/runtime-paths.js +7 -0
- package/dist/utils/secure-local-file.d.ts +73 -0
- package/dist/utils/secure-local-file.js +1373 -0
- package/dist/utils/space-config.d.ts +13 -4
- package/dist/utils/space-config.js +123 -15
- package/dist/utils/storage-policy.d.ts +20 -0
- package/dist/utils/storage-policy.fixtures.json +174 -0
- package/dist/utils/storage-policy.js +193 -0
- package/dist/utils/upload-session.d.ts +12 -1
- package/dist/utils/upload-session.js +37 -2
- package/dist/utils/version-file-browser.d.ts +13 -0
- package/dist/utils/version-file-browser.js +59 -0
- package/package.json +19 -1
- package/dist/contracts/mounts.d.ts +0 -142
- package/dist/contracts/mounts.js +0 -56
- package/dist/utils/asset-fingerprint.d.ts +0 -64
- package/dist/utils/asset-fingerprint.js +0 -620
|
@@ -3,8 +3,20 @@ import { addressDnsInstructionIsObserved, addressDnsInstructionsForHostname, uns
|
|
|
3
3
|
export function domainRequiredActions(hostnameDiagnostics) {
|
|
4
4
|
const actions = [];
|
|
5
5
|
for (const entry of hostnameDiagnostics) {
|
|
6
|
-
const
|
|
7
|
-
?
|
|
6
|
+
const records = entry.dns.records
|
|
7
|
+
? {
|
|
8
|
+
a: entry.dns.records.a ?? [],
|
|
9
|
+
aaaa: entry.dns.records.aaaa ?? [],
|
|
10
|
+
}
|
|
11
|
+
: undefined;
|
|
12
|
+
const dnsInstructions = entry.dnsInstructions ?? [];
|
|
13
|
+
const providerIps = entry.providerIps ?? [];
|
|
14
|
+
const unsupportedRecords = records
|
|
15
|
+
? unsupportedAddressDnsRecordsForHostname({
|
|
16
|
+
hostname: entry.hostname,
|
|
17
|
+
dnsInstructions,
|
|
18
|
+
records,
|
|
19
|
+
})
|
|
8
20
|
: [];
|
|
9
21
|
actions.push(...unsupportedRecords.map((record) => ({
|
|
10
22
|
code: "dns_unaccepted_address",
|
|
@@ -12,13 +24,12 @@ export function domainRequiredActions(hostnameDiagnostics) {
|
|
|
12
24
|
message: `Remove the ${record.type} record on ${record.name} with value ${record.value}; it does not match a Spacefast target for this hostname.`,
|
|
13
25
|
})));
|
|
14
26
|
if (!entry.dns.pointsToProvider) {
|
|
15
|
-
const routingInstructions = addressDnsInstructionsForHostname(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}))
|
|
27
|
+
const routingInstructions = addressDnsInstructionsForHostname({
|
|
28
|
+
hostname: entry.hostname,
|
|
29
|
+
dnsInstructions,
|
|
30
|
+
});
|
|
31
|
+
const missingRoutingInstructions = records
|
|
32
|
+
? routingInstructions.filter((instruction) => !addressDnsInstructionIsObserved({ instruction, records }))
|
|
22
33
|
: routingInstructions;
|
|
23
34
|
if (missingRoutingInstructions.length > 0) {
|
|
24
35
|
actions.push(...missingRoutingInstructions.map((instruction) => ({
|
|
@@ -28,7 +39,7 @@ export function domainRequiredActions(hostnameDiagnostics) {
|
|
|
28
39
|
})));
|
|
29
40
|
}
|
|
30
41
|
else if (routingInstructions.length === 0) {
|
|
31
|
-
const targets =
|
|
42
|
+
const targets = providerIps.length > 0 ? providerIps.join(", ") : "Spacefast";
|
|
32
43
|
actions.push({
|
|
33
44
|
code: "dns_not_pointing",
|
|
34
45
|
hostname: entry.hostname,
|
|
@@ -13,15 +13,18 @@ export declare const LOCAL_SPACE_STATE_FILE_NAME = "state.json";
|
|
|
13
13
|
* `.spacefast/state.json` is the local credential/cache axis: it records the
|
|
14
14
|
* resolved `spaceId`, provider `apiUrl`, anonymous `claimToken` before claim,
|
|
15
15
|
* durable `accessToken` after continuation, and small publish caches such as
|
|
16
|
-
* `lastVersionId`. It is secret, machine-written, gitignored, and merge-written
|
|
17
|
-
*
|
|
16
|
+
* `lastVersionId`. It is secret, machine-written, gitignored, and merge-written.
|
|
17
|
+
* The strict versioned schema fails closed instead of letting an older tool
|
|
18
|
+
* reinterpret fields written under a contract it does not understand.
|
|
18
19
|
*/
|
|
19
20
|
export declare const localSpaceLinkSchema: z.ZodObject<{
|
|
20
21
|
team: z.ZodOptional<z.ZodString>;
|
|
21
22
|
space: z.ZodString;
|
|
22
23
|
apiBaseUrl: z.ZodOptional<z.ZodString>;
|
|
23
24
|
}, z.core.$loose>;
|
|
25
|
+
export declare const LOCAL_SPACE_STATE_SCHEMA_VERSION = 1;
|
|
24
26
|
export declare const localSpaceStateSchema: z.ZodObject<{
|
|
27
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
25
28
|
spaceId: z.ZodOptional<z.ZodString>;
|
|
26
29
|
apiUrl: z.ZodOptional<z.ZodString>;
|
|
27
30
|
teamSlug: z.ZodOptional<z.ZodString>;
|
|
@@ -30,11 +33,52 @@ export declare const localSpaceStateSchema: z.ZodObject<{
|
|
|
30
33
|
expiresAt: z.ZodOptional<z.ZodString>;
|
|
31
34
|
accessToken: z.ZodOptional<z.ZodString>;
|
|
32
35
|
lastVersionId: z.ZodOptional<z.ZodString>;
|
|
36
|
+
pendingOperationId: z.ZodOptional<z.ZodString>;
|
|
33
37
|
lastVersionUrl: z.ZodOptional<z.ZodString>;
|
|
34
38
|
lastSpaceUrl: z.ZodOptional<z.ZodString>;
|
|
35
|
-
|
|
39
|
+
/** Secret per-checkout entropy used only to namespace replay-safe first publishes. */
|
|
40
|
+
anonymousPublishNonce: z.ZodOptional<z.ZodString>;
|
|
41
|
+
/** Unsettled first-publish mutation. Retries must reuse this exact key. */
|
|
42
|
+
pendingPublish: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
key: z.ZodString;
|
|
44
|
+
principal: z.ZodString;
|
|
45
|
+
kind: z.ZodEnum<{
|
|
46
|
+
anonymous: "anonymous";
|
|
47
|
+
authenticated: "authenticated";
|
|
48
|
+
}>;
|
|
49
|
+
intent: z.ZodOptional<z.ZodString>;
|
|
50
|
+
createdAt: z.ZodString;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
/** Settled creation receipt identity retained for invocations that began before its commit. */
|
|
53
|
+
creationReplay: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
key: z.ZodString;
|
|
55
|
+
principal: z.ZodString;
|
|
56
|
+
kind: z.ZodEnum<{
|
|
57
|
+
anonymous: "anonymous";
|
|
58
|
+
authenticated: "authenticated";
|
|
59
|
+
}>;
|
|
60
|
+
intent: z.ZodOptional<z.ZodString>;
|
|
61
|
+
createdAt: z.ZodString;
|
|
62
|
+
}, z.core.$strict>>;
|
|
63
|
+
/** Random replay capability reserved before consuming a claim credential. */
|
|
64
|
+
pendingCredentialReplay: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
operation: z.ZodEnum<{
|
|
66
|
+
"claim-rotate": "claim-rotate";
|
|
67
|
+
"claim-exchange": "claim-exchange";
|
|
68
|
+
}>;
|
|
69
|
+
credentialFingerprint: z.ZodString;
|
|
70
|
+
key: z.ZodString;
|
|
71
|
+
principal: z.ZodString;
|
|
72
|
+
createdAt: z.ZodString;
|
|
73
|
+
}, z.core.$strict>>;
|
|
74
|
+
}, z.core.$strict>;
|
|
36
75
|
export type LocalSpaceLink = z.infer<typeof localSpaceLinkSchema>;
|
|
37
76
|
export type LocalSpaceStateFile = z.infer<typeof localSpaceStateSchema>;
|
|
77
|
+
export type LocalSpaceStateWrite = Omit<LocalSpaceStateFile, "schemaVersion"> & {
|
|
78
|
+
schemaVersion?: typeof LOCAL_SPACE_STATE_SCHEMA_VERSION;
|
|
79
|
+
};
|
|
80
|
+
export type LocalCredentialReplay = NonNullable<LocalSpaceStateFile["pendingCredentialReplay"]>;
|
|
81
|
+
export type LocalCredentialReplayOperation = LocalCredentialReplay["operation"];
|
|
38
82
|
export type DiscoveredLocalSpaceState = {
|
|
39
83
|
root: string;
|
|
40
84
|
statePath: string | null;
|
|
@@ -48,6 +92,7 @@ export type DiscoveredLocalSpaceState = {
|
|
|
48
92
|
claimUrl: string | undefined;
|
|
49
93
|
expiresAt: string | undefined;
|
|
50
94
|
lastVersionId: string | undefined;
|
|
95
|
+
pendingOperationId: string | undefined;
|
|
51
96
|
};
|
|
52
97
|
export type SaveLocalSpaceStateInput = {
|
|
53
98
|
spaceId: string;
|
|
@@ -58,9 +103,26 @@ export type SaveLocalSpaceStateInput = {
|
|
|
58
103
|
expiresAt?: string | undefined;
|
|
59
104
|
accessToken?: string | undefined;
|
|
60
105
|
lastVersionId?: string | undefined;
|
|
106
|
+
pendingOperationId?: string | undefined;
|
|
61
107
|
lastVersionUrl?: string | undefined;
|
|
62
108
|
lastSpaceUrl?: string | undefined;
|
|
109
|
+
/** Required when replacing one shown-once credential with another. */
|
|
110
|
+
expectedCredential?: {
|
|
111
|
+
claimToken?: string | undefined;
|
|
112
|
+
accessToken?: string | undefined;
|
|
113
|
+
};
|
|
114
|
+
/** Replay reservation completed by this shown-once credential replacement. */
|
|
115
|
+
credentialReplay?: LocalCredentialReplay | undefined;
|
|
116
|
+
/** Explicit relinks may replace another Space; ordinary cache writes may not. */
|
|
117
|
+
replaceSpace?: boolean | undefined;
|
|
63
118
|
};
|
|
119
|
+
export declare class LocalSpaceStateConflictError extends Error {
|
|
120
|
+
name: string;
|
|
121
|
+
}
|
|
122
|
+
export declare class LocalSpaceStateError extends Error {
|
|
123
|
+
readonly path: string;
|
|
124
|
+
constructor(filePath: string, cause?: unknown);
|
|
125
|
+
}
|
|
64
126
|
export declare function localSpaceStateDir(root: string): string;
|
|
65
127
|
export declare function localSpaceStatePath(root: string): string;
|
|
66
128
|
export declare function localSpaceLinkPath(root: string): string;
|
|
@@ -83,7 +145,19 @@ export declare function readLocalSpaceStateAt(root: string): Promise<DiscoveredL
|
|
|
83
145
|
export declare function findUpward<T>(probe: (dir: string) => Promise<T | null>, startDir?: string, boundary?: string): Promise<T | null>;
|
|
84
146
|
export declare function discoverLocalSpaceState(startDir?: string, boundary?: string): Promise<DiscoveredLocalSpaceState | null>;
|
|
85
147
|
export declare function writeLocalSpaceLink(root: string, link: LocalSpaceLink): Promise<string>;
|
|
86
|
-
export declare function
|
|
148
|
+
export declare function mutateLocalSpaceState(root: string, mutate: (current: LocalSpaceStateFile) => LocalSpaceStateWrite, options?: {
|
|
149
|
+
beforeCommit?: (() => void | Promise<void>) | undefined;
|
|
150
|
+
afterBackup?: (() => void | Promise<void>) | undefined;
|
|
151
|
+
/** Fault-injection observer used to synchronize concurrency tests. */
|
|
152
|
+
onConflict?: (() => void | Promise<void>) | undefined;
|
|
153
|
+
}): Promise<LocalSpaceStateFile>;
|
|
154
|
+
export declare function writeLocalSpaceState(root: string, state: LocalSpaceStateWrite): Promise<string>;
|
|
155
|
+
/** Reserve random replay custody before a claim token can be consumed. */
|
|
156
|
+
export declare function reserveLocalCredentialReplay(root: string, input: {
|
|
157
|
+
operation: LocalCredentialReplayOperation;
|
|
158
|
+
claimToken: string;
|
|
159
|
+
allowUnstoredClaimToken?: boolean | undefined;
|
|
160
|
+
}): Promise<LocalCredentialReplay>;
|
|
87
161
|
export declare function saveLocalSpaceState(root: string, input: SaveLocalSpaceStateInput): Promise<{
|
|
88
162
|
statePath: string;
|
|
89
163
|
linkPath: string;
|