@newhomestar/sdk 0.8.12 → 0.8.14
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/events.js +3 -3
- package/dist/index.js +18 -1
- package/dist/integration.d.ts +20 -0
- package/dist/next.d.ts +19 -0
- package/package.json +1 -1
package/dist/events.js
CHANGED
|
@@ -782,7 +782,7 @@ export async function withInboundEvent(db, msg, handler) {
|
|
|
782
782
|
'Content-Type': 'application/json',
|
|
783
783
|
},
|
|
784
784
|
body: JSON.stringify({
|
|
785
|
-
|
|
785
|
+
queue: queueName,
|
|
786
786
|
msg_id: Number(msgId),
|
|
787
787
|
}),
|
|
788
788
|
});
|
|
@@ -892,7 +892,7 @@ export function startInboundConsumer(db, options) {
|
|
|
892
892
|
'Authorization': `Bearer ${serviceToken}`,
|
|
893
893
|
'Content-Type': 'application/json',
|
|
894
894
|
},
|
|
895
|
-
body: JSON.stringify({
|
|
895
|
+
body: JSON.stringify({ queue: queueName, msg_id: msgId }),
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
898
|
catch (err) {
|
|
@@ -923,7 +923,7 @@ export function startInboundConsumer(db, options) {
|
|
|
923
923
|
await fetch(`${eventsUrl}/events/queue/ack`, {
|
|
924
924
|
method: 'POST',
|
|
925
925
|
headers: { 'Authorization': `Bearer ${serviceToken}`, 'Content-Type': 'application/json' },
|
|
926
|
-
body: JSON.stringify({
|
|
926
|
+
body: JSON.stringify({ queue: queueName, msg_id: msgId }),
|
|
927
927
|
});
|
|
928
928
|
}
|
|
929
929
|
catch { /* best-effort */ }
|
package/dist/index.js
CHANGED
|
@@ -906,12 +906,29 @@ export function runHttpServer(def, opts = {}) {
|
|
|
906
906
|
// Resolve credentials (same flow as action handlers)
|
|
907
907
|
const credCtx = buildCredentialCtx(def.name, authToken);
|
|
908
908
|
const credentials = await credCtx.resolveCredentials();
|
|
909
|
-
//
|
|
909
|
+
// Extract and normalize the scope identifiers from the request body.
|
|
910
|
+
// The UI posts `{ config, remoteId, remoteType }`. Both may be null
|
|
911
|
+
// for legacy / unscoped lookups. We keep them typed so handlers
|
|
912
|
+
// using `ctx.remoteId` get proper autocomplete.
|
|
913
|
+
const rawRemoteId = req.body?.remoteId;
|
|
914
|
+
const rawRemoteType = req.body?.remoteType;
|
|
915
|
+
const remoteId = typeof rawRemoteId === 'string' && rawRemoteId.trim() !== ''
|
|
916
|
+
? rawRemoteId
|
|
917
|
+
: null;
|
|
918
|
+
const remoteType = rawRemoteType === 'account' || rawRemoteType === 'company'
|
|
919
|
+
? rawRemoteType
|
|
920
|
+
: null;
|
|
921
|
+
// Build OptionsContext for the handler. `remoteId`/`remoteType`
|
|
922
|
+
// let the handler scope its lookup to the currently-selected
|
|
923
|
+
// ticketing account / HRIS company (e.g. list only Jira
|
|
924
|
+
// projects tied to *this* account's connection).
|
|
910
925
|
const optionsCtx = {
|
|
911
926
|
fetch: credCtx.fetch,
|
|
912
927
|
config: req.body?.config ?? {},
|
|
913
928
|
credentials,
|
|
914
929
|
tenantId: req.auth?.sub ?? 'unknown',
|
|
930
|
+
remoteId,
|
|
931
|
+
remoteType,
|
|
915
932
|
};
|
|
916
933
|
// Run the optionsFetcher handler
|
|
917
934
|
console.log(`[nova] 🔧 Running optionsFetcher for config field "${field.key}"`);
|
package/dist/integration.d.ts
CHANGED
|
@@ -144,6 +144,26 @@ export interface OptionsContext {
|
|
|
144
144
|
credentials: ResolvedCredentials;
|
|
145
145
|
/** Tenant ID for calling internal Nova platform services */
|
|
146
146
|
tenantId: string;
|
|
147
|
+
/**
|
|
148
|
+
* Scope UUID this options lookup belongs to. For ticketing integrations
|
|
149
|
+
* this is the `TicketingAccount.id`; for HRIS integrations it's the
|
|
150
|
+
* `HrisCompany.id`. May be null/undefined when the caller hasn't
|
|
151
|
+
* selected a scope yet (legacy / unscoped lookups).
|
|
152
|
+
*
|
|
153
|
+
* Use this to filter the options query when the same user administers
|
|
154
|
+
* multiple accounts — e.g. only list Jira projects linked to this
|
|
155
|
+
* specific ticketing account's connection, not all of the user's
|
|
156
|
+
* accessible projects.
|
|
157
|
+
*/
|
|
158
|
+
remoteId?: string | null;
|
|
159
|
+
/**
|
|
160
|
+
* Scope type discriminator so the handler knows which domain the
|
|
161
|
+
* `remoteId` came from without having to infer it from the integration
|
|
162
|
+
* category.
|
|
163
|
+
* • "account" → ticketing (TicketingAccount.id)
|
|
164
|
+
* • "company" → HRIS (HrisCompany.id)
|
|
165
|
+
*/
|
|
166
|
+
remoteType?: 'account' | 'company' | null;
|
|
147
167
|
}
|
|
148
168
|
/**
|
|
149
169
|
* A handler function that fetches select options dynamically.
|
package/dist/next.d.ts
CHANGED
|
@@ -123,6 +123,19 @@ export interface NovaIamResourceDef {
|
|
|
123
123
|
parent_resource_path?: string;
|
|
124
124
|
/** Arbitrary metadata stored on the resource record */
|
|
125
125
|
metadata?: Record<string, unknown>;
|
|
126
|
+
/**
|
|
127
|
+
* Free-text grouping bucket used by Odyssey's role-edit modal to render
|
|
128
|
+
* top-level sections (e.g. 'core', 'manage', 'admin'). When omitted, the
|
|
129
|
+
* resource inherits the service-level default declared at `iam.scope`, then
|
|
130
|
+
* falls back to inheriting from its `parent_resource_path` if still unset.
|
|
131
|
+
* Common values:
|
|
132
|
+
* - 'core' → end-user / day-to-day modules (employees, leave, etc.)
|
|
133
|
+
* - 'manage' → manager / supervisor surfaces
|
|
134
|
+
* - 'admin' → administrative tools and settings
|
|
135
|
+
* Free-form — any string is accepted; the UI renders unknown values
|
|
136
|
+
* alphabetically after the canonical core/manage/admin order.
|
|
137
|
+
*/
|
|
138
|
+
scope?: string;
|
|
126
139
|
}
|
|
127
140
|
/**
|
|
128
141
|
* FGA check declared on a novaEndpoint() — runtime-only.
|
|
@@ -803,6 +816,12 @@ export interface ServiceDef {
|
|
|
803
816
|
*/
|
|
804
817
|
iam?: {
|
|
805
818
|
resources: NovaIamResourceDef[];
|
|
819
|
+
/**
|
|
820
|
+
* Service-level default `scope` applied to every resource that doesn't
|
|
821
|
+
* declare one explicitly. Free-text — common values: 'core', 'manage',
|
|
822
|
+
* 'admin'. See `NovaIamResourceDef.scope` for full inheritance rules.
|
|
823
|
+
*/
|
|
824
|
+
scope?: string;
|
|
806
825
|
};
|
|
807
826
|
}
|
|
808
827
|
/**
|
package/package.json
CHANGED