@pithy-sh/support 0.8.0 → 0.8.2
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/provision/resolveSupportConfig.d.ts +6 -1
- package/dist/provision/resolveSupportConfig.d.ts.map +1 -1
- package/dist/provision/resolveSupportConfig.js +5 -2
- package/dist/semantic/messageIndex.d.ts +3 -2
- package/dist/semantic/messageIndex.d.ts.map +1 -1
- package/dist/semantic/messageIndex.js +5 -4
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +8 -8
- package/src/provision/resolveSupportConfig.ts +11 -2
- package/src/semantic/messageIndex.ts +10 -4
- package/src/version.generated.ts +1 -1
|
@@ -33,10 +33,15 @@ export interface SupportConfigParams {
|
|
|
33
33
|
/** The target environment. */
|
|
34
34
|
env: ManagedEnvironment;
|
|
35
35
|
/**
|
|
36
|
-
* **The feature this host serves, when it serves one
|
|
36
|
+
* **The feature this host serves, when it serves one.** Its Worker, its Workflows and every store
|
|
37
37
|
* entry it binds then take the feature's names, as every feature host's do; `env` is `feature`.
|
|
38
38
|
*/
|
|
39
39
|
feature?: FeatureIdentity;
|
|
40
|
+
/**
|
|
41
|
+
* The `apps/<owner>` Worker whose own host this is, when it owns a binding the host binds. The Worker and its
|
|
42
|
+
* Workflows then carry `<owner>---<capability>`, so it never takes the shared host's names.
|
|
43
|
+
*/
|
|
44
|
+
owner?: string;
|
|
40
45
|
/** The app database id for this environment — where the support tables live. */
|
|
41
46
|
appDatabaseId: string;
|
|
42
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSupportConfig.d.ts","sourceRoot":"","sources":["../../src/provision/resolveSupportConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACpH,OAAO,KAAK,EAAE,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BAAgB,oBAAoB,CAClC,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,CAkCtB"}
|
|
@@ -7,9 +7,10 @@ import { hostWorkflowsFor, resolveWorkflowHost } from "@pithy-sh/core/src/workfl
|
|
|
7
7
|
/** Fill the template for one environment. */
|
|
8
8
|
function resolveSupportConfig(template, params) {
|
|
9
9
|
const feature = params.feature;
|
|
10
|
+
const owner = params.owner;
|
|
10
11
|
const { project, env } = params;
|
|
11
12
|
const index = supportMessageIndex(params.supportConfig.search);
|
|
12
|
-
const indexName = index ? supportMessageIndexName(project, env, feature) : void 0;
|
|
13
|
+
const indexName = index ? supportMessageIndexName(project, env, feature, owner) : void 0;
|
|
13
14
|
return resolveWorkflowHost(index && indexName ? {
|
|
14
15
|
...template,
|
|
15
16
|
vectorize: [{
|
|
@@ -22,6 +23,7 @@ function resolveSupportConfig(template, params) {
|
|
|
22
23
|
capability: SUPPORT_CAPABILITY,
|
|
23
24
|
env,
|
|
24
25
|
...feature ? { feature } : {},
|
|
26
|
+
...owner !== void 0 ? { owner } : {},
|
|
25
27
|
databaseIds: { DB: params.appDatabaseId },
|
|
26
28
|
...index && indexName ? { vectorizeIndexNames: { [index.binding]: indexName } } : {},
|
|
27
29
|
remoteBindings: index ? ["AI", index.binding] : ["AI"],
|
|
@@ -30,7 +32,8 @@ function resolveSupportConfig(template, params) {
|
|
|
30
32
|
project,
|
|
31
33
|
capability: SUPPORT_CAPABILITY,
|
|
32
34
|
env,
|
|
33
|
-
...feature ? { feature } : {}
|
|
35
|
+
...feature ? { feature } : {},
|
|
36
|
+
...owner !== void 0 ? { owner } : {}
|
|
34
37
|
}).workflows
|
|
35
38
|
});
|
|
36
39
|
}
|
|
@@ -35,12 +35,13 @@ export declare function supportMessageIndex(search: SupportSearchConfig): Vector
|
|
|
35
35
|
*/
|
|
36
36
|
export declare function supportMessageIndexShape(search: SupportSearchConfig): VectorIndexShape | undefined;
|
|
37
37
|
/**
|
|
38
|
-
* The index's Cloudflare name — `<project>-<env>-support-messages`, or a feature's own.
|
|
38
|
+
* The index's Cloudflare name — `<project>-<env>-support-messages`, or a feature's own. A Worker's own support host
|
|
39
|
+
* fills `<project>-<env>-<owner>---support-messages`: its vectors are keyed to the rows of its own database.
|
|
39
40
|
*
|
|
40
41
|
* Through the naming facade, which refuses a Vectorize name over 64 bytes rather than truncating it: a shortened
|
|
41
42
|
* name is a different, empty index.
|
|
42
43
|
*/
|
|
43
|
-
export declare function supportMessageIndexName(project: string, env: string, feature?: FeatureIdentity): string;
|
|
44
|
+
export declare function supportMessageIndexName(project: string, env: string, feature?: FeatureIdentity, owner?: string): string;
|
|
44
45
|
/** The text one message is embedded as: its subject, then its body, bounded. */
|
|
45
46
|
export declare function embeddingText(subject: string, body: string): string;
|
|
46
47
|
//# sourceMappingURL=messageIndex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageIndex.d.ts","sourceRoot":"","sources":["../../src/semantic/messageIndex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAA6B,MAAM,mCAAmC,CAAC;AAEpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,KAAK,mBAAmB,EAAmB,MAAM,kBAAkB,CAAC;AAE7E;;;;;;;;;;;GAWG;AAEH,6GAA6G;AAC7G,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD,yGAAyG;AACzG,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAE7D,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,iBAAiB,GAAG,SAAS,CAU9F;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,SAAS,CAGlG;AAED
|
|
1
|
+
{"version":3,"file":"messageIndex.d.ts","sourceRoot":"","sources":["../../src/semantic/messageIndex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAA6B,MAAM,mCAAmC,CAAC;AAEpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,KAAK,mBAAmB,EAAmB,MAAM,kBAAkB,CAAC;AAE7E;;;;;;;;;;;GAWG;AAEH,6GAA6G;AAC7G,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD,yGAAyG;AACzG,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAE7D,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,iBAAiB,GAAG,SAAS,CAU9F;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,SAAS,CAGlG;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,EACzB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAGR;AAED,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnE"}
|
|
@@ -50,14 +50,15 @@ function supportMessageIndexShape(search) {
|
|
|
50
50
|
} : void 0;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* The index's Cloudflare name — `<project>-<env>-support-messages`, or a feature's own.
|
|
53
|
+
* The index's Cloudflare name — `<project>-<env>-support-messages`, or a feature's own. A Worker's own support host
|
|
54
|
+
* fills `<project>-<env>-<owner>---support-messages`: its vectors are keyed to the rows of its own database.
|
|
54
55
|
*
|
|
55
56
|
* Through the naming facade, which refuses a Vectorize name over 64 bytes rather than truncating it: a shortened
|
|
56
57
|
* name is a different, empty index.
|
|
57
58
|
*/
|
|
58
|
-
function supportMessageIndexName(project, env, feature) {
|
|
59
|
-
if (feature) return featureVectorizeIndexName(feature, SUPPORT_MESSAGES_INDEX);
|
|
60
|
-
return resourceNames(project).env(env).vectorizeIndex(SUPPORT_MESSAGES_INDEX);
|
|
59
|
+
function supportMessageIndexName(project, env, feature, owner) {
|
|
60
|
+
if (feature) return featureVectorizeIndexName(feature, SUPPORT_MESSAGES_INDEX, owner);
|
|
61
|
+
return resourceNames(project).env(env).vectorizeIndex(SUPPORT_MESSAGES_INDEX, owner);
|
|
61
62
|
}
|
|
62
63
|
/** The text one message is embedded as: its subject, then its body, bounded. */
|
|
63
64
|
function embeddingText(subject, body) {
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
/** This package's npm name — the join key against a release feed. */
|
|
4
4
|
export declare const PACKAGE_NAME = "@pithy-sh/support";
|
|
5
5
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
6
|
-
export declare const PACKAGE_VERSION = "0.8.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.8.2";
|
|
7
7
|
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
/** This package's npm name — the join key against a release feed. */
|
|
5
5
|
const PACKAGE_NAME = "@pithy-sh/support";
|
|
6
6
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
7
|
-
const PACKAGE_VERSION = "0.8.
|
|
7
|
+
const PACKAGE_VERSION = "0.8.2";
|
|
8
8
|
//#endregion
|
|
9
9
|
export { PACKAGE_NAME, PACKAGE_VERSION };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/support",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"tldts": "^7.4.10"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@pithy-sh/auth": "^0.
|
|
44
|
-
"@pithy-sh/core": "^0.
|
|
45
|
-
"@pithy-sh/email": "^0.10.
|
|
46
|
-
"@pithy-sh/payments": "^0.8.
|
|
47
|
-
"@pithy-sh/secrets": "^0.6.
|
|
48
|
-
"@pithy-sh/storage": "^0.7.
|
|
49
|
-
"@pithy-sh/vector": "^0.5.
|
|
43
|
+
"@pithy-sh/auth": "^0.15.0",
|
|
44
|
+
"@pithy-sh/core": "^0.20.0",
|
|
45
|
+
"@pithy-sh/email": "^0.10.2",
|
|
46
|
+
"@pithy-sh/payments": "^0.8.3",
|
|
47
|
+
"@pithy-sh/secrets": "^0.6.8",
|
|
48
|
+
"@pithy-sh/storage": "^0.7.6",
|
|
49
|
+
"@pithy-sh/vector": "^0.5.8",
|
|
50
50
|
"hono": "^4.13.2",
|
|
51
51
|
"kysely": "^0.29.0",
|
|
52
52
|
"zod": "^4.4.0"
|
|
@@ -38,10 +38,15 @@ export interface SupportConfigParams {
|
|
|
38
38
|
/** The target environment. */
|
|
39
39
|
env: ManagedEnvironment;
|
|
40
40
|
/**
|
|
41
|
-
* **The feature this host serves, when it serves one
|
|
41
|
+
* **The feature this host serves, when it serves one.** Its Worker, its Workflows and every store
|
|
42
42
|
* entry it binds then take the feature's names, as every feature host's do; `env` is `feature`.
|
|
43
43
|
*/
|
|
44
44
|
feature?: FeatureIdentity;
|
|
45
|
+
/**
|
|
46
|
+
* The `apps/<owner>` Worker whose own host this is, when it owns a binding the host binds. The Worker and its
|
|
47
|
+
* Workflows then carry `<owner>---<capability>`, so it never takes the shared host's names.
|
|
48
|
+
*/
|
|
49
|
+
owner?: string;
|
|
45
50
|
/** The app database id for this environment — where the support tables live. */
|
|
46
51
|
appDatabaseId: string;
|
|
47
52
|
/**
|
|
@@ -60,11 +65,13 @@ export function resolveSupportConfig(
|
|
|
60
65
|
params: SupportConfigParams,
|
|
61
66
|
): WorkflowHostTemplate {
|
|
62
67
|
const feature = params.feature;
|
|
68
|
+
const owner = params.owner;
|
|
63
69
|
const { project, env } = params;
|
|
64
70
|
// The semantic message index, only when `search.semantic` is on. The template carries no `vectorize`
|
|
65
71
|
// entry because most inboxes have none; one is added here, named the way provisioning created it.
|
|
66
72
|
const index = supportMessageIndex(params.supportConfig.search);
|
|
67
|
-
|
|
73
|
+
// A Worker's own host fills an index of its own: its vectors are keyed to the rows of its own database.
|
|
74
|
+
const indexName = index ? supportMessageIndexName(project, env, feature, owner) : undefined;
|
|
68
75
|
return resolveWorkflowHost(
|
|
69
76
|
index && indexName
|
|
70
77
|
? { ...template, vectorize: [{ binding: index.binding, index_name: indexName, remote: true }] }
|
|
@@ -74,6 +81,7 @@ export function resolveSupportConfig(
|
|
|
74
81
|
capability: SUPPORT_CAPABILITY,
|
|
75
82
|
env,
|
|
76
83
|
...(feature ? { feature } : {}),
|
|
84
|
+
...(owner !== undefined ? { owner } : {}),
|
|
77
85
|
databaseIds: { DB: params.appDatabaseId },
|
|
78
86
|
...(index && indexName ? { vectorizeIndexNames: { [index.binding]: indexName } } : {}),
|
|
79
87
|
remoteBindings: index ? ["AI", index.binding] : ["AI"],
|
|
@@ -85,6 +93,7 @@ export function resolveSupportConfig(
|
|
|
85
93
|
capability: SUPPORT_CAPABILITY,
|
|
86
94
|
env,
|
|
87
95
|
...(feature ? { feature } : {}),
|
|
96
|
+
...(owner !== undefined ? { owner } : {}),
|
|
88
97
|
}).workflows,
|
|
89
98
|
},
|
|
90
99
|
);
|
|
@@ -58,14 +58,20 @@ export function supportMessageIndexShape(search: SupportSearchConfig): VectorInd
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* The index's Cloudflare name — `<project>-<env>-support-messages`, or a feature's own.
|
|
61
|
+
* The index's Cloudflare name — `<project>-<env>-support-messages`, or a feature's own. A Worker's own support host
|
|
62
|
+
* fills `<project>-<env>-<owner>---support-messages`: its vectors are keyed to the rows of its own database.
|
|
62
63
|
*
|
|
63
64
|
* Through the naming facade, which refuses a Vectorize name over 64 bytes rather than truncating it: a shortened
|
|
64
65
|
* name is a different, empty index.
|
|
65
66
|
*/
|
|
66
|
-
export function supportMessageIndexName(
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
export function supportMessageIndexName(
|
|
68
|
+
project: string,
|
|
69
|
+
env: string,
|
|
70
|
+
feature?: FeatureIdentity,
|
|
71
|
+
owner?: string,
|
|
72
|
+
): string {
|
|
73
|
+
if (feature) return featureVectorizeIndexName(feature, SUPPORT_MESSAGES_INDEX, owner);
|
|
74
|
+
return resourceNames(project).env(env).vectorizeIndex(SUPPORT_MESSAGES_INDEX, owner);
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
/** The text one message is embedded as: its subject, then its body, bounded. */
|
package/src/version.generated.ts
CHANGED