@andco/protocol 0.0.1 → 0.0.3

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.d.ts CHANGED
@@ -7,13 +7,13 @@ export * from "./consent.js";
7
7
  export * from "./constants.js";
8
8
  export * from "./errors.js";
9
9
  export * from "./intent-input.js";
10
- export * from "./messages/authorization-response.js";
11
10
  export * from "./messages/base.js";
12
11
  export * from "./messages/click.js";
13
12
  export * from "./messages/error.js";
14
13
  export * from "./messages/index.js";
15
14
  export * from "./messages/init.js";
16
15
  export * from "./messages/popup.js";
16
+ export * from "./messages/presentation-response.js";
17
17
  export * from "./messages/ready.js";
18
18
  export * from "./messages/set-preferences.js";
19
19
  export * from "./miniapp-icon.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sCAAsC,CAAC;AACrD,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa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,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -7,13 +7,13 @@ export * from "./consent.js";
7
7
  export * from "./constants.js";
8
8
  export * from "./errors.js";
9
9
  export * from "./intent-input.js";
10
- export * from "./messages/authorization-response.js";
11
10
  export * from "./messages/base.js";
12
11
  export * from "./messages/click.js";
13
12
  export * from "./messages/error.js";
14
13
  export * from "./messages/index.js";
15
14
  export * from "./messages/init.js";
16
15
  export * from "./messages/popup.js";
16
+ export * from "./messages/presentation-response.js";
17
17
  export * from "./messages/ready.js";
18
18
  export * from "./messages/set-preferences.js";
19
19
  export * from "./miniapp-icon.js";
@@ -1,9 +1,9 @@
1
1
  import * as v from "valibot";
2
2
  /** Schema for every valid message sent through the AndCo bridge. */
3
3
  export declare const AndCoBridgeMessageSchema: v.VariantSchema<"type", [v.StrictObjectSchema<{
4
- readonly type: v.LiteralSchema<"authorization-response", undefined>;
4
+ readonly type: v.LiteralSchema<"presentation-response", undefined>;
5
5
  readonly presentationId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>;
6
- readonly authorizationUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>, undefined>;
6
+ readonly url: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>, undefined>;
7
7
  readonly protocol: v.LiteralSchema<"andco:sdk", undefined>;
8
8
  readonly version: v.LiteralSchema<2, undefined>;
9
9
  }, undefined>, v.StrictObjectSchema<{
@@ -1,14 +1,14 @@
1
1
  import * as v from "valibot";
2
- import { AndCoAuthorizationResponseMessageSchema } from "./authorization-response.js";
3
2
  import { AndCoClickEventSchema } from "./click.js";
4
3
  import { AndCoErrorEventSchema } from "./error.js";
5
4
  import { AndCoInitMessageSchema } from "./init.js";
6
5
  import { AndCoIntentCompleteEventSchema, AndCoIntentDismissEventSchema, AndCoOAuthAuthorizationCodeEventSchema, AndCoOAuthCompleteEventSchema, AndCoOAuthDismissEventSchema, AndCoOAuthErrorEventSchema, } from "./popup.js";
6
+ import { AndCoPresentationResponseMessageSchema } from "./presentation-response.js";
7
7
  import { AndCoReadyEventSchema } from "./ready.js";
8
8
  import { AndCoSetPreferencesMessageSchema } from "./set-preferences.js";
9
9
  /** Schema for every valid message sent through the AndCo bridge. */
10
10
  export const AndCoBridgeMessageSchema = /* @__PURE__ */ v.variant("type", [
11
- AndCoAuthorizationResponseMessageSchema,
11
+ AndCoPresentationResponseMessageSchema,
12
12
  AndCoReadyEventSchema,
13
13
  AndCoClickEventSchema,
14
14
  AndCoErrorEventSchema,
@@ -0,0 +1,20 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Resolves or cancels a deferred presentation the hosted button asked the parent SDK to prepare.
4
+ *
5
+ * One message for both flows on purpose. The hosted surface opens its window during the user's
6
+ * activation and only then asks where to send it, and that question is the same whether the
7
+ * destination is an authorization or an Intent — naming it after OAuth is what previously invited a
8
+ * second, parallel message for Intents.
9
+ */
10
+ export declare const AndCoPresentationResponseMessageSchema: v.StrictObjectSchema<{
11
+ readonly type: v.LiteralSchema<"presentation-response", undefined>;
12
+ readonly presentationId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>;
13
+ /** The resolved destination. Absent when resolution failed, which closes the pending window. */
14
+ readonly url: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>, undefined>;
15
+ readonly protocol: v.LiteralSchema<"andco:sdk", undefined>;
16
+ readonly version: v.LiteralSchema<2, undefined>;
17
+ }, undefined>;
18
+ /** Host response carrying a deferred presentation URL, or no URL when resolution failed. */
19
+ export type AndCoPresentationResponseMessage = v.InferOutput<typeof AndCoPresentationResponseMessageSchema>;
20
+ //# sourceMappingURL=presentation-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation-response.d.ts","sourceRoot":"","sources":["../../src/messages/presentation-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B;;;;;;;GAOG;AACH,eAAO,MAAM,sCAAsC;;;IAIjD,gGAAgG;;;;aAEhG,CAAC;AACH,4FAA4F;AAC5F,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sCAAsC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import * as v from "valibot";
2
+ import { AndCoMessageBaseEntries, AndCoPresentationIdSchema } from "./base.js";
3
+ /**
4
+ * Resolves or cancels a deferred presentation the hosted button asked the parent SDK to prepare.
5
+ *
6
+ * One message for both flows on purpose. The hosted surface opens its window during the user's
7
+ * activation and only then asks where to send it, and that question is the same whether the
8
+ * destination is an authorization or an Intent — naming it after OAuth is what previously invited a
9
+ * second, parallel message for Intents.
10
+ */
11
+ export const AndCoPresentationResponseMessageSchema = /* @__PURE__ */ v.strictObject({
12
+ ...AndCoMessageBaseEntries,
13
+ type: v.literal("presentation-response"),
14
+ presentationId: AndCoPresentationIdSchema,
15
+ /** The resolved destination. Absent when resolution failed, which closes the pending window. */
16
+ url: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(8_192))),
17
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andco/protocol",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "andco": {
5
5
  "release": 1780358400
6
6
  },
@@ -1,12 +0,0 @@
1
- import * as v from "valibot";
2
- /** Resolves or cancels a deferred authorization request from the hosted button. */
3
- export declare const AndCoAuthorizationResponseMessageSchema: v.StrictObjectSchema<{
4
- readonly type: v.LiteralSchema<"authorization-response", undefined>;
5
- readonly presentationId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>;
6
- readonly authorizationUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>, undefined>;
7
- readonly protocol: v.LiteralSchema<"andco:sdk", undefined>;
8
- readonly version: v.LiteralSchema<2, undefined>;
9
- }, undefined>;
10
- /** Host response containing a deferred authorization URL, or no URL when resolution failed. */
11
- export type AndCoAuthorizationResponseMessage = v.InferOutput<typeof AndCoAuthorizationResponseMessageSchema>;
12
- //# sourceMappingURL=authorization-response.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorization-response.d.ts","sourceRoot":"","sources":["../../src/messages/authorization-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,mFAAmF;AACnF,eAAO,MAAM,uCAAuC;;;;;;aAKlD,CAAC;AACH,+FAA+F;AAC/F,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uCAAuC,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- import * as v from "valibot";
2
- import { AndCoMessageBaseEntries, AndCoPresentationIdSchema } from "./base.js";
3
- /** Resolves or cancels a deferred authorization request from the hosted button. */
4
- export const AndCoAuthorizationResponseMessageSchema = /* @__PURE__ */ v.strictObject({
5
- ...AndCoMessageBaseEntries,
6
- type: v.literal("authorization-response"),
7
- presentationId: AndCoPresentationIdSchema,
8
- authorizationUrl: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(8_192))),
9
- });