@globiguard/sdk 1.0.0 → 1.0.1

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.
Files changed (71) hide show
  1. package/LICENSE +128 -0
  2. package/README.md +80 -0
  3. package/dist/bootstrap.d.ts +5 -0
  4. package/dist/bootstrap.d.ts.map +1 -0
  5. package/dist/bootstrap.js +67 -0
  6. package/dist/bootstrap.js.map +1 -0
  7. package/dist/client.d.ts +61 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +260 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/entitlements.node.d.ts +12 -0
  12. package/dist/entitlements.node.d.ts.map +1 -0
  13. package/dist/entitlements.node.js +215 -0
  14. package/dist/entitlements.node.js.map +1 -0
  15. package/dist/errors.d.ts +21 -0
  16. package/dist/errors.d.ts.map +1 -0
  17. package/dist/errors.js +46 -0
  18. package/dist/errors.js.map +1 -0
  19. package/dist/fetch.d.ts +21 -0
  20. package/dist/fetch.d.ts.map +1 -0
  21. package/dist/fetch.js +151 -0
  22. package/dist/fetch.js.map +1 -0
  23. package/dist/governed-actions.d.ts +34 -0
  24. package/dist/governed-actions.d.ts.map +1 -0
  25. package/dist/governed-actions.js +146 -0
  26. package/dist/governed-actions.js.map +1 -0
  27. package/dist/index.d.ts +14 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +14 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/realtime.d.ts +21 -0
  32. package/dist/realtime.d.ts.map +1 -0
  33. package/dist/realtime.js +265 -0
  34. package/dist/realtime.js.map +1 -0
  35. package/dist/resources/actions.d.ts +5 -0
  36. package/dist/resources/actions.d.ts.map +1 -0
  37. package/dist/resources/actions.js +48 -0
  38. package/dist/resources/actions.js.map +1 -0
  39. package/dist/resources/audit.d.ts +5 -0
  40. package/dist/resources/audit.d.ts.map +1 -0
  41. package/dist/resources/audit.js +62 -0
  42. package/dist/resources/audit.js.map +1 -0
  43. package/dist/resources/installs.d.ts +4 -0
  44. package/dist/resources/installs.d.ts.map +1 -0
  45. package/dist/resources/installs.js +19 -0
  46. package/dist/resources/installs.js.map +1 -0
  47. package/dist/resources/orgs.d.ts +4 -0
  48. package/dist/resources/orgs.d.ts.map +1 -0
  49. package/dist/resources/orgs.js +48 -0
  50. package/dist/resources/orgs.js.map +1 -0
  51. package/dist/resources/path-segments.d.ts +2 -0
  52. package/dist/resources/path-segments.d.ts.map +1 -0
  53. package/dist/resources/path-segments.js +4 -0
  54. package/dist/resources/path-segments.js.map +1 -0
  55. package/dist/resources/policies.d.ts +5 -0
  56. package/dist/resources/policies.d.ts.map +1 -0
  57. package/dist/resources/policies.js +64 -0
  58. package/dist/resources/policies.js.map +1 -0
  59. package/dist/resources/queue.d.ts +5 -0
  60. package/dist/resources/queue.d.ts.map +1 -0
  61. package/dist/resources/queue.js +36 -0
  62. package/dist/resources/queue.js.map +1 -0
  63. package/dist/resources/workflows.d.ts +5 -0
  64. package/dist/resources/workflows.d.ts.map +1 -0
  65. package/dist/resources/workflows.js +63 -0
  66. package/dist/resources/workflows.js.map +1 -0
  67. package/dist/server.d.ts +8 -0
  68. package/dist/server.d.ts.map +1 -0
  69. package/dist/server.js +128 -0
  70. package/dist/server.js.map +1 -0
  71. package/package.json +49 -3
package/LICENSE ADDED
@@ -0,0 +1,128 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and
27
+ configuration files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object
31
+ code, generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original
45
+ version of the Work and any modifications or additions to that Work or
46
+ Derivative Works thereof, that is intentionally submitted to Licensor for
47
+ inclusion in the Work by the copyright owner or by an individual or Legal
48
+ Entity authorized to submit on behalf of the copyright owner.
49
+
50
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
51
+ of whom a Contribution has been received by Licensor and subsequently
52
+ incorporated within the Work.
53
+
54
+ 2. Grant of Copyright License.
55
+
56
+ Subject to the terms and conditions of this License, each Contributor hereby
57
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
58
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
59
+ publicly display, publicly perform, sublicense, and distribute the Work and
60
+ such Derivative Works in Source or Object form.
61
+
62
+ 3. Grant of Patent License.
63
+
64
+ Subject to the terms and conditions of this License, each Contributor hereby
65
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
66
+ irrevocable patent license to make, have made, use, offer to sell, sell,
67
+ import, and otherwise transfer the Work.
68
+
69
+ 4. Redistribution.
70
+
71
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
72
+ in any medium, with or without modifications, and in Source or Object form,
73
+ provided that You meet the following conditions:
74
+
75
+ (a) You must give any other recipients of the Work or Derivative Works a copy
76
+ of this License; and
77
+
78
+ (b) You must cause any modified files to carry prominent notices stating that
79
+ You changed the files; and
80
+
81
+ (c) You must retain, in the Source form of any Derivative Works that You
82
+ distribute, all copyright, patent, trademark, and attribution notices from the
83
+ Source form of the Work, excluding those notices that do not pertain to any
84
+ part of the Derivative Works; and
85
+
86
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
87
+ any Derivative Works that You distribute must include a readable copy of the
88
+ attribution notices contained within such NOTICE file, excluding those notices
89
+ that do not pertain to any part of the Derivative Works, in at least one of the
90
+ following places: within a NOTICE text file distributed as part of the
91
+ Derivative Works; within the Source form or documentation, if provided along
92
+ with the Derivative Works; or within a display generated by the Derivative
93
+ Works, if and wherever such third-party notices normally appear.
94
+
95
+ 5. Submission of Contributions.
96
+
97
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
98
+ for inclusion in the Work by You to the Licensor shall be under the terms and
99
+ conditions of this License, without any additional terms or conditions.
100
+
101
+ 6. Trademarks.
102
+
103
+ This License does not grant permission to use the trade names, trademarks,
104
+ service marks, or product names of the Licensor, except as required for
105
+ reasonable and customary use in describing the origin of the Work.
106
+
107
+ 7. Disclaimer of Warranty.
108
+
109
+ Unless required by applicable law or agreed to in writing, Licensor provides
110
+ the Work on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
111
+ either express or implied, including, without limitation, any warranties or
112
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
113
+ PARTICULAR PURPOSE.
114
+
115
+ 8. Limitation of Liability.
116
+
117
+ In no event and under no legal theory, whether in tort (including negligence),
118
+ contract, or otherwise, unless required by applicable law, shall any
119
+ Contributor be liable to You for damages, including any direct, indirect,
120
+ special, incidental, or consequential damages of any character arising as a
121
+ result of this License or out of the use or inability to use the Work.
122
+
123
+ 9. Accepting Warranty or Additional Liability.
124
+
125
+ While redistributing the Work or Derivative Works thereof, You may choose to
126
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
127
+ other liability obligations and/or rights consistent with this License.
128
+
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # @globiguard/sdk
2
+
3
+ Server-first TypeScript SDK for the GlobiGuard control plane and trusted brain
4
+ connectivity.
5
+
6
+ ## Runtime expectations
7
+
8
+ - Node.js **22+** for server usage
9
+ - standards-based `fetch`, `Headers`, `FormData`, and `Blob` support
10
+ - browser usage is supported only through the browser-safe client surface
11
+
12
+ ## Trust-boundary rule
13
+
14
+ `createBrowserClient()` stops at the control plane.
15
+
16
+ Direct brain access is reserved for `createServerClient()` in trusted runtimes
17
+ using secret or local credentials.
18
+
19
+ ## Surface split
20
+
21
+ - Browser-safe control-plane access: action authorization status, approval status,
22
+ evidence references/summaries, incident replay metadata, install
23
+ registration/heartbeat plus audit, policy, queue, workflow reads, and optional
24
+ realtime subscriptions when an explicit websocket bearer/API-key handshake is
25
+ provided
26
+ - Trusted server management: governed action authorization, approval creation,
27
+ approval wait/polling, queue approvals, workflow management/runs, policy
28
+ management, org management, API-key administration, audit evidence exports,
29
+ incident replay lookup, and trust webhook verification through
30
+ `@globiguard/sdk/server`
31
+ - Realtime subscriptions use the control-plane websocket gateway and are
32
+ intentionally configured separately from REST publishable/secret credentials
33
+ because the websocket handshake trusts bearer/API-key auth, not the browser
34
+ publishable-key header model
35
+ - Audit evidence exports return a typed evidence-package artifact with requested
36
+ scope, control mappings, provenance references, review history, and summary
37
+ metadata aligned to the live control-plane export shape
38
+
39
+ ## Governed action quickstart
40
+
41
+ Authorize actions only from a trusted runtime:
42
+
43
+ ```ts
44
+ const decision = await serverClient.governedActions.authorizeAction({
45
+ context: {
46
+ actionType: "email.send",
47
+ destination: { type: "email", name: "customer-email" },
48
+ dataClasses: ["PII"],
49
+ payloadSummary: { topLevelKeys: ["recipient", "body"] },
50
+ idempotencyKey: "claim-123:email-status"
51
+ }
52
+ });
53
+
54
+ if (decision.decision === "ALLOW" || decision.decision === "MODIFY") {
55
+ // perform the real email send on the server
56
+ }
57
+ ```
58
+
59
+ Use a stable persisted idempotency key. A fresh random key per retry can
60
+ duplicate queued/resumed business actions.
61
+
62
+ Use `actionGateway: { mode: "sidecar" }` with `services.sidecar`, or `mode: "gateway"` with `services.gateway`, to route authorization through a local sidecar or governed gateway. Browser clients expose only `client.actions.getAuthorization()`, `getApproval()`, evidence reads, and incident replay metadata.
63
+
64
+ ## Webhook verification
65
+
66
+ ```ts
67
+ import { verifyTrustWebhook } from "@globiguard/sdk/server";
68
+
69
+ const verification = await verifyTrustWebhook({
70
+ headers,
71
+ rawBody,
72
+ signingSecret,
73
+ seenDelivery: async (deliveryId) => alreadyProcessed(deliveryId)
74
+ });
75
+ ```
76
+
77
+ The verifier checks signature, timestamp, event type, delivery ID, replay window,
78
+ and optional duplicate delivery state. It fails fast in browser runtimes.
79
+
80
+ Compatibility: these action contracts are beta (`2026-04-action-beta`) and intended for GlobiGuard control-plane/action gateway APIs that implement the same contract version.
@@ -0,0 +1,5 @@
1
+ import type { GlobiguardBootstrapProfile, GlobiguardBuildInstallHeartbeatInput, GlobiguardBuildInstallRegistrationInput, GlobiguardInstallHeartbeatRequest, GlobiguardInstallRegistrationRequest, GlobiguardResolvedBootstrapProfile } from "@globiguard/contracts";
2
+ export declare function resolveBootstrapProfile(profile: GlobiguardBootstrapProfile): GlobiguardResolvedBootstrapProfile;
3
+ export declare function buildInstallRegistrationRequest(profile: GlobiguardBootstrapProfile, input: GlobiguardBuildInstallRegistrationInput): GlobiguardInstallRegistrationRequest;
4
+ export declare function buildInstallHeartbeatRequest(profile: GlobiguardBootstrapProfile, input: GlobiguardBuildInstallHeartbeatInput): GlobiguardInstallHeartbeatRequest;
5
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,oCAAoC,EACpC,uCAAuC,EACvC,iCAAiC,EACjC,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,uBAAuB,CAAC;AAU/B,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,0BAA0B,GAClC,kCAAkC,CAqDpC;AAcD,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,0BAA0B,EACnC,KAAK,EAAE,uCAAuC,GAC7C,oCAAoC,CAiBtC;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,0BAA0B,EACnC,KAAK,EAAE,oCAAoC,GAC1C,iCAAiC,CAenC"}
@@ -0,0 +1,67 @@
1
+ import { GLOBIGUARD_DEPLOYMENT_MODES, GLOBIGUARD_ENVIRONMENTS, GLOBIGUARD_INSTALL_ISSUER_MODES, GLOBIGUARD_INSTALL_REPORTING_MODES } from "@globiguard/contracts";
2
+ import { GlobiguardConfigError } from "./errors.js";
3
+ export function resolveBootstrapProfile(profile) {
4
+ assertAllowedValue(profile.environment, GLOBIGUARD_ENVIRONMENTS, "environment");
5
+ assertAllowedValue(profile.deploymentMode, GLOBIGUARD_DEPLOYMENT_MODES, "deploymentMode");
6
+ assertAllowedValue(profile.issuerMode, GLOBIGUARD_INSTALL_ISSUER_MODES, "issuerMode");
7
+ assertAllowedValue(profile.installReporting, GLOBIGUARD_INSTALL_REPORTING_MODES, "installReporting");
8
+ if (profile.deploymentMode === "hosted" &&
9
+ profile.issuerMode !== "globiguard_issued") {
10
+ throw new GlobiguardConfigError("Hosted deployments must use globiguard-issued bootstrap credentials.");
11
+ }
12
+ if (profile.deploymentMode !== "hosted" &&
13
+ profile.issuerMode !== "customer_issued") {
14
+ throw new GlobiguardConfigError("Self-hosted and sovereign deployments must use customer-issued bootstrap credentials.");
15
+ }
16
+ if (profile.deploymentMode !== "hosted" &&
17
+ profile.installReporting === "default") {
18
+ throw new GlobiguardConfigError("Self-hosted and sovereign deployments must set installReporting to opt_in or disabled explicitly.");
19
+ }
20
+ return {
21
+ ...profile,
22
+ installRegistrationAllowed: profile.installReporting !== "disabled"
23
+ };
24
+ }
25
+ function assertAllowedValue(value, allowedValues, fieldName) {
26
+ if (!allowedValues.includes(value)) {
27
+ throw new GlobiguardConfigError(`${fieldName} must be one of: ${allowedValues.join(", ")}.`);
28
+ }
29
+ }
30
+ export function buildInstallRegistrationRequest(profile, input) {
31
+ const resolved = resolveBootstrapProfile(profile);
32
+ assertInstallRegistrationAllowed(resolved);
33
+ return {
34
+ packageName: input.packageName,
35
+ packageVersion: input.packageVersion,
36
+ integrationKind: input.integrationKind,
37
+ runtimeKind: input.runtimeKind,
38
+ environment: resolved.environment,
39
+ deploymentMode: resolved.deploymentMode,
40
+ issuerMode: resolved.issuerMode,
41
+ installReporting: resolved.installReporting,
42
+ installLabel: resolved.installLabel,
43
+ installFingerprint: resolved.installFingerprint,
44
+ metadata: input.metadata
45
+ };
46
+ }
47
+ export function buildInstallHeartbeatRequest(profile, input) {
48
+ const resolved = resolveBootstrapProfile(profile);
49
+ assertInstallRegistrationAllowed(resolved);
50
+ return {
51
+ packageVersion: input.packageVersion,
52
+ runtimeKind: input.runtimeKind,
53
+ environment: resolved.environment,
54
+ deploymentMode: resolved.deploymentMode,
55
+ issuerMode: resolved.issuerMode,
56
+ installReporting: resolved.installReporting,
57
+ installLabel: resolved.installLabel,
58
+ installFingerprint: resolved.installFingerprint,
59
+ metadata: input.metadata
60
+ };
61
+ }
62
+ function assertInstallRegistrationAllowed(profile) {
63
+ if (!profile.installRegistrationAllowed) {
64
+ throw new GlobiguardConfigError("Install registration and heartbeat are disabled for this bootstrap profile.");
65
+ }
66
+ }
67
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,2BAA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ED,SAAS,gCAAgC,CACvC,OAA2C;IAE3C,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,CAAC;QACxC,MAAM,IAAI,qBAAqB,CAC7B,6EAA6E,CAC9E,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { GlobiguardActionGatewayConfig, GlobiguardActionsClient, GlobiguardActionsReadClient, GlobiguardAuditClient, GlobiguardAuditReadClient, GlobiguardEnvironment, GlobiguardInstallsClient, GlobiguardLocalCredential, GlobiguardOrgsClient, GlobiguardPoliciesClient, GlobiguardPoliciesReadClient, GlobiguardPublishableCredential, GlobiguardQueueClient, GlobiguardQueueReadClient, GlobiguardRealtimeClient, GlobiguardResolvedActionGatewayConfig, GlobiguardSecretCredential, GlobiguardServiceTargets, GlobiguardWorkflowsReadClient, GlobiguardWorkflowsClient } from "@globiguard/contracts";
2
+ import { type GlobiguardGovernedActionsClient } from "./governed-actions.js";
3
+ import { type GlobiguardRequestOptions } from "./fetch.js";
4
+ import { type GlobiguardSdkRealtimeConfig } from "./realtime.js";
5
+ export interface GlobiguardClientBaseConfig {
6
+ environment: GlobiguardEnvironment;
7
+ services: GlobiguardServiceTargets;
8
+ clientName?: string;
9
+ fetch?: typeof fetch;
10
+ }
11
+ export interface GlobiguardServerClientConfig extends GlobiguardClientBaseConfig {
12
+ credential: GlobiguardSecretCredential | GlobiguardLocalCredential;
13
+ actionGateway?: GlobiguardActionGatewayConfig;
14
+ realtime?: GlobiguardSdkRealtimeConfig;
15
+ }
16
+ export interface GlobiguardBrowserClientConfig extends Omit<GlobiguardClientBaseConfig, "services"> {
17
+ credential: GlobiguardPublishableCredential | GlobiguardLocalCredential;
18
+ services: Pick<GlobiguardServiceTargets, "controlPlane">;
19
+ realtime?: GlobiguardSdkRealtimeConfig;
20
+ }
21
+ export interface GlobiguardTransport {
22
+ request<TResponse>(path: string, options?: GlobiguardRequestOptions): Promise<TResponse>;
23
+ }
24
+ export interface GlobiguardReadTransport {
25
+ request<TResponse>(path: string, options?: Omit<GlobiguardRequestOptions, "body"> & {
26
+ method?: "GET";
27
+ body?: never;
28
+ }): Promise<TResponse>;
29
+ }
30
+ export interface GlobiguardServerClient {
31
+ kind: "server";
32
+ environment: GlobiguardEnvironment;
33
+ actionGateway: GlobiguardResolvedActionGatewayConfig;
34
+ controlPlane: GlobiguardTransport;
35
+ brain?: GlobiguardTransport;
36
+ gateway?: GlobiguardTransport;
37
+ sidecar?: GlobiguardTransport;
38
+ actions: GlobiguardActionsClient;
39
+ audit: GlobiguardAuditClient;
40
+ installs: GlobiguardInstallsClient;
41
+ orgs: GlobiguardOrgsClient;
42
+ policies: GlobiguardPoliciesClient;
43
+ queue: GlobiguardQueueClient;
44
+ realtime?: GlobiguardRealtimeClient;
45
+ workflows: GlobiguardWorkflowsClient;
46
+ governedActions: GlobiguardGovernedActionsClient;
47
+ }
48
+ export interface GlobiguardBrowserClient {
49
+ kind: "browser";
50
+ environment: GlobiguardEnvironment;
51
+ actions: GlobiguardActionsReadClient;
52
+ audit: GlobiguardAuditReadClient;
53
+ installs: GlobiguardInstallsClient;
54
+ policies: GlobiguardPoliciesReadClient;
55
+ queue: GlobiguardQueueReadClient;
56
+ realtime?: GlobiguardRealtimeClient;
57
+ workflows: GlobiguardWorkflowsReadClient;
58
+ }
59
+ export declare function createServerClient(config: GlobiguardServerClientConfig): GlobiguardServerClient;
60
+ export declare function createBrowserClient(config: GlobiguardBrowserClientConfig): GlobiguardBrowserClient;
61
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B,EAC5B,+BAA+B,EAC/B,qBA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AE,KAAK,CAAC;KACd,GACA,OAAO,CAAC,SAAS,CAAC,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,qBAAqB,CAAC;IACnC,aAAa,EAAE,qCAAqC,CAAC;IACrD,YAAY,EAAE,mBAAmB,CAAC;IAClC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,OAAO,EAAE,uBAAuB,CAAC;IACjC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,wBAAwB,CAAC;IACnC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,wBAAwB,CAAC;IACnC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,SAAS,EAAE,yBAAyB,CAAC;IACrC,eAAe,EAAE,+BAA+B,CAAC;CAClD;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,qBAAqB,CAAC;IACnC,OAAO,EAAE,2BAA2B,CAAC;IACrC,KAAK,EAAE,yBAAyB,CAAC;IACjC,QAAQ,EAAE,wBAAwB,CAAC;IACnC,QAAQ,EAAE,4BAA4B,CAAC;IACvC,KAAK,EAAE,yBAAyB,CAAC;IACjC,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,SAAS,EAAE,6BAA6B,CAAC;CAC1C;AAiLD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,4BAA4B,GACnC,sBAAsB,CA6JxB;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,6BAA6B,GACpC,uBAAuB,CA2DzB"}
package/dist/client.js ADDED
@@ -0,0 +1,260 @@
1
+ import { GlobiguardConfigError } from "./errors.js";
2
+ import { createGovernedActionsClient } from "./governed-actions.js";
3
+ import { createActionsClient, createActionsReadClient } from "./resources/actions.js";
4
+ import { requestJson } from "./fetch.js";
5
+ import { createRealtimeClient } from "./realtime.js";
6
+ import { createAuditClient, createAuditReadClient } from "./resources/audit.js";
7
+ import { createInstallsClient } from "./resources/installs.js";
8
+ import { createOrgsClient } from "./resources/orgs.js";
9
+ import { createPoliciesClient, createPoliciesReadClient } from "./resources/policies.js";
10
+ import { createQueueClient, createQueueReadClient } from "./resources/queue.js";
11
+ import { createWorkflowsClient, createWorkflowsReadClient } from "./resources/workflows.js";
12
+ function isNonEmptyString(value) {
13
+ return typeof value === "string" && value.trim().length > 0;
14
+ }
15
+ function assertSecretCredentialShape(credential) {
16
+ if (!isNonEmptyString(credential.token) || !isNonEmptyString(credential.projectId)) {
17
+ throw new GlobiguardConfigError("Secret credentials require non-empty projectId and token values.");
18
+ }
19
+ }
20
+ function assertPublishableCredentialShape(credential) {
21
+ if (!isNonEmptyString(credential.token) || !isNonEmptyString(credential.projectId)) {
22
+ throw new GlobiguardConfigError("Publishable credentials require non-empty projectId and token values.");
23
+ }
24
+ }
25
+ function assertServiceUrl(serviceName, serviceUrl, environment, requireLocalHost = false) {
26
+ let parsedUrl;
27
+ try {
28
+ parsedUrl = new URL(serviceUrl);
29
+ }
30
+ catch {
31
+ throw new GlobiguardConfigError(`${serviceName} service URL must be a valid URL.`);
32
+ }
33
+ if (environment !== "local" && parsedUrl.protocol !== "https:") {
34
+ throw new GlobiguardConfigError(`${serviceName} service URL must use HTTPS outside the local environment.`);
35
+ }
36
+ if (parsedUrl.pathname !== "/" && parsedUrl.pathname !== "") {
37
+ throw new GlobiguardConfigError(`${serviceName} service URL must be a service origin, not a versioned API path.`);
38
+ }
39
+ if (requireLocalHost &&
40
+ parsedUrl.hostname !== "localhost" &&
41
+ parsedUrl.hostname !== "127.0.0.1" &&
42
+ parsedUrl.hostname !== "::1" &&
43
+ !parsedUrl.hostname.endsWith(".localhost")) {
44
+ throw new GlobiguardConfigError(`${serviceName} service URL must use a localhost or loopback host with local credentials.`);
45
+ }
46
+ }
47
+ function getFetch(fetchImpl) {
48
+ if (fetchImpl) {
49
+ return fetchImpl;
50
+ }
51
+ if (typeof fetch !== "function") {
52
+ throw new GlobiguardConfigError("A fetch implementation is required in this runtime.");
53
+ }
54
+ return fetch;
55
+ }
56
+ function createTransport(config) {
57
+ return {
58
+ request(path, options) {
59
+ return requestJson({
60
+ baseUrl: config.baseUrl,
61
+ clientName: config.clientName,
62
+ credential: config.credential,
63
+ environment: config.environment,
64
+ fetchImpl: config.fetchImpl,
65
+ path,
66
+ options
67
+ });
68
+ }
69
+ };
70
+ }
71
+ function createReadTransport(transport) {
72
+ return {
73
+ request(path, options) {
74
+ if (options?.method && options.method !== "GET") {
75
+ throw new GlobiguardConfigError("Browser control-plane transport only supports GET requests.");
76
+ }
77
+ if (options?.body !== undefined) {
78
+ throw new GlobiguardConfigError("Browser control-plane transport does not accept request bodies.");
79
+ }
80
+ return transport.request(path, {
81
+ ...options,
82
+ method: "GET"
83
+ });
84
+ }
85
+ };
86
+ }
87
+ function resolveActionGatewayConfig(actionGateway, services) {
88
+ const config = actionGateway ?? { mode: "control_plane" };
89
+ switch (config.mode) {
90
+ case "control_plane":
91
+ return {
92
+ ...config,
93
+ baseUrl: services.controlPlane
94
+ };
95
+ case "sidecar":
96
+ if (!services.sidecar) {
97
+ throw new GlobiguardConfigError("Action gateway mode 'sidecar' requires services.sidecar.");
98
+ }
99
+ return {
100
+ ...config,
101
+ baseUrl: services.sidecar
102
+ };
103
+ case "gateway":
104
+ if (!services.gateway) {
105
+ throw new GlobiguardConfigError("Action gateway mode 'gateway' requires services.gateway.");
106
+ }
107
+ return {
108
+ ...config,
109
+ baseUrl: services.gateway
110
+ };
111
+ default:
112
+ throw new GlobiguardConfigError("Action gateway mode must be control_plane, sidecar, or gateway.");
113
+ }
114
+ }
115
+ export function createServerClient(config) {
116
+ const fetchImpl = getFetch(config.fetch);
117
+ const clientName = config.clientName ?? "@globiguard/sdk";
118
+ const credentialKind = config.credential.kind;
119
+ if (!config.services.controlPlane) {
120
+ throw new GlobiguardConfigError("controlPlane service URL is required.");
121
+ }
122
+ assertServiceUrl("controlPlane", config.services.controlPlane, config.environment, credentialKind === "local");
123
+ if (credentialKind === "publishable") {
124
+ throw new GlobiguardConfigError("Server clients require secret or local credentials.");
125
+ }
126
+ if (credentialKind !== "secret" && credentialKind !== "local") {
127
+ throw new GlobiguardConfigError("Server clients require a recognized secret or local credential kind.");
128
+ }
129
+ if (config.credential.kind === "local" && config.environment !== "local") {
130
+ throw new GlobiguardConfigError("Local credentials may only be used with the local environment.");
131
+ }
132
+ if (credentialKind === "secret") {
133
+ assertSecretCredentialShape(config.credential);
134
+ }
135
+ if (config.credential.kind === "secret" &&
136
+ config.credential.environment !== config.environment) {
137
+ throw new GlobiguardConfigError("Secret credential environment must match the client environment.");
138
+ }
139
+ const controlPlane = createTransport({
140
+ baseUrl: config.services.controlPlane,
141
+ clientName,
142
+ credential: config.credential,
143
+ environment: config.environment,
144
+ fetchImpl
145
+ });
146
+ const brain = config.services.brain
147
+ ? createTransport({
148
+ baseUrl: config.services.brain,
149
+ clientName,
150
+ credential: config.credential,
151
+ environment: config.environment,
152
+ fetchImpl
153
+ })
154
+ : undefined;
155
+ const gateway = config.services.gateway
156
+ ? createTransport({
157
+ baseUrl: config.services.gateway,
158
+ clientName,
159
+ credential: config.credential,
160
+ environment: config.environment,
161
+ fetchImpl
162
+ })
163
+ : undefined;
164
+ const sidecar = config.services.sidecar
165
+ ? createTransport({
166
+ baseUrl: config.services.sidecar,
167
+ clientName,
168
+ credential: config.credential,
169
+ environment: config.environment,
170
+ fetchImpl
171
+ })
172
+ : undefined;
173
+ if (config.services.brain) {
174
+ assertServiceUrl("brain", config.services.brain, config.environment, credentialKind === "local");
175
+ }
176
+ if (config.services.gateway) {
177
+ assertServiceUrl("gateway", config.services.gateway, config.environment, credentialKind === "local");
178
+ }
179
+ if (config.services.sidecar) {
180
+ assertServiceUrl("sidecar", config.services.sidecar, config.environment, credentialKind === "local");
181
+ }
182
+ const actionGateway = resolveActionGatewayConfig(config.actionGateway, config.services);
183
+ const actionTransport = actionGateway.mode === "sidecar"
184
+ ? sidecar
185
+ : actionGateway.mode === "gateway"
186
+ ? gateway
187
+ : controlPlane;
188
+ if (!actionTransport) {
189
+ throw new GlobiguardConfigError("Action gateway transport could not be resolved.");
190
+ }
191
+ const actions = createActionsClient(actionTransport);
192
+ const audit = createAuditClient(controlPlane);
193
+ const queue = createQueueClient(controlPlane);
194
+ return {
195
+ kind: "server",
196
+ environment: config.environment,
197
+ actionGateway,
198
+ controlPlane,
199
+ brain,
200
+ gateway,
201
+ sidecar,
202
+ actions,
203
+ audit,
204
+ installs: createInstallsClient(controlPlane),
205
+ orgs: createOrgsClient(controlPlane),
206
+ policies: createPoliciesClient(controlPlane),
207
+ queue,
208
+ realtime: config.realtime
209
+ ? createRealtimeClient(config.services.controlPlane, config.realtime)
210
+ : undefined,
211
+ workflows: createWorkflowsClient(controlPlane),
212
+ governedActions: createGovernedActionsClient({
213
+ actions,
214
+ audit,
215
+ queue
216
+ })
217
+ };
218
+ }
219
+ export function createBrowserClient(config) {
220
+ const fetchImpl = getFetch(config.fetch);
221
+ const clientName = config.clientName ?? "@globiguard/sdk";
222
+ const credentialKind = config.credential.kind;
223
+ if (!config.services.controlPlane) {
224
+ throw new GlobiguardConfigError("controlPlane service URL is required.");
225
+ }
226
+ assertServiceUrl("controlPlane", config.services.controlPlane, config.environment, credentialKind === "local");
227
+ if (credentialKind === "secret") {
228
+ throw new GlobiguardConfigError("Browser clients require publishable or local credentials.");
229
+ }
230
+ if (credentialKind !== "publishable" && credentialKind !== "local") {
231
+ throw new GlobiguardConfigError("Browser clients require a recognized publishable or local credential kind.");
232
+ }
233
+ if (config.credential.kind === "local" && config.environment !== "local") {
234
+ throw new GlobiguardConfigError("Local credentials may only be used with the local environment.");
235
+ }
236
+ if (credentialKind === "publishable") {
237
+ assertPublishableCredentialShape(config.credential);
238
+ }
239
+ const controlPlane = createTransport({
240
+ baseUrl: config.services.controlPlane,
241
+ clientName,
242
+ credential: config.credential,
243
+ environment: config.environment,
244
+ fetchImpl
245
+ });
246
+ return {
247
+ kind: "browser",
248
+ environment: config.environment,
249
+ actions: createActionsReadClient(controlPlane),
250
+ audit: createAuditReadClient(controlPlane),
251
+ installs: createInstallsClient(controlPlane),
252
+ policies: createPoliciesReadClient(controlPlane),
253
+ queue: createQueueReadClient(controlPlane),
254
+ realtime: config.realtime
255
+ ? createRealtimeClient(config.services.controlPlane, config.realtime)
256
+ : undefined,
257
+ workflows: createWorkflowsReadClient(controlPlane)
258
+ };
259
+ }
260
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,2BAA2B,EAE5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAiC,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAoC,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAsElC,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KA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,YAAY,CAAC;QAC5C,QAAQ,EAAE,wBAAwB,CAAC,YAAY,CAAC;QAChD,KAAK,EAAE,qBAAqB,CAAC,YAAY,CAAC;QAC1C,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACvB,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC;YACrE,CAAC,CAAC,SAAS;QACb,SAAS,EAAE,yBAAyB,CAAC,YAAY,CAAC;KACnD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { GlobiguardEntitlementManifestEnvironment, GlobiguardOfflineDeploymentMode, GlobiguardSignedEntitlementManifest, GlobiguardEntitlementManifestPayload } from "@globiguard/contracts";
2
+ export interface VerifySignedEntitlementManifestOptions {
3
+ publicKeysById: Record<string, string>;
4
+ expectedIssuer?: string;
5
+ expectedOrgId?: string;
6
+ expectedProjectId?: string;
7
+ expectedEnvironment?: GlobiguardEntitlementManifestEnvironment;
8
+ expectedDeploymentMode?: GlobiguardOfflineDeploymentMode;
9
+ now?: Date;
10
+ }
11
+ export declare function verifySignedEntitlementManifest(manifest: GlobiguardSignedEntitlementManifest, options: VerifySignedEntitlementManifestOptions): GlobiguardEntitlementManifestPayload;
12
+ //# sourceMappingURL=entitlements.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlements.node.d.ts","sourceRoot":"","sources":["../src/entitlements.node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wCAAwC,EACxC,+BAA+B,EAC/B,mCAAmC,EAEnC,oCAAoC,EACrC,MAAM,uBAAuB,CAAC;AA0C/B,MAAM,WAAW,sCAAsC;IACrD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,wCAAwC,CAAC;IAC/D,sBAAsB,CAAC,EAAE,+BAA+B,CAAC;IACzD,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,mCAAmC,EAC7C,OAAO,EAAE,sCAAsC,GAC9C,oCAAoC,CAiHtC"}