@apotech-os/support-kit 4.1.0 → 5.0.0
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/index.cjs +21 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -15
- package/dist/index.d.ts +18 -15
- package/dist/index.js +21 -23
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -2029,10 +2029,10 @@ interface SupportPipelineConfig extends SupportKitFunctionConfig {
|
|
|
2029
2029
|
channel?: 'email' | 'whatsapp' | 'both';
|
|
2030
2030
|
};
|
|
2031
2031
|
}
|
|
2032
|
-
/**
|
|
2033
|
-
interface
|
|
2032
|
+
/** Un bloc de `manifest.integrations[]` — provider + scopes de ressource. */
|
|
2033
|
+
interface IntegrationRef {
|
|
2034
2034
|
provider: string;
|
|
2035
|
-
|
|
2035
|
+
scopes: string[];
|
|
2036
2036
|
}
|
|
2037
2037
|
interface SupportPipelineFragments {
|
|
2038
2038
|
records: RecordDef[];
|
|
@@ -2061,7 +2061,12 @@ interface SupportPipelineFragments {
|
|
|
2061
2061
|
* its manifest.
|
|
2062
2062
|
*/
|
|
2063
2063
|
settingsPage: SettingsPage;
|
|
2064
|
-
|
|
2064
|
+
/**
|
|
2065
|
+
* 4.0.0 — remplace le fragment `actions`. Les scopes de RESSOURCE dont les
|
|
2066
|
+
* adaptateurs du kit ont besoin chez Gorgias, à spread dans
|
|
2067
|
+
* `manifest.integrations`.
|
|
2068
|
+
*/
|
|
2069
|
+
integrations: IntegrationRef[];
|
|
2065
2070
|
/**
|
|
2066
2071
|
* `'NO_ACCESS'` (H2, T25 review): with no `defaultRole`, the platform
|
|
2067
2072
|
* grants every platform member `VIEWER` on install
|
|
@@ -2076,18 +2081,16 @@ interface SupportPipelineFragments {
|
|
|
2076
2081
|
handlers: Record<string, AppHandler>;
|
|
2077
2082
|
mergeRole(role: AppRole): AppRole;
|
|
2078
2083
|
/**
|
|
2079
|
-
*
|
|
2080
|
-
* `
|
|
2081
|
-
*
|
|
2082
|
-
*
|
|
2083
|
-
*
|
|
2084
|
-
*
|
|
2085
|
-
*
|
|
2086
|
-
*
|
|
2087
|
-
* `role: kit.mergeRole(ownRole)` keeps the two in lockstep by
|
|
2088
|
-
* construction.
|
|
2084
|
+
* 4.0.0 — remplace `mergeActions`. Fond les scopes du kit dans les
|
|
2085
|
+
* `integrations[]` de l'app appelante, en dédupliquant par provider et en
|
|
2086
|
+
* unionnant les scopes : `integrations: kit.mergeIntegrations(ownIntegrations)`.
|
|
2087
|
+
*
|
|
2088
|
+
* L'union est la bonne opération, pas le remplacement : une app qui déclare
|
|
2089
|
+
* déjà `read_tickets` pour son propre usage ne doit pas le perdre parce que le
|
|
2090
|
+
* kit déclare `write_tickets`. Et la déclaration reste une DEMANDE — c'est un
|
|
2091
|
+
* admin qui accorde, à l'install.
|
|
2089
2092
|
*/
|
|
2090
|
-
|
|
2093
|
+
mergeIntegrations(integrations: IntegrationRef[]): IntegrationRef[];
|
|
2091
2094
|
}
|
|
2092
2095
|
declare function buildSupportPipeline(config: SupportPipelineConfig): SupportPipelineFragments;
|
|
2093
2096
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2029,10 +2029,10 @@ interface SupportPipelineConfig extends SupportKitFunctionConfig {
|
|
|
2029
2029
|
channel?: 'email' | 'whatsapp' | 'both';
|
|
2030
2030
|
};
|
|
2031
2031
|
}
|
|
2032
|
-
/**
|
|
2033
|
-
interface
|
|
2032
|
+
/** Un bloc de `manifest.integrations[]` — provider + scopes de ressource. */
|
|
2033
|
+
interface IntegrationRef {
|
|
2034
2034
|
provider: string;
|
|
2035
|
-
|
|
2035
|
+
scopes: string[];
|
|
2036
2036
|
}
|
|
2037
2037
|
interface SupportPipelineFragments {
|
|
2038
2038
|
records: RecordDef[];
|
|
@@ -2061,7 +2061,12 @@ interface SupportPipelineFragments {
|
|
|
2061
2061
|
* its manifest.
|
|
2062
2062
|
*/
|
|
2063
2063
|
settingsPage: SettingsPage;
|
|
2064
|
-
|
|
2064
|
+
/**
|
|
2065
|
+
* 4.0.0 — remplace le fragment `actions`. Les scopes de RESSOURCE dont les
|
|
2066
|
+
* adaptateurs du kit ont besoin chez Gorgias, à spread dans
|
|
2067
|
+
* `manifest.integrations`.
|
|
2068
|
+
*/
|
|
2069
|
+
integrations: IntegrationRef[];
|
|
2065
2070
|
/**
|
|
2066
2071
|
* `'NO_ACCESS'` (H2, T25 review): with no `defaultRole`, the platform
|
|
2067
2072
|
* grants every platform member `VIEWER` on install
|
|
@@ -2076,18 +2081,16 @@ interface SupportPipelineFragments {
|
|
|
2076
2081
|
handlers: Record<string, AppHandler>;
|
|
2077
2082
|
mergeRole(role: AppRole): AppRole;
|
|
2078
2083
|
/**
|
|
2079
|
-
*
|
|
2080
|
-
* `
|
|
2081
|
-
*
|
|
2082
|
-
*
|
|
2083
|
-
*
|
|
2084
|
-
*
|
|
2085
|
-
*
|
|
2086
|
-
*
|
|
2087
|
-
* `role: kit.mergeRole(ownRole)` keeps the two in lockstep by
|
|
2088
|
-
* construction.
|
|
2084
|
+
* 4.0.0 — remplace `mergeActions`. Fond les scopes du kit dans les
|
|
2085
|
+
* `integrations[]` de l'app appelante, en dédupliquant par provider et en
|
|
2086
|
+
* unionnant les scopes : `integrations: kit.mergeIntegrations(ownIntegrations)`.
|
|
2087
|
+
*
|
|
2088
|
+
* L'union est la bonne opération, pas le remplacement : une app qui déclare
|
|
2089
|
+
* déjà `read_tickets` pour son propre usage ne doit pas le perdre parce que le
|
|
2090
|
+
* kit déclare `write_tickets`. Et la déclaration reste une DEMANDE — c'est un
|
|
2091
|
+
* admin qui accorde, à l'install.
|
|
2089
2092
|
*/
|
|
2090
|
-
|
|
2093
|
+
mergeIntegrations(integrations: IntegrationRef[]): IntegrationRef[];
|
|
2091
2094
|
}
|
|
2092
2095
|
declare function buildSupportPipeline(config: SupportPipelineConfig): SupportPipelineFragments;
|
|
2093
2096
|
|
package/dist/index.js
CHANGED
|
@@ -3878,30 +3878,23 @@ function pageIdentifierFor(config, key) {
|
|
|
3878
3878
|
}
|
|
3879
3879
|
return id;
|
|
3880
3880
|
}
|
|
3881
|
-
|
|
3882
|
-
// src/pipeline.ts
|
|
3883
|
-
var SUPPORT_KIT_GORGIAS_ACTIONS = [
|
|
3884
|
-
"applyTags",
|
|
3885
|
-
"buildTicketContext",
|
|
3886
|
-
"fetchTicketsFromView",
|
|
3887
|
-
"getRawTicket",
|
|
3888
|
-
"getTicketUrlBase",
|
|
3889
|
-
"getTicketWithContext",
|
|
3890
|
-
"listViews",
|
|
3891
|
-
"postWhatsappNote",
|
|
3892
|
-
"renameTicket",
|
|
3893
|
-
"replyEmail"
|
|
3894
|
-
];
|
|
3895
3881
|
var SUPPORT_KIT_CAPABILITIES = [
|
|
3896
3882
|
"runs",
|
|
3897
3883
|
"inbox",
|
|
3898
3884
|
"approvals",
|
|
3899
3885
|
"prompts",
|
|
3900
|
-
"langfuse"
|
|
3886
|
+
"langfuse",
|
|
3887
|
+
"llm"
|
|
3901
3888
|
];
|
|
3902
|
-
var
|
|
3903
|
-
|
|
3904
|
-
|
|
3889
|
+
var SUPPORT_KIT_GORGIAS_SCOPES = [
|
|
3890
|
+
"read_customers",
|
|
3891
|
+
"read_tickets",
|
|
3892
|
+
"read_views",
|
|
3893
|
+
"write_tags",
|
|
3894
|
+
"write_tickets"
|
|
3895
|
+
];
|
|
3896
|
+
var SUPPORT_KIT_INTEGRATIONS = [
|
|
3897
|
+
{ provider: "gorgias", scopes: [...SUPPORT_KIT_GORGIAS_SCOPES] }
|
|
3905
3898
|
];
|
|
3906
3899
|
var SUPPORT_KIT_EMITS = [TRIAGE_RUN_REQUESTED_EVENT];
|
|
3907
3900
|
var FUNCTION_ASSEMBLY = [
|
|
@@ -4008,8 +4001,14 @@ function dedupe(items, keyOf) {
|
|
|
4008
4001
|
for (const item of items) seen.set(keyOf(item), item);
|
|
4009
4002
|
return [...seen.values()];
|
|
4010
4003
|
}
|
|
4011
|
-
function
|
|
4012
|
-
|
|
4004
|
+
function mergeIntegrationRefs(integrations) {
|
|
4005
|
+
const byProvider = /* @__PURE__ */ new Map();
|
|
4006
|
+
for (const entry of [...integrations, ...SUPPORT_KIT_INTEGRATIONS]) {
|
|
4007
|
+
const scopes = byProvider.get(entry.provider) ?? /* @__PURE__ */ new Set();
|
|
4008
|
+
for (const scope of entry.scopes) scopes.add(scope);
|
|
4009
|
+
byProvider.set(entry.provider, scopes);
|
|
4010
|
+
}
|
|
4011
|
+
return [...byProvider.entries()].map(([provider, scopes]) => ({ provider, scopes: [...scopes].sort() })).sort((a, b) => a.provider.localeCompare(b.provider));
|
|
4013
4012
|
}
|
|
4014
4013
|
var KIT_READ_ONLY_OBJECT_KEYS = ["category", "category-group"];
|
|
4015
4014
|
var KIT_WRITE_ONLY_OBJECT_KEYS = ["evaluation", "diff-analysis"];
|
|
@@ -4023,7 +4022,6 @@ function buildMergeRole(config) {
|
|
|
4023
4022
|
...role,
|
|
4024
4023
|
reads: dedupe([...role.reads, ...kitReadRefs], (ref) => ref),
|
|
4025
4024
|
writes: dedupe([...role.writes, ...kitWriteRefs], (ref) => ref),
|
|
4026
|
-
actions: mergeActionRefs(role.actions),
|
|
4027
4025
|
capabilities: dedupe([...role.capabilities ?? [], ...SUPPORT_KIT_CAPABILITIES], (c) => c),
|
|
4028
4026
|
prompts: dedupe([...role.prompts ?? [], ...kitPrompts], (p) => p)
|
|
4029
4027
|
});
|
|
@@ -4090,12 +4088,12 @@ function buildSupportPipeline(config) {
|
|
|
4090
4088
|
pages: buildPages(config),
|
|
4091
4089
|
navigation: buildNavigation(config),
|
|
4092
4090
|
settingsPage: buildSettingsPage(config),
|
|
4093
|
-
|
|
4091
|
+
integrations: SUPPORT_KIT_INTEGRATIONS,
|
|
4094
4092
|
emits: SUPPORT_KIT_EMITS,
|
|
4095
4093
|
defaultRole: "NO_ACCESS",
|
|
4096
4094
|
handlers,
|
|
4097
4095
|
mergeRole: buildMergeRole(config),
|
|
4098
|
-
|
|
4096
|
+
mergeIntegrations: mergeIntegrationRefs
|
|
4099
4097
|
};
|
|
4100
4098
|
}
|
|
4101
4099
|
|